summaryrefslogtreecommitdiffstats
path: root/src/patchelf.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-02-17 12:38:12 (GMT)
committerEelco Dolstra <edolstra@gmail.com>2017-02-17 12:38:12 (GMT)
commitc1f89c077e44a495c62ed0dcfaeca21510df93ef (patch)
treec4607e69908a09aff4a17d698ec6cc09291fe922 /src/patchelf.cc
parent49ce42d53cf71bbc86cba4b4a88ae9c4f3ea8979 (diff)
downloadpatchelf-c1f89c077e44a495c62ed0dcfaeca21510df93ef.zip
patchelf-c1f89c077e44a495c62ed0dcfaeca21510df93ef.tar.gz
patchelf-c1f89c077e44a495c62ed0dcfaeca21510df93ef.tar.bz2
Don't check whether DT_STRTAB matches .dynstr
We don't really care whether DT_STRTAB is correct, since we overwrite it anyway. https://github.com/NixOS/nixpkgs/issues/22333
Diffstat (limited to 'src/patchelf.cc')
-rw-r--r--src/patchelf.cc25
1 files changed, 2 insertions, 23 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc
index 619d403..5077cd5 100644
--- a/src/patchelf.cc
+++ b/src/patchelf.cc
@@ -1016,20 +1016,8 @@ void ElfFile<ElfFileParamNames>::modifySoname(sonameMode op, const std::string &
Elf_Shdr & shdrDynStr = findSection(".dynstr");
char * strTab = (char *) contents + rdi(shdrDynStr.sh_offset);
- /* Find the DT_STRTAB entry in the dynamic section. */
- Elf_Dyn * dyn = (Elf_Dyn *) (contents + rdi(shdrDynamic.sh_offset));
- Elf_Addr strTabAddr = 0;
- for ( ; rdi(dyn->d_tag) != DT_NULL; dyn++)
- if (rdi(dyn->d_tag) == DT_STRTAB)
- strTabAddr = rdi(dyn->d_un.d_ptr);
- if (!strTabAddr) error("strange: no string table");
-
- /* We assume that the virtual address in the DT_STRTAB entry
- of the dynamic section corresponds to the .dynstr section. */
- assert(strTabAddr == rdi(shdrDynStr.sh_addr));
-
/* Walk through the dynamic section, look for the DT_SONAME entry. */
- dyn = (Elf_Dyn *) (contents + rdi(shdrDynamic.sh_offset));
+ Elf_Dyn * dyn = (Elf_Dyn *) (contents + rdi(shdrDynamic.sh_offset));
Elf_Dyn * dynSoname = 0;
char * soname = 0;
for ( ; rdi(dyn->d_tag) != DT_NULL; dyn++) {
@@ -1123,15 +1111,6 @@ void ElfFile<ElfFileParamNames>::modifyRPath(RPathOp op,
Elf_Shdr & shdrDynStr = findSection(".dynstr");
char * strTab = (char *) contents + rdi(shdrDynStr.sh_offset);
- /* Find the DT_STRTAB entry in the dynamic section. */
- Elf_Dyn * dyn = (Elf_Dyn *) (contents + rdi(shdrDynamic.sh_offset));
- Elf_Addr strTabAddr = 0;
- for ( ; rdi(dyn->d_tag) != DT_NULL; dyn++)
- if (rdi(dyn->d_tag) == DT_STRTAB) strTabAddr = rdi(dyn->d_un.d_ptr);
- if (!strTabAddr) error("strange: no string table");
-
- assert(strTabAddr == rdi(shdrDynStr.sh_addr));
-
/* Walk through the dynamic section, look for the RPATH/RUNPATH
entry.
@@ -1146,7 +1125,7 @@ void ElfFile<ElfFileParamNames>::modifyRPath(RPathOp op,
generates a DT_RPATH and DT_RUNPATH pointing at the same
string. */
std::vector<std::string> neededLibs;
- dyn = (Elf_Dyn *) (contents + rdi(shdrDynamic.sh_offset));
+ Elf_Dyn * dyn = (Elf_Dyn *) (contents + rdi(shdrDynamic.sh_offset));
Elf_Dyn * dynRPath = 0, * dynRunPath = 0;
char * rpath = 0;
for ( ; rdi(dyn->d_tag) != DT_NULL; dyn++) {