]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix type of .persistent.bss section
authorEric Botcazou <ebotcazou@gcc.gnu.org>
Fri, 23 Apr 2021 17:07:59 +0000 (19:07 +0200)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Fri, 23 Apr 2021 17:24:08 +0000 (19:24 +0200)
The change implementing the .persistent family of sections broke the
existing support for the .persistent.bss section in the compiler:

int a __attribute__ ((section (".persistent.bss")));

t.s: Assembler messages:
t.s:4: Warning: setting incorrect section type for .persistent.bss

The compiler encodes it as @nobits but the assembler expects @progbits.
The assembler is incorrect and should treat the section like the compiler.

bfd/
* elf.c (special_sections_p): Add .persistent.bss.
gas/
* testsuite/gas/elf/section25.d: Run it everywhere.
* testsuite/gas/elf/section26.d: Likewise.
* testsuite/gas/elf/section26.s: Add test for .persistent.bss.

bfd/ChangeLog
bfd/elf.c
gas/ChangeLog
gas/testsuite/gas/elf/section25.d
gas/testsuite/gas/elf/section26.d
gas/testsuite/gas/elf/section26.s

index ea9d22e13bb49dffdf72808d591fca35e61d44e6..e97150b6202779465285b7053b0f82bcdfd7265d 100644 (file)
@@ -1,3 +1,7 @@
+2021-04-23  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * elf.c (special_sections_p): Add .persistent.bss.
+
 2021-04-01  Tamar Christina  <tamar.christina@arm.com>
 
        Backported from mainline.
index 84a5d942817a9a54b1170fbbb594787c5839aa54..36733e080dd9d9be28b576b246aaf5bd8c8569c7 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2712,6 +2712,7 @@ static const struct bfd_elf_special_section special_sections_n[] =
 
 static const struct bfd_elf_special_section special_sections_p[] =
 {
+  { STRING_COMMA_LEN (".persistent.bss"), 0, SHT_NOBITS,       SHF_ALLOC + SHF_WRITE },
   { STRING_COMMA_LEN (".persistent"),   -2, SHT_PROGBITS,      SHF_ALLOC + SHF_WRITE },
   { STRING_COMMA_LEN (".preinit_array"), -2, SHT_PREINIT_ARRAY, SHF_ALLOC + SHF_WRITE },
   { STRING_COMMA_LEN (".plt"),           0, SHT_PROGBITS,      SHF_ALLOC + SHF_EXECINSTR },
index 057943ce68d50115be73ea73decfb33bb74eee25..bd87aca2525dcc6c8f02ce8d5adcd1aad7fcd6ab 100644 (file)
@@ -1,3 +1,9 @@
+2021-04-23  Eric Botcazou<ebotcazou@adacore.com>
+
+       * testsuite/gas/elf/section25.d: Run it everywhere.
+       * testsuite/gas/elf/section26.d: Likewise.
+       * testsuite/gas/elf/section26.s: Add test for .persistent.bss.
+
 2021-04-09  Tejas Belagod  <tejas.belagod@arm.com>
 
        Backported from mainline.
index 09353849e5bdaec9afe214159f82102a73c25612..fa09b85074fa14092ee03ec2e7142ac90df269ce 100644 (file)
@@ -1,7 +1,9 @@
 #name: sections 25 (.noinit)
-#target: [supports_noinit_section]
 #source: section25.s
 #readelf: -S --wide
+# The h8300 port issues a warning message for
+# new sections created without atrributes.
+#xfail: h8300-*
 
 #...
   \[..\] .noinit[      ]+NOBITS[       ]+[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 00  WA .*
index 15d85bdca9d08f0189274ca5c922f5110db21d4a..f08f444e9c925ffee2ce6858f7e2dea23fa8bf51 100644 (file)
@@ -1,12 +1,16 @@
 #name: sections 26 (.persistent)
-#target: [supports_persistent_section]
 #source: section26.s
 #readelf: -S --wide
+# The h8300 port issues a warning message for
+# new sections created without atrributes.
+#xfail: h8300-*
 
 #...
   \[..\] .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 .*
+#...
+  \[..\] .persistent.bss[      ]+NOBITS[       ]+[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
index 7f986454229e8a078d042b27893f0187eb81d50b..aefe15d4c2c33904985f078c180d7e073d5ec410 100644 (file)
@@ -4,5 +4,8 @@
 .section .persistent.foo
 .word 0
 
+.section .persistent.bss
+.word 0
+
 .section .gnu.linkonce.p.bar
 .word 0