aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2017-08-02 11:45:05 +0100
committerNick Clifton <nickc@redhat.com>2017-08-02 11:45:05 +0100
commitddff3d84be42fa80c2c9aaa635f2b9269e74e4f9 (patch)
tree6e89d2025694a77c9c10c449fda23a1b62863b16 /ld/emultempl
parentd84ed528d4817b0ff854006b65a9f6ec75f0407a (diff)
downloadfsf-binutils-gdb-ddff3d84be42fa80c2c9aaa635f2b9269e74e4f9.zip
fsf-binutils-gdb-ddff3d84be42fa80c2c9aaa635f2b9269e74e4f9.tar.gz
fsf-binutils-gdb-ddff3d84be42fa80c2c9aaa635f2b9269e74e4f9.tar.bz2
Fix seg-fault when trying to place non-ELF orphan sections.
PR 21884 * emultempl/elf32.em (_place_orphan): Skip non-ELF binaries when looking for sections to merge.
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/elf32.em2
1 files changed, 2 insertions, 0 deletions
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index d2551b6..8cdcc6c7 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -2150,6 +2150,8 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
one of them has SHF_EXCLUDE. Don't merge 2 sections with
different sh_info. */
if (os->bfd_section != NULL
+ /* PR 21884: Don't merge non-ELF sections. */
+ && bfd_get_flavour (os->bfd_section->owner) == bfd_target_elf_flavour
&& (elf_section_data (os->bfd_section)->this_hdr.sh_info
== elf_section_data (s)->this_hdr.sh_info)
&& (os->bfd_section->flags == 0