From db99ecc08f5b66fbe9cb72e90352c7f77ec71a6e Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 2 Aug 2017 05:10:29 -0700 Subject: Check ELF section header only for ELF output When placing an orphan input section, check ELF section header only for ELF output. PR ld/21884 * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Check ELF section header only for ELF output. * testsuite/ld-elf/pr21884.d: New test. * testsuite/ld-elf/pr21884.t: Likewise. * testsuite/ld-elf/pr21884a.s: Likewise. * testsuite/ld-elf/pr21884b.s: Likewise. --- ld/emultempl/elf32.em | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ld/emultempl') diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index d2551b6..75ded12 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -2136,7 +2136,8 @@ gld${EMULATION_NAME}_place_orphan (asection *s, } /* Look through the script to see where to place this section. */ - if (constraint == 0) + if (constraint == 0 + && link_info.output_bfd->xvec->flavour == bfd_target_elf_flavour) for (os = lang_output_section_find (secname); os != NULL; os = next_matching_output_section_statement (os, 0)) -- cgit v1.1