1.0.15.3: Have PROBE-FILE return NIL whenever a truename can't be found.
[sbcl.git] / tools-for-build / ldso-stubs.lisp
index 6d33c02..45d2425 100644 (file)
@@ -57,7 +57,7 @@ ldso_stub__~A: ;                                \\
 #endif
         .text"
 
-#!+(or x86 x86-64) "
+#!+(and (or x86 x86-64) (not darwin)) "
 #define LDSO_STUBIFY(fct)                       \\
         .align 16 ;                             \\
 .globl ldso_stub__ ## fct ;                     \\
@@ -85,7 +85,7 @@ ldso_stub__ ## fct: ;                           \\
 .L ## fct ## e1: ;                              \\
         .size    ldso_stub__ ## fct,.L ## fct ## e1-ldso_stub__ ## fct ;"
 
-#!+(and linux ppc) "
+#!+(and (not darwin) ppc) "
 #define LDSO_STUBIFY(fct)                       \\
 .globl ldso_stub__ ## fct ;                     \\
         .type    ldso_stub__ ## fct,@function ; \\
@@ -97,8 +97,8 @@ ldso_stub__ ## fct: ;                           \\
 #!+(and darwin ppc) "
 #define LDSO_STUBIFY(fct)                       @\\
 .text                                           @\\
-.globl  ldso_stub___ ## fct                     @\\
-ldso_stub___ ## fct:                            @\\
+.globl  _ldso_stub___ ## fct                     @\\
+_ldso_stub___ ## fct:                            @\\
         b ldso_stub__ ## fct ## stub            @\\
 .symbol_stub ldso_stub__ ## fct ## stub:        @\\
 .indirect_symbol _ ## fct                       @\\
@@ -112,6 +112,33 @@ ldso_stub__ ## fct ## $lazy_ptr:                @\\
         .indirect_symbol _ ## fct               @\\
         .long dyld_stub_binding_helper"
 
+;;; darwin x86 assembler is weird and follows the ppc assembler syntax
+#!+(and darwin x86) "
+#define LDSO_STUBIFY(fct)                       \\
+.text                           ;               \\
+        .align 4 ;                              \\
+.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: ;                    \\
+        .indirect_symbol _ ## fct ;     \\
+        hlt                       ;     \\
+        hlt                       ;     \\
+        hlt                       ;     \\
+        hlt                       ;     \\
+        hlt                       ;     \\
+        .subsections_via_symbols  ;    "
+
+;;; darwin x86-64
+#!+(and darwin x86-64) "
+#define LDSO_STUBIFY(fct)                       \\
+        .align 4 ;                              \\
+.globl _ldso_stub___ ## fct ;                    \\
+_ldso_stub___ ## fct: ;                          \\
+        jmp _ ## fct ;                          \\
+.L ## fct ## e1: ;                            "
+
 ;;; KLUDGE: set up the vital fifth argument, passed on the
 ;;; stack.  Do this unconditionally, even if the stub is for a
 ;;; function with few arguments: it can't hurt.  We only do this for
@@ -219,6 +246,7 @@ ldso_stub__ ## fct: ;                  \\
                    "read"
                    "readdir"
                    "readlink"
+                   "realpath"
                    "recv"
                    "rename"
                    "rmdir"
@@ -267,6 +295,16 @@ ldso_stub__ ## fct: ;                  \\
                  #!+alpha
                  '("ieee_get_fp_control"
                    "ieee_set_fp_control")
+                 ;; FIXME: After 1.0 this should be made
+                 ;; #!-linkage-table, as we only need these stubs if
+                 ;; we don't have linkage-table. Done this way now to
+                 ;; cut down on the number of ports affected.
+                 #!-(or win32 darwin freebsd netbsd openbsd)
+                 '("ptsname"
+                   "grantpt"
+                   "unlockpt")
+                 #!+openbsd
+                 '("openpty")
                  #!-darwin
                  '("dlclose"
                    "dlerror"
@@ -274,7 +312,7 @@ ldso_stub__ ## fct: ;                  \\
                    "dlsym")
                  #!+os-provides-dladdr
                  '("dladdr")
-                 #!-(and sparc sunos) ;; !defined(SVR4)
+                 #!-sunos ;; !defined(SVR4)
                  '("sigsetmask")))
 
 (with-open-file (f "src/runtime/ldso-stubs.S" :direction :output :if-exists :supersede)