From 457d297922eaabddcda27517d34a90e18708e326 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Fri, 21 Jan 2022 23:17:12 -0800 Subject: [PATCH] fix incorrect polarity on dyn_offset; closes #364 --- src/patchelf.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/patchelf.cc b/src/patchelf.cc index e824cbf9..b2552f70 100644 --- a/src/patchelf.cc +++ b/src/patchelf.cc @@ -1021,7 +1021,7 @@ void ElfFile::rewriteHeaders(Elf_Addr phdrAddress) if (shdr) { auto rld_map_addr = findSectionHeader(".rld_map").sh_addr; auto dyn_offset = ((char*)dyn) - ((char*)dyn_table); - dyn->d_un.d_ptr = rld_map_addr + dyn_offset - (*shdrDynamic).get().sh_addr; + dyn->d_un.d_ptr = rld_map_addr - dyn_offset - (*shdrDynamic).get().sh_addr; } else { /* ELF file with DT_MIPS_RLD_MAP_REL but without .rld_map is broken, and it's not our job to fix it; yet, we have