summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2015-10-02 16:31:36 +0200
committerMark Wielaard <mjw@redhat.com>2015-10-02 16:31:44 +0200
commit9a4500f0ccf0815c71d6fd6fa301260f96675398 (patch)
tree11251223859aa86f804a6698ee31873e80520b37
parent7875bf53bf9846ff66a8e58d9c166d83b9596fa0 (diff)
unstrip: Update sh_info when SH_INFO_LINK_P, not just when SHF_INFO_LINK set.upstream/mjw/elfstrmerge
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 to as section index. Found by run-strip-strmerge.sh test with older binutils. Signed-off-by: Mark Wielaard <mjw@redhat.com>
-rw-r--r--src/ChangeLog5
-rw-r--r--src/unstrip.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 72bb0ab8..411c70bf 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
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.
Don't just mark the section header string table as unused.
* unstrip.c (copy_elided_sections): Add header names to strtab if
diff --git a/src/unstrip.c b/src/unstrip.c
index d40df97d..d193708a 100644
--- a/src/unstrip.c
+++ b/src/unstrip.c
@@ -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)