2009-03-19 H.J. Lu <hongjiu.lu@intel.com>
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 19 Mar 2009 14:42:52 +0000 (14:42 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 19 Mar 2009 14:42:52 +0000 (14:42 +0000)
* readelf.c (debug_apply_relocations): Check relocations
against STT_SECTION symbol.

binutils/ChangeLog
binutils/readelf.c

index c6984416d17524bc05a0254f0ad917592365457a..c9423f71468bf270691797424061afd2729b0205 100644 (file)
@@ -1,3 +1,8 @@
+2009-03-19  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * readelf.c (debug_apply_relocations): Check relocations
+       against STT_SECTION symbol.
+
 2009-03-18  H.J. Lu  <hongjiu.lu@intel.com>
 
        * readelf.c (debug_apply_relocations): Allow relocations
index 276d4dd59b53a3d9efb01ad5b17b652f39a00579..c0c5beb5bec8a1af5d74dd9810f242a79f634bc3 100644 (file)
@@ -8387,20 +8387,20 @@ debug_apply_relocations (void * file,
          sym = symtab + get_reloc_symindex (rp->r_info);
 
          /* If the reloc has a symbol associated with it,
-            make sure that it is of an appropriate type.  */
+            make sure that it is of an appropriate type.
+
+            Relocations against symbols without type can happen.
+            Gcc -feliminate-dwarf2-dups may generate symbols
+            without type for debug info.
+
+            Icc generates relocations against function symbols
+            instead of local labels.
+
+            Relocations against object symbols can happen, eg when
+            referencing a global array.  For an example of this see
+            the _clz.o binary in libgcc.a.  */
          if (sym != symtab
-             && ELF_ST_TYPE (sym->st_info) != STT_SECTION
-             /* Relocations against symbols without type can happen.
-                Gcc -feliminate-dwarf2-dups may generate symbols
-                without type for debug info.  */
-             && ELF_ST_TYPE (sym->st_info) != STT_NOTYPE
-             /* Icc generates relocations against function symbols
-                instead of local labels.  */
-             && ELF_ST_TYPE (sym->st_info) != STT_FUNC
-             /* Relocations against object symbols can happen,
-                eg when referencing a global array.  For an
-                example of this see the _clz.o binary in libgcc.a.  */
-             && ELF_ST_TYPE (sym->st_info) != STT_OBJECT)
+             && ELF_ST_TYPE (sym->st_info) > STT_SECTION)
            {
              warn (_("skipping unexpected symbol type %s in %ld'th relocation in section %s\n"),
                    get_symbol_type (ELF_ST_TYPE (sym->st_info)),