From: Roland McGrath Date: Thu, 22 May 2008 20:28:05 +0000 (+0000) Subject: cosmetic X-Git-Tag: elfutils-0.136~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d2f3ee2554185a9df70f434eddc4405a4aff0fa;p=thirdparty%2Felfutils.git cosmetic --- diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 2a8166db4..38f6be73a 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,7 @@ +2008-05-22 Petr Machata + + * dwfl_module_getdwarf.c (open_elf): Bias of ET_EXEC files is always 0. + 2008-05-06 Roland McGrath * 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 bc20d94f4..f5ee314b0 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;