]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
cosmetic
authorRoland McGrath <roland@redhat.com>
Thu, 22 May 2008 20:28:05 +0000 (20:28 +0000)
committerRoland McGrath <roland@redhat.com>
Thu, 22 May 2008 20:28:05 +0000 (20:28 +0000)
libdwfl/ChangeLog
libdwfl/dwfl_module_getdwarf.c

index 2a8166db4c1597613408c2d02856fabf31113b9d..38f6be73a3393edead1cb0f681996757135efe94 100644 (file)
@@ -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
index bc20d94f4ed1b18078316f54756f17a17e3252bd..f5ee314b0d4d4403cc3d4cc870dc40deb26c8181 100644 (file)
@@ -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;