Skip to content
Snippets Groups Projects
Commit 1424559e authored by rtoy's avatar rtoy
Browse files

Update how executable images are done on Solaris to match Linux and

Darwin.

lisp/elf.h:
o Solaris can use linux-x86.sh too.  (Need to rename this someday!)

lisp/elf.c:
o Use same command line for sparc as for linux.

lisp/lisp.c:
o Setup up initial_function the same way as on linux.

tools/linker-x86.sh:
o Add -rdynamic or -Bdynamic as needed.
o Add support for Solaris using Sun C.
parent e4b9dc20
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
Above changes put into main CVS branch. 05-Jul-2007. 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> #include <stdio.h>
...@@ -379,7 +379,7 @@ obj_run_linker(long init_func_address, char *file) ...@@ -379,7 +379,7 @@ obj_run_linker(long init_func_address, char *file)
free(paths); free(paths);
printf("\t[%s: linking %s... \n", command, file); printf("\t[%s: linking %s... \n", command, file);
fflush(stdout); fflush(stdout);
#ifdef __linux__ #if defined(__linux__) || defined(sparc)
sprintf(command_line, "%s %s 0x%lx '%s' 0x%lx 0x%lx 0x%lx", command, sprintf(command_line, "%s %s 0x%lx '%s' 0x%lx 0x%lx 0x%lx", command,
C_COMPILER, init_func_address, file, C_COMPILER, init_func_address, file,
(unsigned long) READ_ONLY_SPACE_START, (unsigned long) READ_ONLY_SPACE_START,
......
/* $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 /* 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. provided "AS-IS" and without warranty of any kind.
...@@ -13,7 +13,12 @@ ...@@ -13,7 +13,12 @@
#define _ELF_H_INCLUDED_ #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" #define LINKER_SCRIPT "linker-x86.sh"
#else #else
#define LINKER_SCRIPT "linker.sh" #define LINKER_SCRIPT "linker.sh"
......
/* /*
* main() entry point for a stand alone lisp image. * 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[]) ...@@ -439,7 +439,7 @@ main(int argc, const char *argv[], const char *envp[])
lispobj initial_function = 0; lispobj initial_function = 0;
if (builtin_image_flag != 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; initial_function = (lispobj) initial_function_addr;
#else #else
initial_function = (lispobj) & initial_function_addr; initial_function = (lispobj) & initial_function_addr;
......
#!/bin/sh #!/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 # This file written by Raymond Toy as part of CMU Common Lisp and is
# placed in the public domain. # placed in the public domain.
...@@ -41,6 +41,10 @@ case `uname` in ...@@ -41,6 +41,10 @@ case `uname` in
# Specify how to link the entire lisp.a library # Specify how to link the entire lisp.a library
OPT_ARCHIVE="-Wl,--whole-archive -Wl,$CMUCLLIB/lisp.a -Wl,--no-whole-archive" OPT_ARCHIVE="-Wl,--whole-archive -Wl,$CMUCLLIB/lisp.a -Wl,--no-whole-archive"
# Extra stuff.
OPT_EXTRA="-rdynamic"
# See Config.x86_linux # See Config.x86_linux
OS_LIBS=-ldl OS_LIBS=-ldl
;; ;;
...@@ -57,15 +61,36 @@ case `uname` in ...@@ -57,15 +61,36 @@ case `uname` in
# just past the dynamic space. This messes things up, so we move it # 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. # 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 # See Config.x86_darwin
OS_LIBS= 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 esac
trap 'rm -f $OUTDIR/$OPT_IFADDR' 0 trap 'rm -f $OUTDIR/$OPT_IFADDR' 0
(cd $OUTDIR (cd $OUTDIR
echo "long initial_function_addr = $IFADDR;" > $OPT_IFADDR 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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment