diff options
author | Thomas Tuegel <ttuegel@gmail.com> | 2014-09-11 21:07:09 (GMT) |
---|---|---|
committer | Thomas Tuegel <ttuegel@gmail.com> | 2014-09-12 20:24:15 (GMT) |
commit | 45fc82678d89f3912fe70047b00ac23c5449e266 (patch) | |
tree | 998c1c9428289e83c34e9a8498370bc69f5e1767 /src/patchelf.cc | |
parent | bf4b579d636ea8437cc763a1aa203d2a5764a037 (diff) | |
download | patchelf-45fc82678d89f3912fe70047b00ac23c5449e266.zip patchelf-45fc82678d89f3912fe70047b00ac23c5449e266.tar.gz patchelf-45fc82678d89f3912fe70047b00ac23c5449e266.tar.bz2 |
Allow DT_REL without .rel.dyn or .rel.got
Some DT_REL files are missing both .rel.dyn and .rel.got. This doesn't
seem to be an error, so it shouldn't be treated as such.
Diffstat (limited to 'src/patchelf.cc')
-rw-r--r-- | src/patchelf.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc index 731b9ad..1d0c9a7 100644 --- a/src/patchelf.cc +++ b/src/patchelf.cc @@ -840,11 +840,18 @@ void ElfFile<ElfFileParamNames>::rewriteHeaders(Elf_Addr phdrAddress) /* no idea if this makes sense, but it was needed for some program */ if (!shdr) shdr = findSection2(".rel.got"); - if (!shdr) error("cannot find .rel.dyn or .rel.got"); + /* some programs have neither section, but this doesn't seem + to be a problem */ + if (!shdr) continue; + dyn->d_un.d_ptr = shdr->sh_addr; + } + else if (d_tag == DT_RELA) { + Elf_Shdr * shdr = findSection2(".rela.dyn"); + /* some programs lack this section, but it doesn't seem to + be a problem */ + if (!shdr) continue; dyn->d_un.d_ptr = shdr->sh_addr; } - else if (d_tag == DT_RELA) - dyn->d_un.d_ptr = findSection(".rela.dyn").sh_addr; /* PPC Linux */ else if (d_tag == DT_VERNEED) dyn->d_un.d_ptr = findSection(".gnu.version_r").sh_addr; else if (d_tag == DT_VERSYM) |