diff options
author | Roland McGrath <roland@redhat.com> | 2009-02-12 17:26:39 -0800 |
---|---|---|
committer | Roland McGrath <roland@redhat.com> | 2009-02-12 17:26:39 -0800 |
commit | 31fd654b5127ab0249a8bd7576e08f451fcab6af (patch) | |
tree | 6a5660e652eda24046a261dd3f4ff8523c519b5a /libdwfl/dwfl_module_build_id.c | |
parent | fe31538fba8ced52263b28fe9e6b826a4e376013 (diff) | |
download | elfutils-31fd654b5127ab0249a8bd7576e08f451fcab6af.tar.gz |
Fix build_id vaddr calculation for ET_REL modules.
Diffstat (limited to 'libdwfl/dwfl_module_build_id.c')
-rw-r--r-- | libdwfl/dwfl_module_build_id.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libdwfl/dwfl_module_build_id.c b/libdwfl/dwfl_module_build_id.c index d1e0eb05..5d196a9d 100644 --- a/libdwfl/dwfl_module_build_id.c +++ b/libdwfl/dwfl_module_build_id.c @@ -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); |