1.0.39.3: support building on darwin x86 and x86-64 without the dlshim
authorCyrus Harmon <ch-sbcl@bobobeach.com>
Thu, 3 Jun 2010 04:39:50 +0000 (04:39 +0000)
committerCyrus Harmon <ch-sbcl@bobobeach.com>
Thu, 3 Jun 2010 04:39:50 +0000 (04:39 +0000)
  * x86 config -mmacosx-version-min cleanup

  * remove dlshim feature in make-config.sh

  * fix extern-alien-name and ldso naming conventions

  * kludge in load-cold-foreign-symbol-table to strip off the leading
    #\_ from the nm parsing

  * change dependency on ldso stubs for dlopen and friends to be
    #!-dlshim instead of #!-darwin

  * remove Config.x86-64-darwin9+ and replace with makefile
    conditionals

  * add :dlshim feature for darwin in make-config.sh and rework the
    darwin9+ stuff

  * make grovel-headers.c load genesis/config.h first so that we can
    use the LISP_FEATURE_xxx conditionals earlier

NEWS
make-config.sh
src/code/foreign.lisp
src/compiler/generic/genesis.lisp
src/runtime/Config.x86-64-darwin
src/runtime/Config.x86-64-darwin9+ [deleted file]
src/runtime/Config.x86-darwin
src/runtime/darwin-os.c
tools-for-build/grovel-headers.c
tools-for-build/ldso-stubs.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 1a17085..87c8c0e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ changes relative to sbcl-1.0.39:
   * bug fix: Name conflicts between symbols passed as arguments to a
 single call to IMPORT no longer add multiple symbols with the same name
 to the package (detectable via DO-SYMBOLS).
+  * bug fix: support building without the dlshim on darwin x86 and x86-64
+    (lp#533470).
 
 changes in sbcl-1.0.39 relative to sbcl-1.0.38:
   * bug fix: Backtrace from undefined function on x86 and x86-64 now show
index afa9350..84b34f5 100644 (file)
@@ -146,12 +146,11 @@ echo //setting up OS-dependent information
 
 # Under Darwin x86-64, guess whether Darwin 9+ or below.
 if [ "$sbcl_os" = "darwin" ] && [ "$sbcl_arch" = "x86-64" ]; then
-       darwin_version=`uname -r`
-       darwin_version_major=${DARWIN_VERSION_MAJOR:-${darwin_version%%.*}}
-       if (( 8 < $darwin_version_major )); then
-               ver9_or_above="9+"
-               printf ' :inode64' >> $ltf
-       fi
+    darwin_version=`uname -r`
+    darwin_version_major=${DARWIN_VERSION_MAJOR:-${darwin_version%%.*}}
+    if (( 8 < $darwin_version_major )); then
+       printf ' :inode64 :darwin9-or-better' >> $ltf
+    fi
 fi
 
 original_dir=`pwd`
@@ -247,7 +246,7 @@ case "$sbcl_os" in
         fi
         link_or_copy $sbcl_arch-darwin-os.h target-arch-os.h
         link_or_copy bsd-os.h target-os.h
-        link_or_copy Config.$sbcl_arch-darwin$ver9_or_above Config
+        link_or_copy Config.$sbcl_arch-darwin Config
         ;;
     sunos)
         printf ' :unix' >> $ltf
index bd89cd8..e81185d 100644 (file)
@@ -16,8 +16,8 @@
 
 (defun extern-alien-name (name)
   (handler-case
-      #!+elf (coerce name 'base-string)
-      #!+(or mach-o win32) (concatenate 'base-string "_" name)
+      #!+(or elf (and mach-o (not dlshim))) (coerce name 'base-string)
+      #!+(or (and mach-o dlshim) win32) (concatenate 'base-string "_" name)
     (error ()
       (error "invalid external alien name: ~S" name))))
 
