92ff82a0d3
Closes: #7509 [via git-merge-pr]
30 lines
776 B
Diff
30 lines
776 B
Diff
--- overlay_gl/overlay.c
|
|
+++ overlay_gl/overlay.c
|
|
@@ -690,19 +690,24 @@ static void initializeLibrary() {
|
|
int nchains = 0;
|
|
ElfW(Sym) *symtab = NULL;
|
|
const char *strtab = NULL;
|
|
+#ifdef __GLIBC__
|
|
+ const ElfW(Addr) base = 0;
|
|
+#else
|
|
+ const ElfW(Addr) base = lm->l_addr;
|
|
+#endif
|
|
|
|
ElfW(Dyn) *dyn = lm->l_ld;
|
|
|
|
while (dyn->d_tag) {
|
|
switch (dyn->d_tag) {
|
|
case DT_HASH:
|
|
- nchains = *(int *)(dyn->d_un.d_ptr + 4);
|
|
+ nchains = *(int *)(base + dyn->d_un.d_ptr + 4);
|
|
break;
|
|
case DT_STRTAB:
|
|
- strtab = (const char *) dyn->d_un.d_ptr;
|
|
+ strtab = (const char *)(base + dyn->d_un.d_ptr);
|
|
break;
|
|
case DT_SYMTAB:
|
|
- symtab = (ElfW(Sym) *) dyn->d_un.d_ptr;
|
|
+ symtab = (ElfW(Sym) *)(base + dyn->d_un.d_ptr);
|
|
break;
|
|
}
|
|
dyn ++;
|