]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Always report relocation errors with offset
authorPetr Machata <pmachata@redhat.com>
Thu, 19 Feb 2009 15:06:13 +0000 (16:06 +0100)
committerPetr Machata <pmachata@redhat.com>
Thu, 19 Feb 2009 15:06:13 +0000 (16:06 +0100)
* ... after we can actually read it, that is.

src/dwarflint.c

index 3b6ef009f6f41e1d2d2e1f232abf343d23dea289..be844c3bd4aa8c2afd0f0be3e2599d5cee423450 100644 (file)
@@ -403,7 +403,6 @@ struct relocation
                           ignored.  Necessary so that we don't
                           double-report invalid & missing
                           relocation.  */
-  size_t index;                /* Original index (before sorting).  */
 };
 
 struct relocation_data
@@ -2259,7 +2258,7 @@ where_from_reloc (struct relocation_data *reloc, struct where *ref)
 {
   struct where where
     = WHERE (reloc->type == SHT_REL ? sec_rel : sec_rela, NULL);
-  where_reset_1 (&where, reloc->index);
+  where_reset_1 (&where, reloc->rel[reloc->index].offset);
   where.ref = ref;
   return where;
 }
@@ -4267,11 +4266,9 @@ read_rel (struct section_data *secdata, Elf_Data *reldata, bool elf_64)
       where_reset_1 (&where, i);
 
       REALLOC (&secdata->rel, rel);
-      struct relocation *cur = secdata->rel.rel + secdata->rel.size;
+      struct relocation *cur = secdata->rel.rel + secdata->rel.size++;
       memset (cur, 0, sizeof (*cur));
 
-      cur->index = secdata->rel.size++;
-
       GElf_Rela rela_mem, *rela
        = get_rel_or_rela (reldata, i, &rela_mem, secdata->rel.type);
       if (rela == NULL)