gas: Generate a new section for SHF_GNU_RETAIN
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 9 Dec 2020 00:41:22 +0000 (16:41 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 9 Dec 2020 00:41:32 +0000 (16:41 -0800)
commit037311d1df303c91395cdfe07b6ab414de99e420
tree2d60f4001e36f5e4b1445fa630e0098ce31b7a57
parentdd235d453e8ee2f641cbafa4b7078a1407a50ec1
gas: Generate a new section for SHF_GNU_RETAIN

For
.globl foo2
.section .data.foo,"aR"
.align 4
.type foo2, @object
.size foo2, 4
foo2:
.long 2
.globl foo1
.section .data.foo
.align 4
.type foo1, @object
.size foo1, 4
foo1:
.long 1

generate a new section if the SHF_GNU_RETAIN bit doesn't match.

* config/obj-elf.c (SEC_ASSEMBLER_SHF_MASK): New.
(get_section_by_match): Also check if SEC_ASSEMBLER_SHF_MASK of
sh_flags matches.  Rename info to sh_info.
(obj_elf_change_section): Don't check previous SHF_GNU_RETAIN.
Rename info to sh_info.
(obj_elf_section): Rename info to sh_info.  Set sh_flags for
SHF_GNU_RETAIN.
* config/obj-elf.h (elf_section_match): Rename info to sh_info.
Add sh_flags.
* testsuite/gas/elf/elf.exp: Run section27.
* testsuite/gas/elf/section24b.d: Updated.
* testsuite/gas/elf/section27.d: New file.
* testsuite/gas/elf/section27.s: Likewise.
gas/ChangeLog
gas/config/obj-elf.c
gas/config/obj-elf.h
gas/testsuite/gas/elf/elf.exp
gas/testsuite/gas/elf/section24b.d
gas/testsuite/gas/elf/section27.d [new file with mode: 0644]
gas/testsuite/gas/elf/section27.s [new file with mode: 0644]