From c900cdd57bacc0ddda527ef3796e09c62d5efdda Mon Sep 17 00:00:00 2001 From: rtoy <rtoy> Date: Tue, 16 Sep 2008 19:26:36 +0000 Subject: [PATCH] o Only use one version of LOOKUP-SPECIAL-SYMBOL for all architectures, and only pass in the name, not the link-type, since there's only one link-type for the special symbols. o Always call INIT-FOREIGN-SYMBOL-TABLE to initialize the symbol table. (This only clears the hash-table.) o Clean up the section in LOOKUP-FOREIGN-SYMBOL for linkage-tables for sparc and ppc. Use backend-featurep to test for this, and don't lump it into the #-irix test case. This helps cross-compile do the right thing for sparc/ppc when doing a non-native cross-compile. --- compiler/generic/new-genesis.lisp | 40 +++++++++++++------------------ 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/compiler/generic/new-genesis.lisp b/compiler/generic/new-genesis.lisp index 10df7dda7..7d3749036 100644 --- a/compiler/generic/new-genesis.lisp +++ b/compiler/generic/new-genesis.lisp @@ -4,7 +4,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/generic/new-genesis.lisp,v 1.83 2008/09/13 02:26:03 rtoy Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/generic/new-genesis.lisp,v 1.84 2008/09/16 19:26:36 rtoy Exp $") ;;; ;;; ********************************************************************** ;;; @@ -962,16 +962,10 @@ ;; running lisp. Why? Because new C code may have moved these ;; addresses so we need to use the right values. We get worldbuild ;; issues if we use the old values that don't match. -#-(and linkage-table (or sparc ppc)) (defun lookup-special-symbol (name) - (lookup-foreign-symbol (vm::extern-alien-name name) - #+(or sparc ppc) :data)) - -#+(and linkage-table (or sparc ppc)) -(defun lookup-special-symbol (name &optional (link-type :code)) (or (gethash name *cold-foreign-symbol-table* nil) (lookup-foreign-symbol (vm::extern-alien-name name) - link-type))) + #+(or sparc ppc) :data))) (defun cold-fdefinition-object (name &optional leave-fn-raw) (let ((hash (extract-fdefn-name name))) @@ -987,8 +981,7 @@ (write-indexed fdefn vm:fdefn-function-slot *nil-descriptor*) (write-indexed fdefn vm:fdefn-raw-addr-slot (make-random-descriptor - (lookup-special-symbol "undefined_tramp" - #+(or sparc ppc) :data)))) + (lookup-special-symbol "undefined_tramp")))) fdefn)))) (defun cold-fset (name defn) @@ -1006,8 +999,7 @@ (ash vm:function-code-offset vm:word-shift))))) (#.vm:closure-header-type (make-random-descriptor - (lookup-special-symbol "closure_tramp" - #+(or sparc ppc) :data))))) + (lookup-special-symbol "closure_tramp"))))) fdefn)) (defun initialize-static-fns () @@ -2050,15 +2042,9 @@ ((and #+linkage-table nil (c:backend-featurep :darwin) (lookup-sym (concatenate 'string "ldso_stub__" name)))) - ;; Non-linux case - (#-irix - (lookup-sym name) - #+irix - (let ((value (lookup-sym name))) - (when (and (numberp value) (zerop value)) - (warn "Not-really-defined foreign symbol: ~S" name)) - value) - #+(and linkage-table (or sparc ppc)) + ((and (c::backend-featurep :linkage-table) + (or (c::backend-featurep :sparc) + (c::backend-featurep :ppc))) (let ((address (lookup-sym name))) ;; If the link-type is :data, need to lookup and return the ;; value, not the address of NAME in the linkage table. @@ -2070,7 +2056,16 @@ ;; routines. (if (eq link-type :code) address - (sys:sap-ref-32 (sys:int-sap address) 0)))) + (sys:sap-ref-32 (sys:int-sap address) 0)))) + ;; Non-linux case + (#-irix + (lookup-sym name) + #+irix + (let ((value (lookup-sym name))) + (when (and (numberp value) (zerop value)) + (warn "Not-really-defined foreign symbol: ~S" name)) + value) + ) ;; Are those still necessary? ((and linux-p (lookup-sym (concatenate 'string "__libc_" name)))) ((and linux-p (lookup-sym (concatenate 'string "__" name)))) @@ -2620,7 +2615,6 @@ (progn (clrhash *fdefn-objects*) (clrhash *cold-symbols*) - #+(and linkage-table (or sparc ppc)) (init-foreign-symbol-table) #+linkage-table (init-foreign-linkage) (let ((version #-linkage-table (load-foreign-symbol-table -- GitLab