X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fforeign-load.lisp;h=95a9ecf93532b84f2a936a7713dc0ba7edf298db;hb=69ef68ba7393e3492c1b4a756d1140f71c2922bc;hp=694fc27712b878192ced2d88aa2aeaa71fc4f366;hpb=079ef9dad558ca07cb8178ef428bf738112174fa;p=sbcl.git diff --git a/src/code/foreign-load.lisp b/src/code/foreign-load.lisp index 694fc27..95a9ecf 100644 --- a/src/code/foreign-load.lisp +++ b/src/code/foreign-load.lisp @@ -145,14 +145,17 @@ SB-EXT:SAVE-LISP-AND-DIE for details." (dlerror) ; clear old errors (unless *runtime-dlhandle* (bug "Cannot resolve foreign symbol: lost *runtime-dlhandle*")) - (let* ((result (sap-int (dlsym *runtime-dlhandle* symbol))) + ;; On real ELF & dlsym platforms the EXTERN-ALIEN-NAME is a no-op, + ;; but on platforms where dlsym is simulated we use the mangled name. + (let* ((extern (extern-alien-name symbol)) + (result (sap-int (dlsym *runtime-dlhandle* extern))) (err (dlerror)) (addr (if (or (not (zerop result)) (not err)) result (dolist (obj *shared-objects*) (let ((sap (shared-object-sap obj))) (when sap - (setf result (sap-int (dlsym sap symbol)) + (setf result (sap-int (dlsym sap extern)) err (dlerror)) (when (or (not (zerop result)) (not err)) (return result)))))))) @@ -163,7 +166,7 @@ SB-EXT:SAVE-LISP-AND-DIE for details." (if datap undefined-alien-address (foreign-symbol-address-as-integer - (sb!vm:extern-alien-name "undefined_alien_function")))) + "undefined_alien_function"))) (addr (pushnew symbol symbols :test #'equal) (remove symbol undefineds :test #'equal)