about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2022-08-02 17:29:01 -0400
committerRich Felker <dalias@aerifal.cx>2022-08-02 17:29:01 -0400
commitbf99258564fd5b58974d93201ab61506eb8cb03e (patch)
tree27d43d16c37821b8cb840fd4e17500cdf4b83a5d
parentd32dadd60efb9d3b255351a3b532f8e4c3dd0db1 (diff)
downloadmusl-bf99258564fd5b58974d93201ab61506eb8cb03e.tar.gz
musl-bf99258564fd5b58974d93201ab61506eb8cb03e.tar.xz
musl-bf99258564fd5b58974d93201ab61506eb8cb03e.zip
ldso: process RELR only for non-FDPIC archs
the way RELR is applied is not a meaningful operation for FDPIC (there
is no single "base" address). it seems unlikely RELR would ever be
added for FDPIC, but if it ever is, the behavior and possibly data
format will need to be different, so guard against calling the
non-FDPIC code.
-rw-r--r--ldso/dynlink.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ldso/dynlink.c b/ldso/dynlink.c
index e92f03cb..fd09ca69 100644
--- a/ldso/dynlink.c
+++ b/ldso/dynlink.c
@@ -1375,7 +1375,8 @@ static void reloc_all(struct dso *p)
 			2+(dyn[DT_PLTREL]==DT_RELA));
 		do_relocs(p, laddr(p, dyn[DT_REL]), dyn[DT_RELSZ], 2);
 		do_relocs(p, laddr(p, dyn[DT_RELA]), dyn[DT_RELASZ], 3);
-		do_relr_relocs(p, laddr(p, dyn[DT_RELR]), dyn[DT_RELRSZ]);
+		if (!DL_FDPIC)
+			do_relr_relocs(p, laddr(p, dyn[DT_RELR]), dyn[DT_RELRSZ]);
 
 		if (head != &ldso && p->relro_start != p->relro_end) {
 			long ret = __syscall(SYS_mprotect, laddr(p, p->relro_start),