This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Fix seg-fault when trying to place non-ELF orphan sections.
- From: Nick Clifton <nickc at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 2 Aug 2017 10:45:51 -0000
- Subject: [binutils-gdb] Fix seg-fault when trying to place non-ELF orphan sections.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ddff3d84be42fa80c2c9aaa635f2b9269e74e4f9
commit ddff3d84be42fa80c2c9aaa635f2b9269e74e4f9
Author: Nick Clifton <nickc@redhat.com>
Date: Wed Aug 2 11:45:05 2017 +0100
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.
Diff:
---
ld/ChangeLog | 6 ++++++
ld/emultempl/elf32.em | 2 ++
2 files changed, 8 insertions(+)
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 3c918e6..9acf64e 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2017-08-02 Nick Clifton <nickc@redhat.com>
+
+ PR 21884
+ * emultempl/elf32.em (_place_orphan): Skip non-ELF binaries when
+ looking for sections to merge.
+
2017-07-31 Alan Modra <amodra@gmail.com>
* ld.texinfo (plt-localentry): Revise.
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