]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Fix build_id vaddr calculation for ET_REL modules.
authorRoland McGrath <roland@redhat.com>
Fri, 13 Feb 2009 01:26:39 +0000 (17:26 -0800)
committerRoland McGrath <roland@redhat.com>
Fri, 13 Feb 2009 01:26:39 +0000 (17:26 -0800)
libdwfl/ChangeLog
libdwfl/dwfl_module_build_id.c

index 11e12a35f8b8554d49ffdb76f4122be4716ebdf3..9633bb5d1a55f723a4ea85ea28b72987f6a437a9 100644 (file)
@@ -1,3 +1,8 @@
+2009-02-12  Roland McGrath  <roland@redhat.com>
+
+       * dwfl_module_build_id.c (__libdwfl_find_build_id): Use
+       __libdwfl_relocate_value to find correct sh_addr value.
+
 2009-02-10  Roland McGrath  <roland@redhat.com>
 
        * dwfl_report_elf.c (__libdwfl_report_elf): Take new arg SANITY.
index d1e0eb057c1050a9bc47977ef67e3fa2f6455ebf..5d196a9d91720f57cf637bc7a92530663067906a 100644 (file)
@@ -1,5 +1,5 @@
 /* Return build ID information for a module.
-   Copyright (C) 2007, 2008 Red Hat, Inc.
+   Copyright (C) 2007, 2008, 2009 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -130,9 +130,16 @@ __libdwfl_find_build_id (Dwfl_Module *mod, bool set, Elf *elf)
        GElf_Shdr shdr_mem;
        GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
        if (likely (shdr != NULL) && shdr->sh_type == SHT_NOTE)
-         result = check_notes (mod, set, elf_getdata (scn, NULL),
-                               (shdr->sh_flags & SHF_ALLOC)
-                               ? shdr->sh_addr + mod->main.bias : NO_VADDR);
+         {
+           /* Determine the right sh_addr in this module.  */
+           size_t shstrndx = SHN_UNDEF;
+           GElf_Addr vaddr = 0;
+           if (!(shdr->sh_flags & SHF_ALLOC)
+               || __libdwfl_relocate_value (mod, elf, &shstrndx,
+                                            elf_ndxscn (scn), &vaddr))
+             vaddr = NO_VADDR;
+           result = check_notes (mod, set, elf_getdata (scn, NULL), vaddr);
+         }
       }
     while (result == 0 && (scn = elf_nextscn (elf, scn)) != NULL);