diff --git a/lisp/elf.c b/lisp/elf.c index e962e553c27cadd0228b5fe0903d6b4e181882a0..100934484c36ceea7d8fb10671dab2da8e6c901c 100644 --- a/lisp/elf.c +++ b/lisp/elf.c @@ -8,7 +8,7 @@ Above changes put into main CVS branch. 05-Jul-2007. - $Id: elf.c,v 1.23 2010/07/31 00:03:23 rtoy Exp $ + $Id: elf.c,v 1.24 2010/07/31 01:07:15 rtoy Exp $ */ #include <stdio.h> @@ -379,7 +379,7 @@ obj_run_linker(long init_func_address, char *file) free(paths); printf("\t[%s: linking %s... \n", command, file); fflush(stdout); -#ifdef __linux__ +#if defined(__linux__) || defined(sparc) sprintf(command_line, "%s %s 0x%lx '%s' 0x%lx 0x%lx 0x%lx", command, C_COMPILER, init_func_address, file, (unsigned long) READ_ONLY_SPACE_START, diff --git a/lisp/elf.h b/lisp/elf.h index 50824a051c9d6379db6850df51070514eaefaa26..f8a16afd21e5ac5e3569566e3a20b8fda08ba1af 100644 --- a/lisp/elf.h +++ b/lisp/elf.h @@ -1,4 +1,4 @@ -/* $Id: elf.h,v 1.12 2010/07/31 00:03:23 rtoy Exp $ */ +/* $Id: elf.h,v 1.13 2010/07/31 01:07:15 rtoy Exp $ */ /* This code was written by Fred Gilham and has been placed in the public domain. It is provided "AS-IS" and without warranty of any kind. @@ -13,7 +13,12 @@ #define _ELF_H_INCLUDED_ -#if defined(__linux__) || defined(DARWIN) +#if defined(__linux__) || defined(DARWIN) || defined(sparc) +/* + * Yes, it's named badly. But it works for sparc too, not just x86. + * If we ever get this fixed on FreeBSD, then we can move + * linker-x86.sh to linker.sh and be done with it. + */ #define LINKER_SCRIPT "linker-x86.sh" #else #define LINKER_SCRIPT "linker.sh" diff --git a/lisp/lisp.c b/lisp/lisp.c index ef1174f684e631c01ac58f272eed7428fc5788a5..23c411f8fe482dff4eac7e0e33e5cb1f4d0c71a8 100644 --- a/lisp/lisp.c +++ b/lisp/lisp.c @@ -1,7 +1,7 @@ /* * main() entry point for a stand alone lisp image. * - * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.73 2010/07/30 22:51:58 rtoy Exp $ + * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.74 2010/07/31 01:07:15 rtoy Exp $ * */ @@ -439,7 +439,7 @@ main(int argc, const char *argv[], const char *envp[]) lispobj initial_function = 0; if (builtin_image_flag != 0) { -#if defined(i386) && (defined(__linux__) || defined(DARWIN)) +#if defined(sparc) || (defined(i386) && (defined(__linux__) || defined(DARWIN))) initial_function = (lispobj) initial_function_addr; #else initial_function = (lispobj) & initial_function_addr; diff --git a/tools/linker-x86.sh b/tools/linker-x86.sh index 641016daf69889599c79cb9065114af3d75de2e9..9149a813ec4d44ac92e2822e8afffebf5e2916a6 100644 --- a/tools/linker-x86.sh +++ b/tools/linker-x86.sh @@ -1,6 +1,6 @@ #!/bin/sh -# $Id: linker-x86.sh,v 1.3 2010/07/30 22:51:58 rtoy Exp $ +# $Id: linker-x86.sh,v 1.4 2010/07/31 01:07:15 rtoy Exp $ # This file written by Raymond Toy as part of CMU Common Lisp and is # placed in the public domain. @@ -41,6 +41,10 @@ case `uname` in # Specify how to link the entire lisp.a library OPT_ARCHIVE="-Wl,--whole-archive -Wl,$CMUCLLIB/lisp.a -Wl,--no-whole-archive" + + # Extra stuff. + + OPT_EXTRA="-rdynamic" # See Config.x86_linux OS_LIBS=-ldl ;; @@ -57,15 +61,36 @@ case `uname` in # just past the dynamic space. This messes things up, so we move it # to another address. This seems to be free, at least on 10.5. - OPT_EXTRA="-segaddr __LINKEDIT 0x99000000" + OPT_EXTRA="-segaddr __LINKEDIT 0x99000000 -rdynamic" # See Config.x86_darwin OS_LIBS= ;; + SunOS*) + if [ "$CCOMPILER" != "cc" ]; then + echo Using $CCOMPILER is not currently supported + exit 1 + fi + # We don't need anything special to set the starting address. + # map_core_sections does that for us on sparc. + + # Specify how to link the entire lisp.a library + OPT_ARCHIVE="-Xlinker -z -Xlinker allextract -Xlinker $CMUCLLIB/lisp.a -Xlinker -z -Xlinker defaultextract" + + # Extra stuff. For some reason one __LINKEDIT segment is mapped + # just past the dynamic space. This messes things up, so we move it + # to another address. This seems to be free, at least on 10.5. + + OPT_EXTRA="-Bdynamic" + + # See Config.sparc_sunc + OS_LIBS="-lsocket -lnsl -ldl" + ;; + esac trap 'rm -f $OUTDIR/$OPT_IFADDR' 0 (cd $OUTDIR echo "long initial_function_addr = $IFADDR;" > $OPT_IFADDR -$CCOMPILER -m32 -o $OUTNAME -rdynamic $OPT_IFADDR $OPT_ARCHIVE $OPT_CORE $RO_ADDR $STATIC_ADDR $DYN_ADDR $OPT_EXTRA $OS_LIBS -lm) +$CCOMPILER -m32 -o $OUTNAME $OPT_IFADDR $OPT_ARCHIVE $OPT_CORE $RO_ADDR $STATIC_ADDR $DYN_ADDR $OPT_EXTRA $OS_LIBS -lm)