Package: euslisp / 9.27+dfsg-7

use-rtld-global-loadelf.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Description: Use RTLD_GLOBAL so that other dynamic libary can find library symbols.
  For example, this fix enable compiled lisp file to find symbol defined in libeusgeo.so
  $ cat intersection3-test.l
  (eval-when (load) (geo::line-intersection3 #f(0 0 -1) #f(0 0 1) #f(0 -1 0) #f(0 1 0) 0.001))
  $ EUSDIR=`pwd` ./Linux64/bin/eusg '(progn (compile-file "intersection3-test.l" :o "intersection3-test.o") (load "intersection3-test.so")(print *user*)(unix::exit))'

  c.f.) https://github.com/android/ndk/issues/201Index: euslisp/lisp/c/loadelf.c
 .
 euslisp (9.27-3) unstable; urgency=medium
 .

Author: Kei Okada <kei.okada@gmail.com>

---
Origin: other
Reviewed-By: Kei Okada <kei.okada@gmail.com>
Last-Update: 2020-05-15

===================================================================
--- euslisp.orig/lisp/c/loadelf.c
+++ euslisp/lisp/c/loadelf.c
@@ -160,7 +160,7 @@ pointer initnames;
   void *dlhandle;
   char namebuf[256];
 
-  dlhandle=dlopen(0,RTLD_LAZY);
+  dlhandle=dlopen(0,RTLD_LAZY|RTLD_GLOBAL);
   if (dlhandle==NULL) { 
     fprintf(stderr, "cannot dlopen self\n"); exit(2);}
   module_count=0;
@@ -386,7 +386,7 @@ pointer *argv;
     else entry=(char *)get_string(argv[1]);}
   else entry=NULL;
 
-  dlhandle=(eusinteger_t)dlopen(binfn, RTLD_LAZY);/* ???? */
+  dlhandle=(eusinteger_t)dlopen(binfn, RTLD_LAZY|RTLD_GLOBAL);/* ???? */
   if (dlhandle == 0) {
     fprintf(stderr,"BINLOAD cannot dlopen: %s\n", dlerror());
     return(NIL);}