summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>2010-01-06 04:22:40 -0800
committerRoland McGrath <[email protected]>2010-01-06 04:22:40 -0800
commit1d7cbd1af5e964aeeaad448fa21ae784c01dc31a (patch)
treeb01ed080a46edbfb51b3783473a0af6a7d300761
parent0c16c58610276858702c0db8b3bc8d332fb85656 (diff)
libdwfl: Handle SHN_COMMON symbols in ET_REL.
-rw-r--r--libdwfl/ChangeLog5
-rw-r--r--libdwfl/relocate.c6
2 files changed, 10 insertions, 1 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 2cac0dee..f6698255 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
+2010-01-06 Roland McGrath <[email protected]>
+
+ * relocate.c (relocate_getsym): For SHN_COMMON, zero st_value.
+ (relocate_section): Let unresolved SHN_COMMON symbol stay 0.
+
2009-11-16 Roland McGrath <[email protected]>
* relocate.c (relocate_section): Skip SHT_NOBITS or empty target scn.
diff --git a/libdwfl/relocate.c b/libdwfl/relocate.c
index 2e37c641..121a481b 100644
--- a/libdwfl/relocate.c
+++ b/libdwfl/relocate.c
@@ -191,7 +191,10 @@ relocate_getsym (Dwfl_Module *mod,
{
case SHN_ABS:
case SHN_UNDEF:
+ return DWFL_E_NOERROR;
+
case SHN_COMMON:
+ sym->st_value = 0; /* Value is size, not helpful. */
return DWFL_E_NOERROR;
}
@@ -350,7 +353,8 @@ relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr,
{
/* Maybe we can figure it out anyway. */
error = resolve_symbol (mod, reloc_symtab, &sym, shndx);
- if (error != DWFL_E_NOERROR)
+ if (error != DWFL_E_NOERROR
+ && !(error == DWFL_E_RELUNDEF && shndx == SHN_COMMON))
return error;
}