]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Accept SHN_COMMON relocations
authorPetr Machata <pmachata@redhat.com>
Wed, 18 Feb 2009 16:06:27 +0000 (17:06 +0100)
committerPetr Machata <pmachata@redhat.com>
Wed, 18 Feb 2009 16:06:27 +0000 (17:06 +0100)
src/dwarflint.c

index 5019ae5f36ba2015f79af1553bc30b5d9f4a40cf..06be1f4d52d8a786165586407bb0811321b50eea 100644 (file)
@@ -2455,6 +2455,9 @@ relocate_one (struct relocation_data *reloc, GElf_Rela *rela,
 
       *value = rela->r_addend + symbol->st_value;
       uint64_t section_index = symbol->st_shndx;
+      /* XXX We should handle SHN_XINDEX here.  Or, instead, maybe it
+        would be possible to use dwfl, which already does XINDEX
+        translation.  */
 
       /* It's target value, not section offset.  */
       if (offset_into == rel_value
@@ -2465,14 +2468,16 @@ relocate_one (struct relocation_data *reloc, GElf_Rela *rela,
             SHN_UNDEF.  For data forms of address_size, an SHN_UNDEF
             reloc is acceptable, otherwise reject it.  */
          if (!(section_index == SHN_ABS
-               || (offset_into == rel_address && section_index == SHN_UNDEF)))
+               || (offset_into == rel_address
+                   && (section_index == SHN_UNDEF
+                       || section_index == SHN_COMMON))))
            {
              Elf_Scn *scn;
              GElf_Shdr shdr_mem, *shdr;
              if (offset_into != rel_address && section_index == SHN_UNDEF)
                wr_error (&reloc_where,
-                           ": relocation of an address is formed against SHN_UNDEF section"
-                           " (index %" PRId64 ").\n", section_index);
+                           ": relocation of an address is formed against SHN_UNDEF symbol"
+                           " (symtab index %d).\n", symndx);
              else if ((scn = elf_getscn (reloc->file->dwarf->elf,
                                          section_index)) == NULL)
                wr_error (&reloc_where,