CMUCL commit: src (4 files)
Raymond Toy
rtoy at common-lisp.net
Sat Jul 31 03:07:15 CEST 2010
Date: Friday, July 30, 2010 @ 21:07:15
Author: rtoy
Path: /project/cmucl/cvsroot/src
Modified: lisp/elf.c lisp/elf.h lisp/lisp.c tools/linker-x86.sh
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.
---------------------+
lisp/elf.c | 4 ++--
lisp/elf.h | 9 +++++++--
lisp/lisp.c | 4 ++--
tools/linker-x86.sh | 31 ++++++++++++++++++++++++++++---
4 files changed, 39 insertions(+), 9 deletions(-)
Index: src/lisp/elf.c
diff -u src/lisp/elf.c:1.23 src/lisp/elf.c:1.24
--- src/lisp/elf.c:1.23 Fri Jul 30 20:03:23 2010
+++ src/lisp/elf.c Fri Jul 30 21:07:15 2010
@@ -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 @@
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,
Index: src/lisp/elf.h
diff -u src/lisp/elf.h:1.12 src/lisp/elf.h:1.13
--- src/lisp/elf.h:1.12 Fri Jul 30 20:03:23 2010
+++ src/lisp/elf.h Fri Jul 30 21:07:15 2010
@@ -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"
Index: src/lisp/lisp.c
diff -u src/lisp/lisp.c:1.73 src/lisp/lisp.c:1.74
--- src/lisp/lisp.c:1.73 Fri Jul 30 18:51:58 2010
+++ src/lisp/lisp.c Fri Jul 30 21:07:15 2010
@@ -1,7 +1,7 @@
/*
* main() entry point for a stand alone lisp image.
*
- * $Header: /project/cmucl/cvsroot/src/lisp/lisp.c,v 1.73 2010-07-30 22:51:58 rtoy Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/lisp.c,v 1.74 2010-07-31 01:07:15 rtoy Exp $
*
*/
@@ -439,7 +439,7 @@
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;
Index: src/tools/linker-x86.sh
diff -u src/tools/linker-x86.sh:1.3 src/tools/linker-x86.sh:1.4
--- src/tools/linker-x86.sh:1.3 Fri Jul 30 18:51:58 2010
+++ src/tools/linker-x86.sh Fri Jul 30 21:07:15 2010
@@ -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 @@
# 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 @@
# 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)
More information about the cmucl-commit
mailing list