diff options
author | Jari Vetoniemi <mailroxas@gmail.com> | 2018-04-19 18:28:29 +0300 |
---|---|---|
committer | Jari Vetoniemi <mailroxas@gmail.com> | 2018-04-19 18:28:29 +0300 |
commit | 0dc63f8fa9be289a196c03e4ee668ff9f891c483 (patch) | |
tree | 1bfa07d0881f39f5f9133348c6255d5aaf8bf825 /src/linker | |
parent | a94bbe0645d9c8cfb0a3ff11fa0d39f98420eb89 (diff) |
linker: Use dladdr1 to get symbol info
Casting symbol is wrong.
Diffstat (limited to 'src/linker')
-rw-r--r-- | src/linker/linker.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/linker/linker.c b/src/linker/linker.c index 25b1b3d..b5b782d 100644 --- a/src/linker/linker.c +++ b/src/linker/linker.c @@ -1384,9 +1384,10 @@ static int apkenv_reloc_library(soinfo *si, Elf32_Rel *rel, unsigned count) } if(sym_addr != 0) { - if(ELF32_ST_TYPE(((Elf32_Sym*)(intptr_t)sym_addr)->st_info) == STT_FUNC) { + Dl_info info; + ElfW(Sym) *extra; + if (dladdr1((void*)sym_addr, &info, (void**) &extra, RTLD_DL_SYMENT) && extra && ELF32_ST_TYPE(extra->st_info) == STT_FUNC) sym_addr = (unsigned)wrapper_create(sym_name, (void*)sym_addr); - } } else if(s == NULL) { /* We only allow an undefined symbol if this is a weak |