From 1698d9ebfc7e27271852a1fdf305a2ac37b3ebe4 Mon Sep 17 00:00:00 2001 From: Matt Fischer Date: Thu, 31 Dec 2009 12:17:56 -0600 Subject: Fixed support for RTLD_NEXT in dlsym() The previous implementation of this flag was broken--it behaved identically to RTLD_DEFAULT. This adds a proper implementation, which examines the address of the calling function, and uses it to determine which library to use to begin the symbol search process. Change-Id: I2ad2b46363f68932af63a3828a22f9c7987eea67 --- linker/linker.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'linker/linker.c') diff --git a/linker/linker.c b/linker/linker.c index 87fb19b..451e96c 100644 --- a/linker/linker.c +++ b/linker/linker.c @@ -512,13 +512,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 = 0; 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; -- cgit v1.1