From 1a6c2275ab21acc79d3a6866d4749dda8f02f7d7 Mon Sep 17 00:00:00 2001 From: Kevin Rosenberg Date: Wed, 19 Nov 2003 13:48:07 +0000 Subject: [PATCH] 0.8.4.48: * Add tools-for-build program to determine if asm/ldt.h has the new name for the modify_ldt structure. * Fixes to properly compile contribs on x86_64 systems --- contrib/asdf-module.mk | 26 +++++++++++++++++++++++++- contrib/{sb-posix => sb-bsd-sockets}/Makefile | 2 +- contrib/sb-grovel/def-to-lisp.lisp | 8 ++++++-- contrib/sb-posix/Makefile | 1 + make-config.sh | 4 ++++ src/runtime/x86-linux-os.c | 10 ++++++++-- tools-for-build/Makefile | 4 ++-- version.lisp-expr | 2 +- 8 files changed, 48 insertions(+), 9 deletions(-) copy contrib/{sb-posix => sb-bsd-sockets}/Makefile (54%) diff --git a/contrib/asdf-module.mk b/contrib/asdf-module.mk index 0e5a5385f..c646b9df0 100644 --- a/contrib/asdf-module.mk +++ b/contrib/asdf-module.mk @@ -1,5 +1,29 @@ CC=gcc -export CC SBCL + +# Need to set CFLAGS and LDFLAGS here. sb-posix, sb-grovel, and +# sb-bsd-sockets depends upon these being set on x86_64. Setting these +# in their Makefile's is not adequate since their asd files are +# invoked when loaded from other modules which don't require these +# environmental values in their Makefile's. + +UNAME:=$(shell uname -m) +export CFLAGS=-fPIC +ifeq (solaris,$(UNAME)) + export LDFLAGS=-shared -lresolv -lsocket -lnsl +else + ifeq (Darwin,$(UNAME)) + export LDFLAGS=-bundle + else + ifeq (x86_64,$(UNAME)) + export LDFLAGS=-m32 -shared + export CFLAGS+= -m32 + else + export LDFLAGS=-shared + endif + endif +endif + +export CC SBCL CFLAGS LDFLAGS all: $(EXTRA_ALL_TARGETS) $(MAKE) -C ../asdf diff --git a/contrib/sb-posix/Makefile b/contrib/sb-bsd-sockets/Makefile similarity index 54% copy from contrib/sb-posix/Makefile copy to contrib/sb-bsd-sockets/Makefile index 8243a7697..c1335ebf0 100644 --- a/contrib/sb-posix/Makefile +++ b/contrib/sb-bsd-sockets/Makefile @@ -1,2 +1,2 @@ -SYSTEM=sb-posix +SYSTEM=sb-bsd-sockets include ../asdf-module.mk diff --git a/contrib/sb-grovel/def-to-lisp.lisp b/contrib/sb-grovel/def-to-lisp.lisp index 3b2cba1aa..88e4bae92 100644 --- a/contrib/sb-grovel/def-to-lisp.lisp +++ b/contrib/sb-grovel/def-to-lisp.lisp @@ -104,8 +104,12 @@ printf(\"(in-package ~S)\\\n\");~%" package-name) (funcall (intern "C-CONSTANTS-EXTRACT" (find-package "SB-GROVEL")) filename tmp-c-source (constants-package component)) (and - (= (run-shell-command "gcc -o ~S ~S" (namestring tmp-a-dot-out) - (namestring tmp-c-source)) 0) + (= (run-shell-command "gcc ~A -o ~S ~S" + (if (sb-ext:posix-getenv "CFLAGS") + (sb-ext:posix-getenv "CFLAGS") + "") + (namestring tmp-a-dot-out) + (namestring tmp-c-source)) 0) (= (run-shell-command "~A >~A" (namestring tmp-a-dot-out) (namestring tmp-constants)) 0) diff --git a/contrib/sb-posix/Makefile b/contrib/sb-posix/Makefile index 8243a7697..7464f2e1e 100644 --- a/contrib/sb-posix/Makefile +++ b/contrib/sb-posix/Makefile @@ -1,2 +1,3 @@ SYSTEM=sb-posix include ../asdf-module.mk + diff --git a/make-config.sh b/make-config.sh index e71a786fc..bd409f7f0 100644 --- a/make-config.sh +++ b/make-config.sh @@ -167,6 +167,10 @@ cd $original_dir # similar with :STACK-GROWS-FOOWARD, too. -- WHN 2002-03-03 if [ "$sbcl_arch" = "x86" ] ; then printf ' :gencgc :stack-grows-downward-not-upward :c-stack-is-control-stack' >> $ltf + cd tools-for-build + $GNUMAKE -I ../src/runtime modify-ldt-struct-name + ./modify-ldt-struct-name > ../src/runtime/modify-ldt-struct-name.h + cd .. elif [ "$sbcl_arch" = "mips" ] ; then # Use a little C program to try to guess the endianness. Ware # cross-compilers! diff --git a/src/runtime/x86-linux-os.c b/src/runtime/x86-linux-os.c index 7d42968b5..b39df5ad0 100644 --- a/src/runtime/x86-linux-os.c +++ b/src/runtime/x86-linux-os.c @@ -40,10 +40,16 @@ #include #include #include +#include "modify-ldt-struct-name.h" #include #include #include "thread.h" /* dynamic_values_bytes */ +#ifndef MODIFY_LDT_STRUCT_NAMED_USER_DESC +/* old glibc */ +#define user_desc modify_ldt_ldt_s +#endif + _syscall3(int, modify_ldt, int, func, void *, ptr, unsigned long, bytecount ); #include "validate.h" @@ -68,7 +74,7 @@ int arch_os_thread_init(struct thread *thread) { /* this must be called from a function that has an exclusive lock * on all_threads */ - struct modify_ldt_ldt_s ldt_entry = { + struct user_desc ldt_entry = { 1, 0, 0, /* index, address, length filled in later */ 1, MODIFY_LDT_CONTENTS_DATA, 0, 0, 0, 1 }; @@ -123,7 +129,7 @@ struct thread *debug_get_fs() { */ int arch_os_thread_cleanup(struct thread *thread) { - struct modify_ldt_ldt_s ldt_entry = { + struct user_desc ldt_entry = { 0, 0, 0, 0, MODIFY_LDT_CONTENTS_DATA, 0, 0, 0, 0 }; diff --git a/tools-for-build/Makefile b/tools-for-build/Makefile index db33d7dc8..e3c2c9706 100644 --- a/tools-for-build/Makefile +++ b/tools-for-build/Makefile @@ -11,7 +11,7 @@ CPPFLAGS=-I../src/runtime -all: grovel-headers determine-endianness where-is-mcontext +all: grovel-headers determine-endianness where-is-mcontext modify-ldt-struct-name clean: - rm -f *.o grovel-headers determine-endianness where-is-mcontext + rm -f *.o grovel-headers determine-endianness where-is-mcontext modify-ldt-structure-name diff --git a/version.lisp-expr b/version.lisp-expr index 8ac8c080a..1a6c9678c 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.8.5.47" +"0.8.5.48" -- 2.11.4.GIT