about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-10-19 21:41:30 -0400
committerRich Felker <dalias@aerifal.cx>2012-10-19 21:41:30 -0400
commitdeb15b3cf23cb6093f439f7b37eaeb1263df5399 (patch)
treeddb246ecea8edc2bd3e9a6e305a1d7d2933db38f
parentdde325d7b3ff6332dc0c24e29f8827b1b16bdd92 (diff)
downloadmusl-deb15b3cf23cb6093f439f7b37eaeb1263df5399.tar.gz
musl-deb15b3cf23cb6093f439f7b37eaeb1263df5399.tar.xz
musl-deb15b3cf23cb6093f439f7b37eaeb1263df5399.zip
fix breakage in dlsym for looking up RTLD_DEFAULT, etc.
this was broken during the early dynamic-linked TLS commits, which
rearranged some of the code for handling new relocation types.
-rw-r--r--src/ldso/dynlink.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
index 2ec8fb8c..39a27608 100644
--- a/src/ldso/dynlink.c
+++ b/src/ldso/dynlink.c
@@ -1080,11 +1080,14 @@ static void *do_dlsym(struct dso *p, const char *s, void *ra)
 	uint32_t h = 0, gh = 0;
 	Sym *sym;
 	if (p == head || p == RTLD_DEFAULT || p == RTLD_NEXT) {
-		if (p == RTLD_NEXT) {
+		if (p == RTLD_DEFAULT) {
+			p = head;
+		} else 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;
 		}
-		struct symdef def = find_sym(p->next, s, 0);
+		struct symdef def = find_sym(p, s, 0);
 		if (!def.sym) goto failed;
 		return def.dso->base + def.sym->st_value;
 	}