]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
unstrip: Update sh_info when SH_INFO_LINK_P not just when SHF_INFO_LINK set
authorMark Wielaard <mjw@redhat.com>
Fri, 2 Oct 2015 14:31:36 +0000 (16:31 +0200)
committerMark Wielaard <mjw@redhat.com>
Mon, 5 Oct 2015 19:58:59 +0000 (21:58 +0200)
SHF_INFO_LINK is not consistently set when sh_info is actually a section
index reference. Use SH_INFO_LINK_P to check whether to update the sh_info
value. SH_INFO_LINK_P also checks the section type to know whether or not
sh_info is meant as section index.

Found by run-strip-strmerge.sh test with older binutils.

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

index 72bb0ab8ada135e468d7ad6fdced5c0f4103f723..411c70bf5e77a013a3b0c0e67f6eed08f6775bcf 100644 (file)
@@ -1,3 +1,8 @@
+2015-10-02  Mark Wielaard  <mjw@redhat.com>
+
+       * unstrip.c (copy_elided_sections): Use SH_INFO_LINK_P, not just
+       SHF_INFO_LINK.
+
 2015-10-02  Mark Wielaard  <mjw@redhat.com>
 
        * strip.c (handle_elf): Don't move around allocated NOBITS sections.
index d40df97d1ced9fd273a0a90b71f98edfde15ed77..d193708a93115f89ace693478d72272e80e436d9 100644 (file)
@@ -1526,7 +1526,7 @@ more sections in stripped file than debug file -- arguments reversed?"));
 
        if (sec->shdr.sh_link != SHN_UNDEF)
          shdr_mem.sh_link = ndx_section[sec->shdr.sh_link - 1];
-       if (shdr_mem.sh_flags & SHF_INFO_LINK)
+       if (SH_INFO_LINK_P (&sec->shdr) && sec->shdr.sh_info != 0)
          shdr_mem.sh_info = ndx_section[sec->shdr.sh_info - 1];
 
        if (strtab != NULL)