Detect relocation of gnu_debugdata based on the .text section. am: ed721f5758
am: 5e000d7c5c
* commit '5e000d7c5ccd9f47ea9ed7ef8ce0bbbb3a28b116':
Detect relocation of gnu_debugdata based on the .text section.
diff --git a/src/elfxx.c b/src/elfxx.c
index 63986f0..7454778 100644
--- a/src/elfxx.c
+++ b/src/elfxx.c
@@ -590,9 +590,11 @@
mdi.mapped = true;
// The ELF file might have been relocated after the debug
// information has been compresses and embedded.
- Elf_W(Addr) ei_base_address = elf_w (get_min_vaddr_mapped) (ei);
- Elf_W(Addr) mdi_base_address = elf_w (get_min_vaddr_mapped) (&mdi);
- load_offset += ei_base_address - mdi_base_address;
+ ElfW(Addr) ei_text_address, mdi_text_address;
+ if (elf_w (find_section_mapped) (ei, ".text", NULL, NULL, &ei_text_address) &&
+ elf_w (find_section_mapped) (&mdi, ".text", NULL, NULL, &mdi_text_address)) {
+ load_offset += ei_text_address - mdi_text_address;
+ }
bool ret_val = elf_w (lookup_symbol) (as, ip, &mdi, load_offset, buf, buf_len, offp, &ehdr);
free(mdi.u.mapped.image);
return ret_val;