From c62607b9006c23b2f21f1bc5b36b048ce93071ec Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Thu, 1 Sep 2022 16:43:19 +0100 Subject: [PATCH] aarch64: morello: add D_PTR_RW Writable version of D_PTR, required for updating GOT[1] and GOT[2]. --- sysdeps/aarch64/ldsodefs.h | 4 ++++ sysdeps/aarch64/morello/dl-machine.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sysdeps/aarch64/ldsodefs.h b/sysdeps/aarch64/ldsodefs.h index b0b23df93cd..e86c7e1e0e5 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 11e026302ca..0f681b19255 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 = dl_rx_ptr (l, got[1]); -- 2.47.2