18 lines
963 B
Diff
18 lines
963 B
Diff
diff --git a/src/patchelf.cc b/src/patchelf.cc
|
|
index 35a5dc1..a133d2e 100644
|
|
--- a/src/patchelf.cc
|
|
+++ b/src/patchelf.cc
|
|
@@ -1201,9 +1201,10 @@ void ElfFile<ElfFileParamNames>::rewriteHeaders(Elf_Addr phdrAddress)
|
|
dyn->d_un.d_val = findSectionHeader(".dynstr").sh_size;
|
|
else if (d_tag == DT_SYMTAB)
|
|
dyn->d_un.d_ptr = findSectionHeader(".dynsym").sh_addr;
|
|
- else if (d_tag == DT_HASH)
|
|
- dyn->d_un.d_ptr = findSectionHeader(".hash").sh_addr;
|
|
- else if (d_tag == DT_GNU_HASH) {
|
|
+ else if (d_tag == DT_HASH) {
|
|
+ auto shdr = tryFindSectionHeader(".hash");
|
|
+ if (shdr) dyn->d_un.d_ptr = (*shdr).get().sh_addr;
|
|
+ } else if (d_tag == DT_GNU_HASH) {
|
|
auto shdr = tryFindSectionHeader(".gnu.hash");
|
|
// some binaries might this section stripped
|
|
// in which case we just ignore the value.
|