diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2010-04-21 09:10:08 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2010-04-21 09:10:08 -0700 |
commit | 5ef5272be985dfdeafa86077c306f6b64d334240 (patch) | |
tree | bad11901e83b227c7bac5e773ad6e06cf4eda089 /linker | |
parent | 95faecefdea0f55edafdba09052a904df7cd2405 (diff) | |
parent | 1698d9ebfc7e27271852a1fdf305a2ac37b3ebe4 (diff) | |
download | bionic-5ef5272be985dfdeafa86077c306f6b64d334240.zip bionic-5ef5272be985dfdeafa86077c306f6b64d334240.tar.gz bionic-5ef5272be985dfdeafa86077c306f6b64d334240.tar.bz2 |
merge from open-source master
Change-Id: I518bb4ae9d7269957365561d4d609f22cde519db
Diffstat (limited to 'linker')
-rw-r--r-- | linker/dlfcn.c | 10 | ||||
-rw-r--r-- | linker/linker.c | 8 | ||||
-rw-r--r-- | linker/linker.h | 2 |
3 files changed, 15 insertions, 5 deletions
diff --git a/linker/dlfcn.c b/linker/dlfcn.c index 10ecb13..a36b42c 100644 --- a/linker/dlfcn.c +++ b/linker/dlfcn.c @@ -91,9 +91,15 @@ void *dlsym(void *handle, const char *symbol) } if(handle == RTLD_DEFAULT) { - sym = lookup(symbol, &found); + sym = lookup(symbol, &found, NULL); } else if(handle == RTLD_NEXT) { - sym = lookup(symbol, &found); + void *ret_addr = __builtin_return_address(0); + soinfo *si = find_containing_library(ret_addr); + + sym = NULL; + if(si && si->next) { + sym = lookup(symbol, &found, si->next); + } } else { found = (soinfo*)handle; sym = lookup_in_library(found, symbol); diff --git a/linker/linker.c b/linker/linker.c index 6719b12..a1f4fff 100644 --- a/linker/linker.c +++ b/linker/linker.c @@ -509,13 +509,17 @@ Elf32_Sym *lookup_in_library(soinfo *si, const char *name) /* This is used by dl_sym(). It performs a global symbol lookup. */ -Elf32_Sym *lookup(const char *name, soinfo **found) +Elf32_Sym *lookup(const char *name, soinfo **found, soinfo *start) { unsigned elf_hash = elfhash(name); Elf32_Sym *s = NULL; soinfo *si; - for(si = solist; (s == NULL) && (si != NULL); si = si->next) + if(start == NULL) { + start = solist; + } + + for(si = start; (s == NULL) && (si != NULL); si = si->next) { if(si->flags & FLAG_ERROR) continue; diff --git a/linker/linker.h b/linker/linker.h index 8cd56b0..68ac275 100644 --- a/linker/linker.h +++ b/linker/linker.h @@ -224,7 +224,7 @@ extern soinfo libdl_info; soinfo *find_library(const char *name); unsigned unload_library(soinfo *si); Elf32_Sym *lookup_in_library(soinfo *si, const char *name); -Elf32_Sym *lookup(const char *name, soinfo **found); +Elf32_Sym *lookup(const char *name, soinfo **found, soinfo *start); soinfo *find_containing_library(void *addr); Elf32_Sym *find_containing_symbol(void *addr, soinfo *si); const char *linker_get_error(void); |