]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
elflint: Don't check shdr or TLS symbol offsets against debuginfo phdrs.
authorMark Wielaard <mjw@redhat.com>
Fri, 16 Oct 2015 19:19:05 +0000 (21:19 +0200)
committerMark Wielaard <mjw@redhat.com>
Fri, 16 Oct 2015 19:19:05 +0000 (21:19 +0200)
In debuginfo files the phdrs file offsets match those of the original ELF
file. So the section header file offsets and the TLS symbol value offset
in debuginfo files cannot be sanity checked against the phdrs file offset.

The issue can be triggered with run-strip-strmerge.sh test when configured
with --enable-gcov. Which will insert a .tbss section and TLS symbols that
trigger the above checks.

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

index 0d2b1d61f16e4234df13e3e84095068b21bdb139..f9e3b4a55a84aef383ce24703176618a70fad2bd 100644 (file)
@@ -1,3 +1,10 @@
+2015-10-16  Mark Wielaard  <mjw@redhat.com>
+
+       * elflint.c (check_symtab): Don't check TLS symbol value against TLS
+       phdr offset in debuginfo files.
+       (check_sections): Don't try to match section offsets to phdrs offsets
+       in debuginfo files.
+
 2015-10-16  Mark Wielaard  <mjw@redhat.com>
 
        * elflint.c (check_reloc_shdr): Reject only desthdrs if they have both
index eada4d5016309db15f92f1f7fe0242ca0ece8d04..7d72a1f7933164e5b0838a378b5edaa06abec484 100644 (file)
@@ -864,7 +864,7 @@ section [%2d] '%s': symbol %zu: TLS symbol but no TLS program header entry\n"),
 section [%2d] '%s': symbol %zu: TLS symbol but couldn't get TLS program header entry\n"),
                                   idx, section_name (ebl, idx), cnt);
                        }
-                     else
+                     else if (!is_debuginfo)
                        {
                          if (st_value
                              < destshdr->sh_offset - phdr->p_offset)
@@ -3955,7 +3955,8 @@ section [%2zu] '%s' is both executable and writable\n"),
            }
        }
 
-      if (ehdr->e_type != ET_REL && (shdr->sh_flags & SHF_ALLOC) != 0)
+      if (ehdr->e_type != ET_REL && (shdr->sh_flags & SHF_ALLOC) != 0
+         && !is_debuginfo)
        {
          /* Make sure the section is contained in a loaded segment
             and that the initialization part matches NOBITS sections.  */