summaryrefslogtreecommitdiff
path: root/src/linker
diff options
context:
space:
mode:
Diffstat (limited to 'src/linker')
-rw-r--r--src/linker/dlfcn.c9
-rw-r--r--src/linker/linker.c2
2 files changed, 10 insertions, 1 deletions
diff --git a/src/linker/dlfcn.c b/src/linker/dlfcn.c
index b8d2914..5fb6899 100644
--- a/src/linker/dlfcn.c
+++ b/src/linker/dlfcn.c
@@ -22,6 +22,7 @@
#include "linker_format.h"
#include "wrapper/wrapper.h"
+#include "wrapper/verbose.h"
#include "linker_debug.h"
#ifdef APKENV_DEBUG
@@ -63,8 +64,8 @@ static void set_dlerror(int err)
void *bionic_dlopen(const char *filename, int flag)
{
+ verbose("%s (%d)", filename, flag);
soinfo *ret;
-
pthread_mutex_lock(&apkenv_dl_lock);
ret = apkenv_find_library(filename);
@@ -93,16 +94,20 @@ enum {
void *bionic_dlsym(void *handle, const char *symbol)
{
+ verbose("%p, %s", handle, symbol);
+
soinfo *found;
Elf32_Sym *sym;
unsigned bind;
pthread_mutex_lock(&apkenv_dl_lock);
+#if 0
if(unlikely(handle == 0)) {
set_dlerror(DL_ERR_INVALID_LIBRARY_HANDLE);
goto err;
}
+#endif
if(unlikely(symbol == 0)) {
set_dlerror(DL_ERR_BAD_SYMBOL_NAME);
goto err;
@@ -113,9 +118,11 @@ void *bionic_dlsym(void *handle, const char *symbol)
memcpy(wrap_sym_name + 7, symbol, MIN(sizeof(wrap_sym_name) - 7, strlen(symbol)));
if ((sym = dlsym(RTLD_DEFAULT, wrap_sym_name))) {
pthread_mutex_unlock(&apkenv_dl_lock);
+ verbose("found bionic_ version");
return wrapper_create(symbol, sym);
} else if ((sym = dlsym(RTLD_DEFAULT, symbol))) {
pthread_mutex_unlock(&apkenv_dl_lock);
+ verbose("found system version");
return wrapper_create(symbol, sym);
}
}
diff --git a/src/linker/linker.c b/src/linker/linker.c
index 0927164..e72b9aa 100644
--- a/src/linker/linker.c
+++ b/src/linker/linker.c
@@ -1372,6 +1372,8 @@ static int apkenv_reloc_library(soinfo *si, Elf32_Rel *rel, unsigned count)
if ((sym_addr = (intptr_t)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 = (intptr_t)dlsym(RTLD_DEFAULT, sym_name))) {
+ if (strstr(sym_name, "pthread_"))
+ fprintf(stderr, "symbol may need to be wrapped: %s\n", sym_name);
LINKER_DEBUG_PRINTF("%s hooked symbol %s to %x\n", si->name, sym_name, sym_addr);
}
#if 0