summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2022-06-18 21:49:14 -0700
committerAdam Joseph <adam@westernsemico.com>2022-06-18 21:51:19 -0700
commit820da7be8d1e1a49c4831dcb3800ed3b9f11e8a6 (patch)
treef189ff82d6ee4b043771f5732c2743e9b872a5ed /src
parent8db45c6a0c1a4dbbd492ac7fb59c1bca9460fe3e (diff)
downloadpatchelf-820da7be8d1e1a49c4831dcb3800ed3b9f11e8a6.tar.gz
patchelf.cc: handle DT_MIPS_XHASH and .MIPS.xhash
glibc changed their ABI in commit 23c1c256ae7b0f010d0fcaff60682b620887b164 on 2019-Aug-29, by changing the structure of the .gnu.hash data on MIPS and moving it to a different section. We need to adapt to this change by glibc. Closes #368
Diffstat (limited to 'src')
-rw-r--r--src/patchelf.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc
index 6882b28..0858513 100644
--- a/src/patchelf.cc
+++ b/src/patchelf.cc
@@ -990,6 +990,10 @@ void ElfFile<ElfFileParamNames>::rewriteHeaders(Elf_Addr phdrAddress)
// some binaries might this section stripped
// in which case we just ignore the value.
if (shdr) dyn->d_un.d_ptr = (*shdr).get().sh_addr;
+ } else if (d_tag == DT_MIPS_XHASH) {
+ // the .MIPS.xhash section was added to the glibc-ABI
+ // in commit 23c1c256ae7b0f010d0fcaff60682b620887b164
+ dyn->d_un.d_ptr = findSectionHeader(".MIPS.xhash").sh_addr;
} else if (d_tag == DT_JMPREL) {
auto shdr = tryFindSectionHeader(".rel.plt");
if (!shdr) shdr = tryFindSectionHeader(".rela.plt");