@@ -35,8 +35,9 @@
     (values
      (or (gethash extern table)
          (gethash (concatenate 'base-string
-                               #!+(and darwin (or x86 x86-64 ppc)) "_ldso_stub__"
-                               #!-(and darwin (or x86 x86-64 ppc)) "ldso_stub__"
+                               #!+(and mach-o dlshim) "_ldso_stub_"
+                               #!+(and mach-o (not dlshim)) "ldso_stub__"
+                               #!-mach-o "ldso_stub__"
                                extern) table)))))
 
 (defun find-foreign-symbol-address (name)
index 6470fda..bfea5da 100644 (file)
@@ -1597,6 +1597,13 @@ core and return a descriptor to it."
                                 (subseq line (1+ p2)))
                         (values (parse-integer line :end p1 :radix 16)
                                 (subseq line (1+ p2))))
+                  ; KLUDGE CLH 2010-05-31: on darwin, nm gives us
+                  ;; _function but dlsym expects us to look up
+                  ;; function, without the leading _ . Therefore, we
+                  ;; strip it off here.
+                  #!+(and darwin (not dlshim))
+                  (when (equal (char name 0) #\_)
+                    (setf name (subseq name 1)))
                   (multiple-value-bind (old-value found)
                       (gethash name *cold-foreign-symbol-table*)
                     (when (and found
index e6fffb9..c62c343 100644 (file)
@@ -9,9 +9,23 @@
 # provided with absolutely no warranty. See the COPYING and CREDITS
 # files for more information.
 
-CFLAGS = -g -Wall -O2 -fdollars-in-identifiers -mmacosx-version-min=10.4
+CFLAGS = -g -Wall -O2 -fdollars-in-identifiers
+ifdef LISP_FEATURE_DARWIN9_OR_BETTER
+CFLAGS += -mmacosx-version-min=10.5
+LINKFLAGS += -mmacosx-version-min=10.5
+else
+CFLAGS += -mmacosx-version-min=10.4
 LINKFLAGS += -mmacosx-version-min=10.4
-OS_SRC = bsd-os.c x86-64-bsd-os.c darwin-os.c x86-64-darwin-os.c darwin-dlshim.c darwin-langinfo.c
+endif
+ifdef LISP_FEATURE_INODE64
+CFLAGS += -D_DARWIN_USE_64_BIT_INODE
+endif
+
+OS_SRC = bsd-os.c x86-64-bsd-os.c darwin-os.c x86-64-darwin-os.c darwin-langinfo.c
+ifdef LISP_FEATURE_DLSHIM
+  OS_SRC += darwin-dlshim.c
+endif
+
 OS_LIBS = -lSystem -lc -ldl
 ifdef LISP_FEATURE_SB_THREAD
   OS_LIBS += -lpthread
diff --git a/src/runtime/Config.x86-64-darwin9+ b/src/runtime/Config.x86-64-darwin9+
deleted file mode 100644 (file)
index 3da837d..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- makefile -*- for the C-level run-time support for SBCL
-
-# This software is part of the SBCL system. See the README file for
-# more information.
-#
-# This software is derived from the CMU CL system, which was
-# written at Carnegie Mellon University and released into the
-# public domain. The software is in the public domain and is
-# provided with absolutely no warranty. See the COPYING and CREDITS
-# files for more information.
-
-CFLAGS = -g -Wall -O2 -fdollars-in-identifiers -mmacosx-version-min=10.5 -D_DARWIN_USE_64_BIT_INODE
-LINKFLAGS += -mmacosx-version-min=10.5
-OS_SRC = bsd-os.c x86-64-bsd-os.c darwin-os.c x86-64-darwin-os.c darwin-dlshim.c darwin-langinfo.c
-OS_LIBS = -lSystem -lc -ldl
-ifdef LISP_FEATURE_SB_THREAD
-  OS_LIBS += -lpthread
-endif
-
-ASSEM_SRC = x86-64-assem.S ldso-stubs.S
-ARCH_SRC = x86-64-arch.c
-
-LINKFLAGS += -arch x86_64 -dynamic -twolevel_namespace -bind_at_load -pagezero_size 0x100000
-
-CFLAGS += -arch x86_64 -fno-omit-frame-pointer -pagezero_size 0x100000
-
-GC_SRC = gencgc.c
-
-# Nothing to do for after-grovel-headers.
-.PHONY: after-grovel-headers
-after-grovel-headers:
index ff19612..b05880e 100644 (file)
@@ -9,9 +9,21 @@
 # provided with absolutely no warranty. See the COPYING and CREDITS
 # files for more information.
 
-CFLAGS = -arch i386 -g -Wall -O2 -fdollars-in-identifiers -mmacosx-version-min=10.4
-LINKFLAGS += -arch i386 -mmacosx-version-min=10.4
-OS_SRC = bsd-os.c x86-bsd-os.c darwin-os.c x86-darwin-os.c darwin-dlshim.c darwin-langinfo.c
+CFLAGS = -arch i386 -g -Wall -O2 -fdollars-in-identifiers
+LINKFLAGS += -arch i386
+ifdef LISP_FEATURE_DARWIN9_OR_BETTER
+CFLAGS += -mmacosx-version-min=10.5
+LINKFLAGS += -mmacosx-version-min=10.5
+else
+CFLAGS += -mmacosx-version-min=10.4
+LINKFLAGS += -mmacosx-version-min=10.4
+endif
+
+OS_SRC = bsd-os.c x86-bsd-os.c darwin-os.c x86-darwin-os.c darwin-langinfo.c
+ifdef LISP_FEATURE_DLSHIM
+  OS_SRC += darwin-dlshim.c
+endif
+
 OS_LIBS = -lSystem -lc -ldl
 ifdef LISP_FEATURE_SB_THREAD
   OS_LIBS += -lpthread
index 95de326..7bfc735 100644 (file)
 #include "bsd-os.h"
 #include <errno.h>
 
+#ifndef LISP_FEATURE_DLSHIM
+#include <dlfcn.h>
+#endif
+
 char *
 os_get_runtime_executable_path(int external)
 {
index 6c42bd1..2058cad 100644 (file)
@@ -18,6 +18,8 @@
  * more information.
  */
 
+#include "genesis/config.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/types.h>
   #include <sys/wait.h>
   #include <sys/ioctl.h>
   #include <sys/termios.h>
-  #ifdef __APPLE_CC__
-    #include "../src/runtime/darwin-dlshim.h"
+  #ifdef LISP_FEATURE_DARWIN
     #include "../src/runtime/darwin-langinfo.h"
+  #endif
+  #ifdef LISP_FEATURE_DLSHIM
+    #include "../src/runtime/darwin-dlshim.h"
   #else
     #include <dlfcn.h>
-    #include <langinfo.h>
   #endif
 #endif
 
@@ -49,8 +52,6 @@
 #include <signal.h>
 #include <errno.h>
 
-#include "genesis/config.h"
-
 #ifdef LISP_FEATURE_HPUX
 #include <sys/bsdtty.h> /* for TIOCGPGRP */
 #endif
index bbb7e9e..bff22d8 100644 (file)
@@ -133,8 +133,8 @@ ldso_stub__ ## fct ## $lazy_ptr:                @\\
 #define LDSO_STUBIFY(fct)                       \\
 .text                           ;               \\
         .align 4 ;                              \\
-.globl _ldso_stub___ ## fct ;                    \\
-_ldso_stub___ ## fct: ;                          \\
+.globl _ldso_stub__ ## fct ;                    \\
+_ldso_stub__ ## fct: ;                          \\
         jmp L ## fct ## $stub ;                 \\
         .section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5 ;   \\
 L ## fct ## $stub: ;                    \\
@@ -150,8 +150,8 @@ L ## fct ## $stub: ;                    \\
 #!+(and darwin x86-64) "
 #define LDSO_STUBIFY(fct)                       \\
         .align 4 ;                              \\
-.globl _ldso_stub___ ## fct ;                    \\
-_ldso_stub___ ## fct: ;                          \\
+.globl _ldso_stub__ ## fct ;                    \\
+_ldso_stub__ ## fct: ;                          \\
         jmp _ ## fct ;                          \\
 .L ## fct ## e1: ;                            "
 
@@ -324,7 +324,7 @@ ldso_stub__ ## fct: ;                  \\
                    "unlockpt")
                  #!+openbsd
                  '("openpty")
-                 #!-darwin
+                 #!-dlshim
                  '("dlclose"
                    "dlerror"
                    "dlopen"
index 2fdd2ce..a24e0fc 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".)
-"1.0.39.2"
+"1.0.39.3"