]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarflint: Be more descriptive about error in relocation type
authorPetr Machata <pmachata@redhat.com>
Thu, 12 Mar 2009 16:38:05 +0000 (17:38 +0100)
committerPetr Machata <pmachata@redhat.com>
Thu, 12 Mar 2009 16:38:05 +0000 (17:38 +0100)
src/dwarflint.c

index 45ab8dc884ef4937dd625d236c3a196677aef8ed..5ae3e19b553b84d64faf7d73b5a5d79c30a17c32 100644 (file)
@@ -4526,8 +4526,9 @@ check_loc_or_range_structural (struct section_data *data,
   return retval;
 }
 
-GElf_Rela *get_rel_or_rela (Elf_Data *data, int ndx,
-                           GElf_Rela *dst, size_t type)
+static GElf_Rela *
+get_rel_or_rela (Elf_Data *data, int ndx,
+                GElf_Rela *dst, size_t type)
 {
   if (type == SHT_RELA)
     return gelf_getrela (data, ndx, dst);
@@ -4608,12 +4609,23 @@ read_rel (struct section_data *secdata, Elf_Data *reldata, bool elf_64)
          /* Technically legal, but never used.  Better have dwarflint
             flag them as erroneous, because it's more likely these
             are a result of a bug than actually being used.  */
-         wr_error (&where, ": 8 or 16-bit relocation type %d.\n", type);
-         goto skip;
+         {
+           char buf[64];
+           wr_error (&where, ": 8 or 16-bit relocation type %s.\n",
+                     ebl_reloc_type_name (secdata->file->ebl,
+                                          cur->type, buf, sizeof (buf)));
+           goto skip;
+         }
 
        default:
-         wr_error (&where, ": invalid relocation type %d.\n", type);
-         goto skip;
+         {
+           char buf[64];
+           wr_error (&where, ": invalid relocation %d (%s).\n",
+                     cur->type,
+                     ebl_reloc_type_name (secdata->file->ebl,
+                                          cur->type, buf, sizeof (buf)));
+           goto skip;
+         }
        };
 
       if (cur->offset + width >= secdata->data->d_size)