about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2017-07-04 11:34:39 -0400
committerRich Felker <dalias@aerifal.cx>2017-07-04 11:34:39 -0400
commit43c423af5b8453afde86e4ba81e0fcc663ae7c22 (patch)
treed146722cc0decbf820dda69e651c0bf0b0cf0283
parent66b53cfa8876342f7e7d7907d30c719c38cd5a1b (diff)
downloadmusl-43c423af5b8453afde86e4ba81e0fcc663ae7c22.tar.gz
musl-43c423af5b8453afde86e4ba81e0fcc663ae7c22.tar.xz
musl-43c423af5b8453afde86e4ba81e0fcc663ae7c22.zip
fix regression in dlopen promotion from RTLD_LOCAL to RTLD_GLOBAL
commit 4ff234f6cba96403b5de6d29d48a59fd73252040 inadvertently removed
the logic to do this when changing the representation of global
status.
-rw-r--r--ldso/dynlink.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ldso/dynlink.c b/ldso/dynlink.c
index 239007ff..fc6a68b8 100644
--- a/ldso/dynlink.c
+++ b/ldso/dynlink.c
@@ -1771,7 +1771,8 @@ void *dlopen(const char *file, int mode)
 	}
 
 	/* First load handling */
-	if (!p->deps) {
+	int first_load = !p->deps;
+	if (first_load) {
 		load_deps(p);
 		if (!p->relocated && (mode & RTLD_LAZY)) {
 			prepare_lazy(p);
@@ -1779,11 +1780,15 @@ void *dlopen(const char *file, int mode)
 				if (!p->deps[i]->relocated)
 					prepare_lazy(p->deps[i]);
 		}
+	}
+	if (first_load || (mode & RTLD_GLOBAL)) {
 		/* Make new symbols global, at least temporarily, so we can do
 		 * relocations. If not RTLD_GLOBAL, this is reverted below. */
 		add_syms(p);
 		for (i=0; p->deps[i]; i++)
 			add_syms(p->deps[i]);
+	}
+	if (first_load) {
 		reloc_all(p);
 	}