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.
This commit is contained in:
Nick Clifton 2017-08-02 11:45:05 +01:00
parent d84ed528d4
commit ddff3d84be
2 changed files with 8 additions and 0 deletions

View File

@ -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.

View File

@ -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