diff options
author | Roland McGrath <roland@redhat.com> | 2008-05-22 20:28:05 +0000 |
---|---|---|
committer | Roland McGrath <roland@redhat.com> | 2008-05-22 20:28:05 +0000 |
commit | 9d2f3ee2554185a9df70f434eddc4405a4aff0fa (patch) | |
tree | b823f1cd2a57d94cc9335cd685ea9c05068c298e /libdwfl | |
parent | 939de9472a00e2519e8c266a870d14bf8ede252b (diff) | |
download | elfutils-9d2f3ee2554185a9df70f434eddc4405a4aff0fa.tar.gz |
cosmetic
Diffstat (limited to 'libdwfl')
-rw-r--r-- | libdwfl/ChangeLog | 4 | ||||
-rw-r--r-- | libdwfl/dwfl_module_getdwarf.c | 31 |
2 files changed, 22 insertions, 13 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 2a8166db..38f6be73 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,7 @@ +2008-05-22 Petr Machata <pmachata@redhat.com> + + * dwfl_module_getdwarf.c (open_elf): Bias of ET_EXEC files is always 0. + 2008-05-06 Roland McGrath <roland@frob.com> * linux-kernel-modules.c (dwfl_linux_kernel_report_offline): Use 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; |