[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sbcl-commits
Subject:    [Sbcl-commits] master: Fix undefined-function error not working on #-sb-dynamic-core.
From:       "stassats" <stassats () users ! sourceforge ! net>
Date:       2014-03-22 14:40:21
Message-ID: E1WRN62-0005J3-7q () sfs-ml-3 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]

The branch "master" has been updated in SBCL:
       via  f9d967d12e6183f7c0f7d2ef6272c039a28f647d (commit)
      from  6c3ae0c21e7045684a295e6f12307b3eca030025 (commit)

- Log -----------------------------------------------------------------
commit f9d967d12e6183f7c0f7d2ef6272c039a28f647d
Author: Stas Boukarev <stassats@gmail.com>
Date:   Sat Mar 22 18:29:40 2014 +0400

    Fix undefined-function error not working on #-sb-dynamic-core.
    
    When compiled with clang on FreeBSD the code which looks for
    undefined_tramp's location goes through dlsym, but clang doesn't
    export runtime symbols by default.
    Go through dlsym only when sb-dynamic-core is actually enabled.
---
 src/code/debug-int.lisp      |   33 +++++++++++++++------------------
 src/code/foreign-load.lisp   |    5 ++---
 src/runtime/Config.x86-win32 |    2 +-
 3 files changed, 18 insertions(+), 22 deletions(-)

diff --git a/src/code/debug-int.lisp b/src/code/debug-int.lisp
index 26f8635..38ce709 100644
--- a/src/code/debug-int.lisp
+++ b/src/code/debug-int.lisp
@@ -848,21 +848,18 @@
                           #!+alpha (* 2 n)))
                       (* os-context-t)))
 
-;;;; Perform the lookup which FOREIGN-SYMBOL-ADDRESS would do if the
-;;;; linkage table were disabled, i.e. always return the actual symbol
-;;;; address, not the linkage table trampoline, even if the symbol would
-;;;; ordinarily go through the linkage table.  Important when
-;;;; SB-DYNAMIC-CORE is enabled and our caller assumes `name' to be a
-;;;; "static" symbol; a concept which doesn't exist in such builds.
-(defun true-foreign-symbol-address (name)
-  #!+linkage-table  ;we have dlsym -- let's use it.
+;;; On SB-DYNAMIC-CORE symbols which come from the runtime go through
+;;; an indirection table, but the debugger needs to know the actual
+;;; address.
+(defun static-foreign-symbol-address (name)
+  #!+sb-dynamic-core
   (find-dynamic-foreign-symbol-address name)
-  #!-linkage-table  ;possibly no dlsym, but hence no indirection anyway.
-  (foreign-symbol-address))
+  #!-sb-dynamic-core
+  (foreign-symbol-address name))
 
 ;;;; See above.
-(defun true-foreign-symbol-sap (name)
-  (int-sap (true-foreign-symbol-address name)))
+(defun static-foreign-symbol-sap (name)
+  (int-sap (static-foreign-symbol-address name)))
 
 #!+(or x86 x86-64)
 (defun find-escaped-frame (frame-pointer)
@@ -886,10 +883,10 @@
               ;; KLUDGE: Detect undefined functions by a range-check
               ;; against the trampoline address and the following
               ;; function in the runtime.
-              (if (< (true-foreign-symbol-address "undefined_tramp")
+              (if (< (static-foreign-symbol-address "undefined_tramp")
                      (sap-int (sb!vm:context-pc context))
-                     (true-foreign-symbol-address #!+x86 "closure_tramp"
-                                                    #!+x86-64 "alloc_tramp"))
+                     (static-foreign-symbol-address #!+x86 "closure_tramp"
+                                                  #!+x86-64 "alloc_tramp"))
                   (return (values :undefined-function 0 context))
                   (return (values code 0 context))))
             (let* ((code-header-len (* (get-header-data code)
@@ -3219,9 +3216,9 @@ register."
   (without-gcing
    ;; These are really code labels, not variables: but this way we get
    ;; their addresses.
-   (let* ((src-start (true-foreign-symbol-sap "fun_end_breakpoint_guts"))
-          (src-end (true-foreign-symbol-sap "fun_end_breakpoint_end"))
-          (trap-loc (true-foreign-symbol-sap "fun_end_breakpoint_trap"))
+   (let* ((src-start (static-foreign-symbol-sap "fun_end_breakpoint_guts"))
+          (src-end (static-foreign-symbol-sap "fun_end_breakpoint_end"))
+          (trap-loc (static-foreign-symbol-sap "fun_end_breakpoint_trap"))
           (length (sap- src-end src-start))
           (code-object
            (sb!c:allocate-code-object (1+ bogus-lra-constants) length))
diff --git a/src/code/foreign-load.lisp b/src/code/foreign-load.lisp
index de6bbd4..422a989 100644
--- a/src/code/foreign-load.lisp
+++ b/src/code/foreign-load.lisp
@@ -25,9 +25,8 @@
   "~S is unsupported as of SBCL 0.8.13. Please use LOAD-SHARED-OBJECT."
   (load-1-foreign))
 
-(progn
-  (define-alien-variable undefined-alien-address unsigned)
-  (defvar *runtime-dlhandle*))
+(define-alien-variable undefined-alien-address unsigned)
+(defvar *runtime-dlhandle*)
 
 (defvar *shared-objects*)
 
diff --git a/src/runtime/Config.x86-win32 b/src/runtime/Config.x86-win32
index a6d2714..cbc9001 100644
--- a/src/runtime/Config.x86-win32
+++ b/src/runtime/Config.x86-win32
@@ -47,7 +47,7 @@ LD = ld
 NM = nm
 
 ifneq ($(findstring cygwin,$(shell $(CC) -dumpmachine)),)
-OS_LINK_FLAGS := $(OS_LINK_FLAGS) -Wl,-mno-cygwin
+LINK_FLAGS := $(LINK_FLAGS) -Wl,-mno-cygwin
 OS_LIBS := $(OS_LIBS) -mno-cygwin
 CFLAGS := $(CFLAGS) -mno-cygwin
 endif

-----------------------------------------------------------------------


hooks/post-receive
-- 
SBCL

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Sbcl-commits mailing list
Sbcl-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic