Skip to content

Commit 4ab10ee

Browse files
committed
keep dlopen(0, RTLD_LAZY)(sysem library) handle to handle and handle2 for #elif defined(ARM) && defined(__ARM_ARCH_7A__) /* not (defined(x86_64) || defined(aarch64)) */
1 parent 2ab4310 commit 4ab10ee

4 files changed

Lines changed: 26 additions & 5 deletions

File tree

lisp/c/eus.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -776,11 +776,15 @@ static void initclasses()
776776
/* 16 ---new for Solaris */
777777
LDMODULE=basicclass("LOAD-MODULE",C_CODE, &ldmodulecp,
778778
#if ARM // ARM uses entry2 in struct ldmodule in eus.h
779-
4,"ENTRY2",
779+
5,"ENTRY2",
780780
#else
781781
3,
782782
#endif
783-
"SYMBOL-TABLE","OBJECT-FILE", "HANDLE");
783+
"SYMBOL-TABLE","OBJECT-FILE", "HANDLE"
784+
#if ARM
785+
,"HANDLE2"
786+
#endif
787+
);
784788
C_LDMOD=speval(LDMODULE);
785789
/*17*/
786790
LABREF=basicclass("LABEL-REFERENCE",C_OBJECT,&labrefcp,4,
@@ -971,7 +975,11 @@ static void initfeatures()
971975
/*system function module*/
972976
sysmod=makemodule(ctx,0);
973977
sysmod->c.ldmod.codevec=makeint(0);
974-
sysmod->c.ldmod.handle=makeint((eusinteger_t)dlopen(0, RTLD_LAZY)>>2);
978+
void *handle = dlopen(0, RTLD_LAZY);
979+
sysmod->c.ldmod.handle=makeint((eusinteger_t)handle>>2);
980+
#if ARM
981+
sysmod->c.ldmod.handle2=makeint((eusinteger_t)handle&0x0000ffff);
982+
#endif
975983
sysobj=cons(ctx,sysmod, sysobj);
976984
}
977985

lisp/c/eus.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,11 @@ struct ldmodule { /*foreign language object module*/
256256
#endif
257257
pointer symtab;
258258
pointer objname;
259-
pointer handle;}; /* dl's handle */
259+
pointer handle;
260+
#if ARM
261+
pointer handle2; /* some archtecture did not set code on 4 byte alignment */
262+
#endif
263+
};
260264

261265
struct closure {
262266
pointer codevec;

lisp/c/makes.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,9 @@ int size;
501501
mod->c.ldmod.symtab=NIL;
502502
mod->c.ldmod.objname=NIL;
503503
mod->c.ldmod.handle=NIL;
504+
#if ARM
505+
mod->c.ldmod.handle2=NIL;
506+
#endif
504507
return(mod);}
505508

506509
pointer makeclosure(code,quote,f,e0,e1,e2)

lisp/xwindow/xforeign.c.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,13 @@ char *xentry;
433433
dlhandle=(eusinteger_t)dlopen("libX11.dylib", RTLD_LAZY);
434434
entry=(eusinteger_t)dlsym((void *)dlhandle, xentry);
435435
#else
436-
entry=(eusinteger_t)dlsym((void *)((eusinteger_t)(sysmod->c.ldmod.handle) & ~3), xentry);
436+
eusinteger_t dlhandle = (eusinteger_t)(sysmod->c.ldmod.handle) & ~3;
437+
#if ARM
438+
if ( sysmod->c.ldmod.handle2 != NIL ) {
439+
dlhandle = (dlhandle & 0xffff0000) | (intval(sysmod->c.ldmod.handle2) & 0x0000ffff);
440+
}
441+
#endif
442+
entry=(eusinteger_t)dlsym((void *)(dlhandle), xentry);
437443
#endif
438444
if (entry){
439445
xsym=intern(ctx,lname, len-1, xpkg);

0 commit comments

Comments
 (0)