]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Do not rely on ebl_check_special_section when checking debuginfo files.
authorJose E. Marchesi <jose.marchesi@oracle.com>
Tue, 13 Oct 2015 16:39:15 +0000 (18:39 +0200)
committerMark Wielaard <mjw@redhat.com>
Tue, 13 Oct 2015 17:42:19 +0000 (19:42 +0200)
The test run-strip-strmerge.sh is failing in sparc targets.  This is
because it does an `elflint -d' in a debuginfo file, and this fails
with:

  section [21] '.plt' is both executable and writable

elflint uses the ebl_check_special_section hook (implemented only by
the alpha and sparc backends) in order to determine whether an
executable+writable section must be flagged or not.  In both cases the
hook will fail analyzing eu-strip debuginfo files (as they should,
because debuginfo files are broken ;).

This patch just modifies elflint to not use the hook when -d is
specified in the command-line.  This fixes the test in sparc-* and
sparc64-* targets (and presumably in alpha* targets too).

Additionaly, the patch checks that the type of WE sections in
debuginfo files is NOBITS.

Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
src/ChangeLog
src/elflint.c

index 8ba253977beec063456363cb483b7a46a35fcd54..f459e117c442800d3bab35bb47230de74c4315ba 100644 (file)
@@ -1,3 +1,9 @@
+2015-10-13  Jose E. Marchesi  <jose.marchesi@oracle.com>
+
+       * elflint.c (check_sections): Do not rely on
+       ebl_check_special_section when checking debuginfo files.  Also
+       check that the type of WE sections in debuginfo files is NOBITS.
+
 2015-10-13  Mark Wielaard  <mjw@redhat.com>
 
        * elflint.c (check_program_header): Check relro flags are a subset
index 63192bbd0c91eb2eed3da0837b17ef0ce99f4f67..0a6f0df37bc4ab3921d0c7638ca1e52b5fa00710 100644 (file)
@@ -3938,12 +3938,20 @@ section [%2zu] '%s' has unexpected type %d for an executable section\n"),
              break;
            }
 
-         if ((shdr->sh_flags & SHF_WRITE)
-             && !ebl_check_special_section (ebl, cnt, shdr,
-                                            section_name (ebl, cnt)))
-           ERROR (gettext ("\
+         if (shdr->sh_flags & SHF_WRITE)
+           {
+             if (is_debuginfo && shdr->sh_type != SHT_NOBITS)
+               ERROR (gettext ("\
+section [%2zu] '%s' must be of type NOBITS in debuginfo files\n"),
+                      cnt, section_name (ebl, cnt));
+
+             if (!is_debuginfo
+                 && !ebl_check_special_section (ebl, cnt, shdr,
+                                                section_name (ebl, cnt)))
+               ERROR (gettext ("\
 section [%2zu] '%s' is both executable and writable\n"),
-                  cnt, section_name (ebl, cnt));
+                      cnt, section_name (ebl, cnt));
+           }
        }
 
       if (ehdr->e_type != ET_REL && (shdr->sh_flags & SHF_ALLOC) != 0)