summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2021-09-11 18:08:20 +0200
committerJörg Thalheim <joerg@thalheim.io>2021-09-11 18:08:20 +0200
commit2ffa0ab49edae6f2434c2907059b70b1b4bfb5ca (patch)
tree39af3fcf955ddd5641412f2ac205a6fe017e08ac
parent57c3e7db502b0b5854df911d58cd34c5f5515233 (diff)
downloadpatchelf-plt-rela-fix.tar.gz
make updating .rel.plt section optionalplt-rela-fix
-rw-r--r--src/patchelf.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc
index 246496d..ef9ba2f 100644
--- a/src/patchelf.cc
+++ b/src/patchelf.cc
@@ -1149,7 +1149,10 @@ void ElfFile<ElfFileParamNames>::rewriteHeaders(Elf_Addr phdrAddress)
auto shdr = findSection2(".rel.plt");
if (!shdr) shdr = findSection2(".rela.plt"); /* 64-bit Linux, x86-64 */
if (!shdr) shdr = findSection2(".rela.IA_64.pltoff"); /* 64-bit Linux, IA-64 */
- if (!shdr) error("cannot find section corresponding to DT_JMPREL");
+ // there have been cases where this section was not present
+ // see https://github.com/NixOS/patchelf/pull/131
+ // It seems that sometimes binaries put this plt relocations in .rela.dyn instead
+ if (!shdr) continue;
dyn->d_un.d_ptr = shdr->sh_addr;
}
else if (d_tag == DT_REL) { /* !!! hack! */