summaryrefslogtreecommitdiff
path: root/src/linker
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2018-02-19 11:58:46 +0200
committerJari Vetoniemi <mailroxas@gmail.com>2018-02-19 12:00:41 +0200
commit460e0a5ce04a256a24a6aff2da86ebe9027acf23 (patch)
tree3a08c501995040abb0b1ccfe224e86b2ba2a19f2 /src/linker
parenta89cf8d62048b8fd0eec101e2dadfe8710ce1bce (diff)
linker: add some hacks until rewrite
Diffstat (limited to 'src/linker')
-rw-r--r--src/linker/linker.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/linker/linker.c b/src/linker/linker.c
index 6b7a2bc..09ebf8f 100644
--- a/src/linker/linker.c
+++ b/src/linker/linker.c
@@ -415,7 +415,6 @@ _Unwind_Ptr apkenv_android_dl_unwind_find_exidx(_Unwind_Ptr pc, int *pcount)
{
soinfo *si;
unsigned addr = (unsigned)pc;
-
for (si = apkenv_solist; si != 0; si = si->next){
if ((addr >= si->base) && (addr < (si->base + si->size))) {
*pcount = si->ARM_exidx_count;
@@ -435,14 +434,12 @@ apkenv_android_dl_iterate_phdr(int (*cb)(struct dl_phdr_info *info, size_t size,
soinfo *si;
struct dl_phdr_info dl_info;
int rv = 0;
-
for (si = apkenv_solist; si != NULL; si = si->next) {
dl_info.dlpi_addr = si->linkmap.l_addr;
dl_info.dlpi_name = si->linkmap.l_name;
dl_info.dlpi_phdr = (void*)si->phdr;
dl_info.dlpi_phnum = si->phnum;
- rv = cb(&dl_info, sizeof (struct dl_phdr_info), data);
- if (rv != 0)
+ if ((rv = cb(&dl_info, sizeof (struct dl_phdr_info), data)) != 0)
break;
}
return rv;
@@ -1427,7 +1424,11 @@ static int apkenv_reloc_library(soinfo *si, Elf32_Rel *rel, unsigned count)
sym_name = (char *)(strtab + symtab[sym].st_name);
memcpy(wrap_sym_name + 7, sym_name, MIN(sizeof(wrap_sym_name) - 7, strlen(sym_name)));
sym_addr = 0;
- if ((sym_addr = dlsym(RTLD_DEFAULT, wrap_sym_name))) {
+
+ if (!strcmp(sym_name, "dl_iterate_phdr")) {
+ // FIXME: hack, move to libc.so
+ sym_addr = apkenv_android_dl_iterate_phdr;
+ } else if ((sym_addr = dlsym(RTLD_DEFAULT, wrap_sym_name))) {
LINKER_DEBUG_PRINTF("%s hooked symbol %s to %x\n", si->name, wrap_sym_name, sym_addr);
} else if ((sym_addr = dlsym(RTLD_DEFAULT, sym_name))) {
LINKER_DEBUG_PRINTF("%s hooked symbol %s to %x\n", si->name, sym_name, sym_addr);