From df6243f5558b7fc83937b2c0be1109a01c741942 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 14 Jan 2014 13:23:07 +0100 Subject: In symbol tables, rewrite st_value for STT_SECTION entries --- src/patchelf.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/patchelf.cc b/src/patchelf.cc index a4591f1..2c6bec7 100644 --- a/src/patchelf.cc +++ b/src/patchelf.cc @@ -846,6 +846,10 @@ void ElfFile::rewriteHeaders(Elf_Addr phdrAddress) unsigned int newIndex = findSection3(section); // inefficient //debug("rewriting symbol %d: index = %d (%s) -> %d\n", entry, shndx, section.c_str(), newIndex); wri(sym->st_shndx, newIndex); + /* Rewrite st_value. FIXME: we should do this for all + types, but most don't actually change. */ + if (ELF32_ST_TYPE(rdi(sym->st_info)) == STT_SECTION) + wri(sym->st_value, rdi(shdrs[newIndex].sh_addr)); } } } -- cgit v0.12