aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl/0053-fix-regression-in-dlopen-promotion-from-RTLD_LOCAL-t.patch
blob: b5ba7cc87d9d382a741d3aaa2038a32b8be02385 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From 43c423af5b8453afde86e4ba81e0fcc663ae7c22 Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Tue, 4 Jul 2017 11:34:39 -0400
Subject: [PATCH 53/53] 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.
---
 ldso/dynlink.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

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);
 	}
 
-- 
2.13.1