0.8.4.5:
authorChristophe Rhodes <csr21@cam.ac.uk>
Fri, 3 Oct 2003 10:59:34 +0000 (10:59 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Fri, 3 Oct 2003 10:59:34 +0000 (10:59 +0000)
PPC build fix (kludge)
... use offsetof() to find where the glibc maintainers have put
the uc_mcontext slot today, and delegate to appropriate
source code
non-x86/linux build fix
... undefine arch_os_get_current_thread() from individual
architecture header files
Everywhere clean.sh fix
... only include src/runtime/Config in tools-for-build/Makefile
if it exists.  Now clean.sh works on a clean tree.

13 files changed:
make-config.sh
src/runtime/.cvsignore
src/runtime/alpha-osf1-os.c
src/runtime/bsd-os.c
src/runtime/hppa-linux-os.c
src/runtime/mips-linux-os.c
src/runtime/ppc-linux-os.c
src/runtime/sparc-linux-os.c
src/runtime/sparc-sunos-os.c
tools-for-build/.cvsignore
tools-for-build/Makefile
tools-for-build/where-is-mcontext.c [new file with mode: 0644]
version.lisp-expr

index 36ed8b2..438c969 100644 (file)
@@ -95,6 +95,7 @@ ln -s $sbcl_arch-lispregs.h target-lispregs.h
 case `uname` in 
     Linux)
        printf ' :linux' >> $ltf
+       sbcl_os="linux"
        if [ "`uname -m`" = "x86_64" ]; then
            ln -s Config.x86_64-linux Config
        else
@@ -108,6 +109,7 @@ case `uname` in
         # the marketers forgot to tell the engineers about Digital Unix
         # _or_ OSF/1 ...
        printf ' :osf1' >> $ltf
+       sbcl_os="osf1"
         ln -s Config.$sbcl_arch-osf1 Config
        ln -s $sbcl_arch-osf1-os.h target-arch-os.h
        ln -s osf1-os.h target-os.h
@@ -119,10 +121,12 @@ case `uname` in
        case `uname` in
            FreeBSD)
                printf ' :freebsd' >> $ltf
+               sbcl_os="freebsd"
                ln -s Config.$sbcl_arch-freebsd Config
                ;;
            OpenBSD)
                printf ' :openbsd' >> $ltf
+               sbcl_os="openbsd"
                ln -s Config.$sbcl_arch-openbsd Config
                ;;
            *)
@@ -133,6 +137,7 @@ case `uname` in
        ;;
     Darwin)
        printf ' :bsd' >> $ltf
+       sbcl_os="darwin"
        ln -s $sbcl_arch-darwin-os.h target-arch-os.h
        ln -s bsd-os.h target-os.h
        printf ' :darwin' >> $ltf
@@ -140,6 +145,7 @@ case `uname` in
        ;;
     SunOS)
         printf ' :sunos' >> $ltf
+       sbcl_os="sunos"
        ln -s Config.$sbcl_arch-sunos Config
        ln -s $sbcl_arch-sunos-os.h target-arch-os.h
        ln -s sunos-os.h target-os.h
@@ -166,6 +172,12 @@ elif [ "$sbcl_arch" = "mips" ] ; then
     # cross-compilers!
     $GNUMAKE -C tools-for-build determine-endianness
     tools-for-build/determine-endianness >> $ltf
+elif [ "$sbcl_arch" = "ppc" -a "$sbcl_os" = "linux" ]; then
+    # Use a C program to detect which kind of glibc we're building on,
+    # to bandage across the break in source compatibility between
+    # versions 2.3.1 and 2.3.2
+    $GNUMAKE -C tools-for-build where-is-mcontext
+    tools-for-build/where-is-mcontext > src/runtime/ppc-linux-mcontext.h
 else
     # Nothing need be done in this case, but sh syntax wants a placeholder.
     echo > /dev/null
index 38a8e12..f25cc0b 100644 (file)
@@ -1,5 +1,6 @@
 depend
 genesis
