aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2016-12-02 14:40:46 +0000
committerNick Clifton <nickc@redhat.com>2016-12-02 14:40:46 +0000
commit68c638d6e655a937a48770a5df765e6ebbc5b890 (patch)
tree701325693106b2faa2db4582b39d5a51c8a5b6bd /ld/emultempl
parent08698b7b46c9c932530dcbcd7e851d27a7d2c503 (diff)
downloadgdb-68c638d6e655a937a48770a5df765e6ebbc5b890.zip
gdb-68c638d6e655a937a48770a5df765e6ebbc5b890.tar.gz
gdb-68c638d6e655a937a48770a5df765e6ebbc5b890.tar.bz2
Fix seg-fault linking corrupt binary.
PR ld/20912 * emultempl/elf32.em (_place_orphan): Test for ELF format of the orphan before looking for the SHF_EXCLUDE flag.
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/elf32.em6
1 files changed, 3 insertions, 3 deletions
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 36aa7db..1fd6313 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -2062,9 +2062,9 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
if (os->bfd_section != NULL
&& (os->bfd_section->flags == 0
|| ((!bfd_link_relocatable (&link_info)
- || (((elf_section_flags (s)
- ^ elf_section_flags (os->bfd_section))
- & SHF_EXCLUDE) == 0))
+ || (iself && (((elf_section_flags (s)
+ ^ elf_section_flags (os->bfd_section))
+ & SHF_EXCLUDE) == 0)))
&& ((s->flags ^ os->bfd_section->flags)
& (SEC_LOAD | SEC_ALLOC)) == 0
&& _bfd_elf_match_sections_by_type (link_info.output_bfd,