about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2022-09-01 16:43:19 +0100
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2022-10-12 14:22:03 +0100
commita1d26f7b1d8d78588c6fd301515a07f92883b150 (patch)
tree9deace8be59b09f7634a3664dcea6a910b9653d5
parente6a2c4c4bbb922fd326e5085cd1f28d5265ade6d (diff)
downloadglibc-a1d26f7b1d8d78588c6fd301515a07f92883b150.tar.gz
glibc-a1d26f7b1d8d78588c6fd301515a07f92883b150.tar.xz
glibc-a1d26f7b1d8d78588c6fd301515a07f92883b150.zip
aarch64: morello: add D_PTR_RW
Writable version of D_PTR, required for updating GOT[1] and GOT[2].
-rw-r--r--sysdeps/aarch64/ldsodefs.h4
-rw-r--r--sysdeps/aarch64/morello/dl-machine.h2
2 files changed, 5 insertions, 1 deletions
diff --git a/sysdeps/aarch64/ldsodefs.h b/sysdeps/aarch64/ldsodefs.h
index b0b23df93c..e86c7e1e0e 100644
--- a/sysdeps/aarch64/ldsodefs.h
+++ b/sysdeps/aarch64/ldsodefs.h
@@ -25,6 +25,10 @@
 #ifdef __CHERI_PURE_CAPABILITY__
 # define DO_ELF_MACHINE_REL_RELATIVE(map, l_addr, relative) \
   elf_machine_rela_relative (map, relative)
+
+#define D_PTR_RW(map, i) \
+  (dl_relocate_ld (map) ? (map)->i->d_un.d_ptr \
+			: dl_rw_ptr ((map), (map)->i->d_un.d_ptr))
 #endif
 
 struct La_aarch64_regs;
diff --git a/sysdeps/aarch64/morello/dl-machine.h b/sysdeps/aarch64/morello/dl-machine.h
index 4eaffc2cf6..e6c69fc321 100644
--- a/sysdeps/aarch64/morello/dl-machine.h
+++ b/sysdeps/aarch64/morello/dl-machine.h
@@ -53,7 +53,7 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[],
       extern void _dl_runtime_resolve (ElfW(Word));
       extern void _dl_runtime_profile (ElfW(Word));
 
-      got = (uintptr_t *) D_PTR (l, l_info[DT_PLTGOT]);
+      got = (uintptr_t *) D_PTR_RW (l, l_info[DT_PLTGOT]);
       if (got[1])
 	{
 	  l->l_mach.plt = (uint64_t) got[1] + l->l_addr;