+ppc-linux-mcontext.h
 sbcl
 sbcl.h
 sbcl.nm
index d4e54d8..aeec91b 100644 (file)
@@ -44,9 +44,6 @@ size_t os_vm_page_size;
 #ifdef LISP_FEATURE_SB_THREAD
 #error "Define threading support functions"
 #else
-struct thread *arch_os_get_current_thread() {
-    return all_threads;
-}
 int arch_os_thread_init(struct thread *thread) {
     return 1;                  /* success */
 }
index 4f76233..f31f5fc 100644 (file)
@@ -218,9 +218,6 @@ os_install_interrupt_handlers(void)
 #ifdef LISP_FEATURE_SB_THREAD
 #error "Define threading support functions"
 #else
-struct thread *arch_os_get_current_thread() {
-    return all_threads;
-}
 int arch_os_thread_init(struct thread *thread) {
   stack_t sigstack;
 #ifdef LISP_FEATURE_C_STACK_IS_CONTROL_STACK
index f69b16b..696ee1d 100644 (file)
@@ -40,9 +40,6 @@ size_t os_vm_page_size;
 #ifdef LISP_FEATURE_SB_THREAD
 #error "Define threading support functions"
 #else
-struct thread *arch_os_get_current_thread() {
-    return all_threads;
-}
 int arch_os_thread_init(struct thread *thread) {
     return 1;                  /* success */
 }
index 27ced24..2f4a0da 100644 (file)
@@ -45,9 +45,6 @@ size_t os_vm_page_size;
 #ifdef LISP_FEATURE_SB_THREAD
 #error "Define threading support functions"
 #else
-struct thread *arch_os_get_current_thread() {
-    return all_threads;
-}
 int arch_os_thread_init(struct thread *thread) {
     return 1;                  /* success */
 }
index f4fe13c..c4a30f6 100644 (file)
 #include <unistd.h>
 
 #include "validate.h"
+#include "ppc-linux-mcontext.h"
+
 size_t os_vm_page_size;
 
-struct thread *arch_os_get_current_thread() {
-    return all_threads;
-}
 int arch_os_thread_init(struct thread *thread) {
     return 1;                  /* success */
 }
@@ -51,25 +50,41 @@ int arch_os_thread_cleanup(struct thread *thread) {
 os_context_register_t   *
 os_context_register_addr(os_context_t *context, int offset)
 {
+#if defined(GLIBC231_STYLE_UCONTEXT)
     return &((context->uc_mcontext.regs)->gpr[offset]);
+#elif defined(GLIBC232_STYLE_UCONTEXT)
+    return &((context->uc_regs->gregs)[offset]);
+#endif
 }
 
 os_context_register_t *
 os_context_pc_addr(os_context_t *context)
 {
+#if defined(GLIBC231_STYLE_UCONTEXT)
     return &((context->uc_mcontext.regs)->nip);
+#elif defined(GLIBC232_STYLE_UCONTEXT)
+    return &((context->uc_regs->gregs)[PT_NIP]);
+#endif
 }
 
 os_context_register_t *
 os_context_lr_addr(os_context_t *context)
 {
+#if defined(GLIBC231_STYLE_UCONTEXT)
     return &((context->uc_mcontext.regs)->link);
+#elif defined(GLIBC232_STYLE_UCONTEXT)
+    return &((context->uc_regs->gregs)[PT_LNK]);
+#endif
 }
 
 sigset_t *
 os_context_sigmask_addr(os_context_t *context)
 {
+#if defined(GLIBC231_STYLE_UCONTEXT)
     return &context->uc_sigmask;
+#elif defined(GLIBC232_STYLE_UCONTEXT)
+    return &context->uc_oldsigmask;
+#endif
 }
 
 unsigned long
@@ -80,7 +95,11 @@ os_context_fp_control(os_context_t *context)
        registers, and PT_FPSCR is an offset that is larger than 32
        (the number of ppc registers), but that happens to get the
        right answer. -- CSR, 2002-07-11 */
+#if defined(GLIBC231_STYLE_UCONTEXT)
     return context->uc_mcontext.regs->gpr[PT_FPSCR]; 
+#elif defined(GLIBC232_STYLE_UCONTEXT)
+    return context->uc_regs->gregs[PT_FPSCR]; 
+#endif
 }
 
 void 
index 8c685c2..cae1bbf 100644 (file)
@@ -40,9 +40,6 @@ size_t os_vm_page_size;
 #ifdef LISP_FEATURE_SB_THREAD
 #error "Define threading support functions"
 #else
-struct thread *arch_os_get_current_thread() {
-    return all_threads;
-}
 int arch_os_thread_init(struct thread *thread) {
     return 1;                  /* success */
 }
index 73440fb..72a2931 100644 (file)
@@ -39,9 +39,6 @@
 #ifdef LISP_FEATURE_SB_THREAD
 #error "Define threading support functions"
 #else
-struct thread *arch_os_get_current_thread() {
-    return all_threads;
-}
 int arch_os_thread_init(struct thread *thread) {
     return 1;                  /* success */
 }
index 38fb61e..144fd45 100644 (file)
@@ -1,2 +1,3 @@
 grovel_headers
 determine-endianness
+where-is-mcontext
index e6756b6..b188542 100644 (file)
@@ -7,11 +7,11 @@
 # provided with absolutely no warranty. See the COPYING and CREDITS
 # files for more information.
 
-include ../src/runtime/Config
+-include ../src/runtime/Config
 
 CPPFLAGS=-I../src/runtime
 
-all: grovel_headers determine-endianness
+all: grovel_headers determine-endianness where-is-mcontext
 
 clean: 
-       rm -f *.o grovel_headers determine-endianness
+       rm -f *.o grovel_headers determine-endianness where-is-mcontext
diff --git a/tools-for-build/where-is-mcontext.c b/tools-for-build/where-is-mcontext.c
new file mode 100644 (file)
index 0000000..7754111
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Find the offset of uc_mcontext in a ucontext structure, to enable
+ * building on both (glibc-2.3.1 and earlier) and (glibc-2.3.2 and
+ * later), after the glibc developers broke source code compatibility.
+ * (see also Debian bugs #207806 and #209074)
+ */
+
+/*
+ * This software is part of the SBCL system. See the README file for
+ * more information.
+ *
+ * While most of SBCL is derived from the CMU CL system, many
+ * utilities for the build process (like this one) were written from
+ * scratch after the fork from CMU CL.
+ * 
+ * This software is in the public domain and is provided with
+ * absolutely no warranty. See the COPYING and CREDITS files for
+ * more information.
+ */
+
+#include <stdio.h>
+#include <stddef.h>
+#include <sys/ucontext.h>
+
+int main (int argc, char *argv[]) {
+    
+    if(argc != 1) {
+       fprintf(stderr,"%s: command line arguments provided.  Don't do that.\n", argv[0]);
+       exit(1);
+    }
+    
+    printf("\
+/* This is an automatically-generated file; please do not edit it.\n\
+   See the program tools-for-build/where-is-mcontext.c.\n\
+ */\n\n");
+    
+    printf("\
+#ifndef PPC_LINUX_MCONTEXT_H\n\
+#define PPC_LINUX_MCONTEXT_H\n\n");
+
+    switch (offsetof(ucontext_t,uc_mcontext)) {
+    case 192:
+       printf("#define GLIBC232_STYLE_UCONTEXT\n\n");
+       break;
+    case 20:
+       printf("#define GLIBC231_STYLE_UCONTEXT\n\n");
+       break;
+    default:
+       printf("#error \"Unknown PPC/Linux ucontext layout\"\n\n");
+    }
+    printf("\
+#endif /* PPC_LINUX_MCONTEXT_H */\n");
+}
+
index c029261..269edf6 100644 (file)
@@ -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.4.4"
+"0.8.4.5"