summaryrefslogtreecommitdiff
path: root/src/ldso/dynlink.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-07-07 16:32:27 -0400
committerRich Felker <dalias@aerifal.cx>2012-07-07 16:32:27 -0400
commitd93e028c6bbd491592313fc77e056f6424ea4668 (patch)
tree5d9ccc113061da9dc431cf67613d35099546f562 /src/ldso/dynlink.c
parent920baab81f98a3cae3436361cdd044afe21fe347 (diff)
downloadmusl-d93e028c6bbd491592313fc77e056f6424ea4668.tar.gz
fix dlsym RTLD_NEXT support
previously this was being handled the same as a library-specific, dependency-order lookup on the next library in the global chain, which is likely to be utterly meaningless. instead the lookup needs to be in the global namespace, but omitting the initial portion of the global library chain up through the calling library.
Diffstat (limited to 'src/ldso/dynlink.c')
-rw-r--r--src/ldso/dynlink.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
index 55c2bbe4..263593ab 100644
--- a/src/ldso/dynlink.c
+++ b/src/ldso/dynlink.c
@@ -766,7 +766,9 @@ static void *do_dlsym(struct dso *p, const char *s, void *ra)
if (p == RTLD_NEXT) {
for (p=head; p && (unsigned char *)ra-p->map>p->map_len; p=p->next);
if (!p) p=head;
- p=p->next;
+ void *res = find_sym(p->next, s, 0);
+ if (!res) goto failed;
+ return res;
}
if (p == head || p == RTLD_DEFAULT) {
void *res = find_sym(head, s, 0);