mirror of
https://github.com/NixOS/patchelf.git
synced 2025-10-24 03:12:49 +08:00
* Support executables without a .dynamic section (klcc generates
'em).
This commit is contained in:
@@ -736,9 +736,11 @@ void ElfFile<ElfFileParamNames>::rewriteHeaders(Elf_Addr phdrAddress)
|
||||
|
||||
|
||||
/* Update all those nasty virtual addresses in the .dynamic
|
||||
section. */
|
||||
Elf_Shdr & shdrDynamic = findSection(".dynamic");
|
||||
Elf_Dyn * dyn = (Elf_Dyn *) (contents + rdi(shdrDynamic.sh_offset));
|
||||
section. Note that not all executables have .dynamic sections
|
||||
(e.g., those produced by klibc's klcc). */
|
||||
Elf_Shdr * shdrDynamic = findSection2(".dynamic");
|
||||
if (shdrDynamic) {
|
||||
Elf_Dyn * dyn = (Elf_Dyn *) (contents + rdi(shdrDynamic->sh_offset));
|
||||
unsigned int d_tag;
|
||||
for ( ; (d_tag = rdi(dyn->d_tag)) != DT_NULL; dyn++)
|
||||
if (d_tag == DT_STRTAB)
|
||||
@@ -770,6 +772,7 @@ void ElfFile<ElfFileParamNames>::rewriteHeaders(Elf_Addr phdrAddress)
|
||||
else if (d_tag == DT_VERSYM)
|
||||
dyn->d_un.d_ptr = findSection(".gnu.version").sh_addr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user