summaryrefslogtreecommitdiffstats
path: root/libdwfl/dwfl_module_getdwarf.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2008-05-22 20:28:05 +0000
committerRoland McGrath <roland@redhat.com>2008-05-22 20:28:05 +0000
commit9d2f3ee2554185a9df70f434eddc4405a4aff0fa (patch)
treeb823f1cd2a57d94cc9335cd685ea9c05068c298e /libdwfl/dwfl_module_getdwarf.c
parent939de9472a00e2519e8c266a870d14bf8ede252b (diff)
downloadandroid_external_elfutils-9d2f3ee2554185a9df70f434eddc4405a4aff0fa.tar.gz
android_external_elfutils-9d2f3ee2554185a9df70f434eddc4405a4aff0fa.tar.bz2
android_external_elfutils-9d2f3ee2554185a9df70f434eddc4405a4aff0fa.zip
cosmetic
Diffstat (limited to 'libdwfl/dwfl_module_getdwarf.c')
-rw-r--r--libdwfl/dwfl_module_getdwarf.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c
index bc20d94f..f5ee314b 100644
--- a/libdwfl/dwfl_module_getdwarf.c
+++ b/libdwfl/dwfl_module_getdwarf.c
@@ -81,20 +81,25 @@ open_elf (Dwfl_Module *mod, struct dwfl_file *file)
return DWFL_E_LIBELF;
}
+ /* The addresses in an ET_EXEC file are absolute. The lowest p_vaddr of
+ the main file can differ from that of the debug file due to prelink.
+ But that doesn't not change addresses that symbols, debuginfo, or
+ sh_addr of any program sections refer to. */
file->bias = 0;
- for (uint_fast16_t i = 0; i < ehdr->e_phnum; ++i)
- {
- GElf_Phdr ph_mem;
- GElf_Phdr *ph = gelf_getphdr (file->elf, i, &ph_mem);
- if (ph == NULL)
- goto elf_error;
- if (ph->p_type == PT_LOAD)
- {
- file->bias = ((mod->low_addr & -ph->p_align)
- - (ph->p_vaddr & -ph->p_align));
- break;
- }
- }
+ if (mod->e_type != ET_EXEC)
+ for (uint_fast16_t i = 0; i < ehdr->e_phnum; ++i)
+ {
+ GElf_Phdr ph_mem;
+ GElf_Phdr *ph = gelf_getphdr (file->elf, i, &ph_mem);
+ if (ph == NULL)
+ goto elf_error;
+ if (ph->p_type == PT_LOAD)
+ {
+ file->bias = ((mod->low_addr & -ph->p_align)
+ - (ph->p_vaddr & -ph->p_align));
+ break;
+ }
+ }
mod->e_type = ehdr->e_type;