+2016-09-29 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/20528
+ * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Don't
+ merge 2 sections with different SHF_EXCLUDE.
+ * testsuite/ld-elf/pr20528a.d: New file.
+ * testsuite/ld-elf/pr20528a.s: Likewise.
+ * testsuite/ld-elf/pr20528b.d: Likewise.
+ * testsuite/ld-elf/pr20528b.s: Likewise.
+
2016-09-28 Christophe Lyon <christophe.lyon@linaro.org>
PR ld/20608
lang_insert_orphan to create a new output section. */
constraint = SPECIAL;
+ /* SEC_EXCLUDE is cleared when doing a relocatable link. But
+ we can't merge 2 input sections with the same name when only
+ one of them has SHF_EXCLUDE. */
if (os->bfd_section != NULL
&& (os->bfd_section->flags == 0
- || (((s->flags ^ os->bfd_section->flags)
+ || ((!bfd_link_relocatable (&link_info)
+ || (((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,
os->bfd_section,
--- /dev/null
+#source: pr20528a.s
+#source: pr20528b.s
+#ld: -r
+#readelf: -S --wide
+
+#...
+[ ]*\[.*\][ ]+\.text.startup[ ]+PROGBITS.*[ ]+AX[ ]+.*
+[ ]*\[.*\][ ]+\.text.startup[ ]+PROGBITS.*[ ]+AXE[ ]+.*
+#pass
--- /dev/null
+ .text
+ .section .text.startup,"ax",%progbits
+ .globl main
+ .type main, %function
+main:
+ .byte 0
--- /dev/null
+#source: pr20528b.s
+#source: pr20528a.s
+#ld: -r
+#readelf: -S --wide
+
+#...
+[ ]*\[.*\][ ]+\.text.startup[ ]+PROGBITS.*[ ]+AXE[ ]+.*
+[ ]*\[.*\][ ]+\.text.startup[ ]+PROGBITS.*[ ]+AX[ ]+.*
+#pass
--- /dev/null
+ .text
+ .section .text.startup,"axe",%progbits
+ .globl main1
+ .type main1, %function
+main1:
+ .byte 0