diff options
author | Jozef Lawrynowicz <jozef.l@mittosystems.com> | 2020-11-27 10:45:35 +0000 |
---|---|---|
committer | Jozef Lawrynowicz <jozef.l@mittosystems.com> | 2020-11-27 10:45:35 +0000 |
commit | 2c6f3e56cbba35365ce0f558e9bfbb122a63a63d (patch) | |
tree | 4a8dac1296da1bfb56c19087d2a339dfeb3b0956 /gas/testsuite | |
parent | bab6ead85f444cbd81c3f8ee100e12629418648a (diff) | |
download | gdb-2c6f3e56cbba35365ce0f558e9bfbb122a63a63d.zip gdb-2c6f3e56cbba35365ce0f558e9bfbb122a63a63d.tar.gz gdb-2c6f3e56cbba35365ce0f558e9bfbb122a63a63d.tar.bz2 |
ELF: Support .noinit and .persistent sections
The ".persistent" section is for data that should be initialized during
load, but not during application reset.
The ".noinit" section is for data that should not be initialized during
load or application reset.
Targets utilizing the elf.sc linker script template can define
HAVE_{NOINIT,PERSISTENT}=yes to include the .noinit or .persistent
output sections in the generated linker script.
Targets with existing support for .noinit did not handle unique
.noinit.* and .gnu.linkonce.n.* sections the .noinit output section,
this patch also fixes that.
bfd/ChangeLog:
* elf.c (special_sections_g): Add .gnu.linkonce.n and .gnu.linkonce.p.
(special_sections_n): Add .noinit.
(special_sections_p): Add .persistent.
binutils/ChangeLog:
* testsuite/lib/binutils-common.exp (supports_noinit_section): New.
(supports_persistent_section): New.
gas/ChangeLog:
* testsuite/gas/elf/elf.exp: Run new tests.
* testsuite/gas/elf/section25.d: New test.
* testsuite/gas/elf/section25.s: New test.
* testsuite/gas/elf/section26.d: New test.
* testsuite/gas/elf/section26.s: New test.
ld/ChangeLog:
* emulparams/armelf.sh (OTHER_SECTIONS): Remove .noinit section
definition.
Define HAVE_{NOINIT,PERSISTENT}=yes.
* scripttempl/avr.sc (.noinit): Add .noinit.* and .gnu.linkonce.n.*
input section wildcard patterns.
* scripttempl/elf.sc: Define .noinit and .persistent sections when
HAVE_NOINIT or HAVE_PERSISTENT are defined to "yes".
* scripttempl/elf32msp430.sc (.noinit): Add .noinit.* and
.gnu.linkonce.n.*. input section wildcard patterns.
(.persistent): Add .persistent.* and
.gnu.linkonce.p.*. input section wildcard patterns.
* scripttempl/elfarcv2.sc (.noinit): Add .noinit.* and
.gnu.linkonce.n.*. input section wildcard patterns.
* scripttempl/pru.sc: Likewise.
* testsuite/ld-elf/noinit-sections-1.d: New test.
* testsuite/ld-elf/noinit-sections-2.d: New test.
* testsuite/ld-elf/noinit-sections-2.l: New test.
* testsuite/ld-elf/noinit-sections.s: New test.
* testsuite/ld-elf/persistent-sections-1.d: New test.
* testsuite/ld-elf/persistent-sections-2.d: New test.
* testsuite/ld-elf/persistent-sections-2.l: New test.
* testsuite/ld-elf/persistent-sections.s: New test.
Diffstat (limited to 'gas/testsuite')
-rw-r--r-- | gas/testsuite/gas/elf/elf.exp | 2 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/section25.d | 12 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/section25.s | 8 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/section26.d | 12 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/section26.s | 8 |
5 files changed, 42 insertions, 0 deletions
diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp index 0ba32c7..25c40a2 100644 --- a/gas/testsuite/gas/elf/elf.exp +++ b/gas/testsuite/gas/elf/elf.exp @@ -266,6 +266,8 @@ if { [is_elf_format] } then { run_dump_test "section23b" run_dump_test "section24a" run_dump_test "section24b" + run_dump_test "section25" + run_dump_test "section26" run_dump_test "sh-link-zero" run_dump_test "dwarf2-1" $dump_opts run_dump_test "dwarf2-2" $dump_opts diff --git a/gas/testsuite/gas/elf/section25.d b/gas/testsuite/gas/elf/section25.d new file mode 100644 index 0000000..0935384 --- /dev/null +++ b/gas/testsuite/gas/elf/section25.d @@ -0,0 +1,12 @@ +#name: sections 25 (.noinit) +#target: [supports_noinit_section] +#source: section25.s +#readelf: -S --wide + +#... + \[..\] .noinit[ ]+NOBITS[ ]+[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 00 WA .* +#... + \[..\] .noinit.foo[ ]+NOBITS[ ]+[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 00 WA .* +#... + \[..\] .gnu.linkonce.n.bar[ ]+NOBITS[ ]+[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 00 WA .* +#pass diff --git a/gas/testsuite/gas/elf/section25.s b/gas/testsuite/gas/elf/section25.s new file mode 100644 index 0000000..538e5c7 --- /dev/null +++ b/gas/testsuite/gas/elf/section25.s @@ -0,0 +1,8 @@ +.section .noinit +.word 0 + +.section .noinit.foo +.word 0 + +.section .gnu.linkonce.n.bar +.word 0 diff --git a/gas/testsuite/gas/elf/section26.d b/gas/testsuite/gas/elf/section26.d new file mode 100644 index 0000000..15d85bd --- /dev/null +++ b/gas/testsuite/gas/elf/section26.d @@ -0,0 +1,12 @@ +#name: sections 26 (.persistent) +#target: [supports_persistent_section] +#source: section26.s +#readelf: -S --wide + +#... + \[..\] .persistent[ ]+PROGBITS[ ]+[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 00 WA .* +#... + \[..\] .persistent.foo[ ]+PROGBITS[ ]+[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 00 WA .* +#... + \[..\] .gnu.linkonce.p.bar[ ]+PROGBITS[ ]+[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 00 WA .* +#pass diff --git a/gas/testsuite/gas/elf/section26.s b/gas/testsuite/gas/elf/section26.s new file mode 100644 index 0000000..7f98645 --- /dev/null +++ b/gas/testsuite/gas/elf/section26.s @@ -0,0 +1,8 @@ +.section .persistent +.word 0 + +.section .persistent.foo +.word 0 + +.section .gnu.linkonce.p.bar +.word 0 |