summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2009-04-22 12:29:32 -0700
committerRoland McGrath <roland@redhat.com>2009-04-22 12:29:32 -0700
commitc65558baa0382d59398234c5a05debdc5a98eb1b (patch)
tree47fd7d57fce8ddc0fe7919533ec6475475d9ecd5
parentcc480475458dabde78051d697ec38af6813f131b (diff)
downloadelfutils-c65558baa0382d59398234c5a05debdc5a98eb1b.tar.gz
Fix relocation when symbols are resolved in non-ET_REL modules.
-rw-r--r--libdwfl/ChangeLog3
-rw-r--r--libdwfl/relocate.c8
2 files changed, 10 insertions, 1 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 86a08e93..f0b0a284 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,5 +1,8 @@
2009-04-22 Roland McGrath <roland@redhat.com>
+ * relocate.c (resolve_symbol): Apply correct bias to st_value found in
+ a non-ET_REL module.
+
* dwfl_module_build_id.c (__libdwfl_find_build_id): Fix last change to
adjust properly for non-ET_REL.
diff --git a/libdwfl/relocate.c b/libdwfl/relocate.c
index b236ca50..2c0f3010 100644
--- a/libdwfl/relocate.c
+++ b/libdwfl/relocate.c
@@ -267,9 +267,15 @@ resolve_symbol (Dwfl_Module *referer, struct reloc_symtab_cache *symtab,
continue;
/* We found it! */
- if (shndx == SHN_ABS)
+ if (shndx == SHN_ABS) /* XXX maybe should apply bias? */
return DWFL_E_NOERROR;
+ if (m->e_type != ET_REL)
+ {
+ sym->st_value += m->symfile->bias;
+ return DWFL_E_NOERROR;
+ }
+
/* In an ET_REL file, the symbol table values are relative
to the section, not to the module's load base. */
size_t symshstrndx = SHN_UNDEF;