[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/20528] ld -r doesn't handle SHF_EXCLUDE section properly
From: |
hjl.tools at gmail dot com |
Subject: |
[Bug ld/20528] ld -r doesn't handle SHF_EXCLUDE section properly |
Date: |
Fri, 26 Aug 2016 22:08:54 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=20528
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
This works:
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index dd4d35a..6ce4e00 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1903,9 +1903,16 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
lang_insert_orphan to create a new output section. */
constraint = SPECIAL;
+ /* SEC_EXCLUDE is ignored 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,
--
You are receiving this mail because:
You are on the CC list for the bug.