diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2021-01-04 12:37:49 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2021-01-04 12:38:05 -0800 |
commit | cd6d537c48fa862e8a5888b648102d7b2330ef81 (patch) | |
tree | 1ab9bc928a0acb1a3acc04f6d985338ae45f279e /gas | |
parent | e4ad960a577405c4d0f7593f439ad560fabc9d49 (diff) | |
download | gdb-cd6d537c48fa862e8a5888b648102d7b2330ef81.zip gdb-cd6d537c48fa862e8a5888b648102d7b2330ef81.tar.gz gdb-cd6d537c48fa862e8a5888b648102d7b2330ef81.tar.bz2 |
elf: Allow mixed ordered/unordered inputs for non-relocatable link
For non-relocatable link with SHF_LINK_ORDER inputs, allow mixed indirect
and data inputs with ordered and unordered inputs:
1. Add pattern to bfd_section for the matching section name pattern in
linker script and update BFD_FAKE_SECTION.
2. Sort the consecutive bfd_indirect_link_order sections with the same
pattern to allow linker script to overdide input section order.
3. Place unordered sections before ordered sections.
4. Change the offsets of the indirect input sections only.
bfd/
PR ld/26256
* elflink.c (compare_link_order): Place unordered sections before
ordered sections.
(elf_fixup_link_order): Add a link info argument. Allow mixed
ordered and unordered input sections for non-relocatable link.
Sort the consecutive bfd_indirect_link_order sections with the
same pattern. Change the offsets of the bfd_indirect_link_order
sections only.
(bfd_elf_final_link): Pass info to elf_fixup_link_order.
* section.c (bfd_section): Add pattern.
(BFD_FAKE_SECTION): Initialize pattern to NULL.
* bfd-in2.h: Regenerated.
gas/
PR ld/26256
* config/obj-elf.c (obj_elf_change_section): Also filter out
SHF_LINK_ORDER.
ld/
PR ld/26256
* ldlang.c (gc_section_callback): Set pattern.
* testsuite/ld-elf/pr26256-1.s: New file.
* testsuite/ld-elf/pr26256-1.t: Likewise.
* testsuite/ld-elf/pr26256-1a.d: Likewise.
* testsuite/ld-elf/pr26256-1b.d: Likewise.
* testsuite/ld-elf/pr26256-2.s: Likewise.
* testsuite/ld-elf/pr26256-2.t: Likewise.
* testsuite/ld-elf/pr26256-2a.d: Likewise.
* testsuite/ld-elf/pr26256-2b-alt.d: Likewise.
* testsuite/ld-elf/pr26256-2b.d: Likewise.
* testsuite/ld-elf/pr26256-3.s: Likewise.
* testsuite/ld-elf/pr26256-3a.d: Likewise.
* testsuite/ld-elf/pr26256-3a.t: Likewise.
* testsuite/ld-elf/pr26256-3b.d: Likewise.
* testsuite/ld-elf/pr26256-3b.t: Likewise.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 6 | ||||
-rw-r--r-- | gas/config/obj-elf.c | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 4c370a6..03ea1a1 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2021-01-04 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/26256 + * config/obj-elf.c (obj_elf_change_section): Also filter out + SHF_LINK_ORDER. + 2021-01-04 Alan Modra <amodra@gmail.com> PR 27102 diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index bf79b05..94fa805 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -666,7 +666,9 @@ obj_elf_change_section (const char *name, } } - if (old_sec == NULL && ((attr & ~(SHF_MASKOS | SHF_MASKPROC)) + if (old_sec == NULL && ((attr & ~(SHF_LINK_ORDER + | SHF_MASKOS + | SHF_MASKPROC)) & ~ssect->attr) != 0) { /* As a GNU extension, we permit a .note section to be |