From: Will Newton <w...@linaro.org> Currently it is possible to have failures where package libgmp or package saved_pre_gcl is not found. The reason for this is that dlsym will return the address of a PLT entry in the executable if the executable has an undefined reference to that symbol.
This patch attempts to fix the problem in two ways. First, avoid dlopening the empty string as this returns a handle for the executable and starts the search there. Second, start the search in the next object in the list using RTLD_NEXT. --- gcl/lsp/gcl_dl.lsp | 4 ++-- gcl/o/cfun.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gcl/lsp/gcl_dl.lsp b/gcl/lsp/gcl_dl.lsp index 0c108cb..b8ae3b5 100644 --- a/gcl/lsp/gcl_dl.lsp +++ b/gcl/lsp/gcl_dl.lsp @@ -13,9 +13,9 @@ (dladdr-set adp ad) (dllist-push %memory sym adp))) -(defun mdlsym (str &optional (n "" np)) +(defun mdlsym (str &optional (n "")) (let* ((pk (or (find-package "LIB") (make-package "LIB"))) - (k (if np (dlopen n) 0)) + (k (if (string/= n "") (dlopen n) 0)) (ad (dlsym k str)) (p (or (pathname-name (dladdr ad)) "")) (psym (intern p pk)) diff --git a/gcl/o/cfun.c b/gcl/o/cfun.c index 593ee92..794ea81 100644 --- a/gcl/o/cfun.c +++ b/gcl/o/cfun.c @@ -88,7 +88,7 @@ DEFUN("DLSYM",object,fSdlsym,SI,2,2,NONE,OI,OO,OO,OO,(fixnum h,object name),"") RETURN1(make_fixnum((fixnum)ad)); } } - ad=dlsym(RTLD_DEFAULT,name->st.st_self); + ad=dlsym(RTLD_NEXT,name->st.st_self); if ((er=dlerror())) FEerror("dlsym lookup failure on ~s: ~s",2,name,make_simple_string(er)); name->st.st_self[name->st.st_fillp]=ch; -- 1.9.3 _______________________________________________ Gcl-devel mailing list Gcl-devel@gnu.org https://lists.gnu.org/mailman/listinfo/gcl-devel