libdwfl: Handle SHN_COMMON symbols in ET_REL.
authorRoland McGrath <roland@redhat.com>
Wed, 6 Jan 2010 12:22:40 +0000 (04:22 -0800)
committerRoland McGrath <roland@redhat.com>
Wed, 6 Jan 2010 12:22:40 +0000 (04:22 -0800)
libdwfl/ChangeLog
libdwfl/relocate.c

index 2cac0de..f669825 100644 (file)
@@ -1,3 +1,8 @@
+2010-01-06  Roland McGrath  <roland@redhat.com>
+
+       * relocate.c (relocate_getsym): For SHN_COMMON, zero st_value.
+       (relocate_section): Let unresolved SHN_COMMON symbol stay 0.
+
 2009-11-16  Roland McGrath  <roland@redhat.com>
 
        * relocate.c (relocate_section): Skip SHT_NOBITS or empty target scn.
index 2e37c64..121a481 100644 (file)
@@ -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;
          }