]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
elflint: Add two more symbols to gnuld list of allowed bad values.
authorMark Wielaard <mjw@redhat.com>
Wed, 6 Feb 2013 15:20:17 +0000 (16:20 +0100)
committerMark Wielaard <mjw@redhat.com>
Wed, 6 Feb 2013 22:29:04 +0000 (23:29 +0100)
Add __bss_start and __TMC_END__ to the list of symbols allowed to have
out of section values because of the following GNU ld bug:
http://sourceware.org/bugzilla/show_bug.cgi?id=13621.
Allow them to appear in either .symtab or .dynsym, but only when they
are zero sized. It is impossible to define a general rule for this bug,
but this should catch most common issues that are mostly harmless
because the symbols signify the removed section was empty to being with.
This catches at least all symbols often flagged in the tests.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
src/ChangeLog
src/elflint.c

index f3f9b51d83d6df9ec36b4e7f0dd2b9f9d2b6b827..7d7b66fad42493a46c5137fa1802ae68452790d3 100644 (file)
@@ -1,3 +1,10 @@
+2013-02-06  Mark Wielaard  <mjw@redhat.com>
+
+       * elflint.c (check_symtab): Add __bss_start and __TMC_END__ to the
+       list of symbols allowed to have out of section values because of
+       GNU ld bugs in either .symtab or .dynsym, but only when they are
+       zero sized.
+
 2013-01-24  Mark Wielaard  <mjw@redhat.com>
 
        * readelf.c (argp_option): Add unresolved-address-offsets, U.
index 4084987f961c1c39b8ab0c6f3b7235e95bc052bb..bc5ed33d4c30f67ff4254683f1e500ab4dfc05b8 100644 (file)
@@ -767,15 +767,22 @@ section [%2d] '%s': symbol %zu: function in COMMON section is nonsense\n"),
                        {
                          /* GNU ld has severe bugs.  When it decides to remove
                             empty sections it leaves symbols referencing them
-                            behind.  These are symbols in .symtab.  */
+                            behind.  These are symbols in .symtab or .dynsym
+                            and for the named symbols have zero size.  See
+                            sourceware PR13621.  */
                          if (!gnuld
-                             || strcmp (section_name (ebl, idx), ".symtab")
+                             || (strcmp (section_name (ebl, idx), ".symtab")
+                                 && strcmp (section_name (ebl, idx),
+                                            ".dynsym"))
+                             || sym->st_size != 0
                              || (strcmp (name, "__preinit_array_start") != 0
                                  && strcmp (name, "__preinit_array_end") != 0
                                  && strcmp (name, "__init_array_start") != 0
                                  && strcmp (name, "__init_array_end") != 0
                                  && strcmp (name, "__fini_array_start") != 0
-                                 && strcmp (name, "__fini_array_end") != 0))
+                                 && strcmp (name, "__fini_array_end") != 0
+                                 && strcmp (name, "__bss_start") != 0
+                                 && strcmp (name, "__TMC_END__") != 0))
                            ERROR (gettext ("\
 section [%2d] '%s': symbol %zu: st_value out of bounds\n"),
                                   idx, section_name (ebl, idx), cnt);