summaryrefslogtreecommitdiff
path: root/src/linker
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2018-04-19 18:29:09 +0300
committerJari Vetoniemi <mailroxas@gmail.com>2018-04-19 18:29:09 +0300
commita846dc40e4596fbf3d061392149a1676e7cdc304 (patch)
tree5076f8413f061d76e24cb20466455541227dc442 /src/linker
parent0dc63f8fa9be289a196c03e4ee668ff9f891c483 (diff)
wrapper/linker: __cxa_demangle from linker
We want to use android's libstdc++, so we need to pass __cxa_demangle from linker.
Diffstat (limited to 'src/linker')
-rw-r--r--src/linker/linker.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/linker/linker.c b/src/linker/linker.c
index b5b782d..f91316c 100644
--- a/src/linker/linker.c
+++ b/src/linker/linker.c
@@ -1271,10 +1271,16 @@ soinfo *apkenv_find_library(const char *name, const bool try_glibc)
}
TRACE("[ %5d '%s' has not been loaded yet. Locating...]\n", apkenv_pid, name);
- si = apkenv_load_library(name, try_glibc);
- if(si == NULL)
+ if (!(si = apkenv_load_library(name, try_glibc)) || !(si = apkenv_init_library(si)))
return NULL;
- return apkenv_init_library(si);
+
+ if (!strstr(bname, "libstdc++.so")) {
+ Elf32_Sym *sym = apkenv_lookup_in_library(si, "__cxa_demangle");
+ if (sym && ELF32_ST_BIND(sym->st_info) == STB_GLOBAL && sym->st_shndx != 0)
+ wrapper_set_cpp_demangler((void*)(intptr_t)(sym->st_value + si->base));
+ }
+
+ return si;
}
/* TODO: