public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] ELF: test certain .bss usages
@ 2024-01-05  7:18 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2024-01-05  7:18 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e2c9acb943f9af1ceb6690264e5a4f3f531c48b6

commit e2c9acb943f9af1ceb6690264e5a4f3f531c48b6
Author: Jan Beulich <jbeulich@suse.com>
Date:   Fri Jan 5 08:16:30 2024 +0100

    ELF: test certain .bss usages
    
    Various targets have / had overrides for .bss. Make sure that in such
    cases
    - .previous still works correctly (requiring such targets to invoke
      obj_elf_section_change_hook() from their overriding handlers),
    - sub-section specifiers are accepted as far as feasible (mandated by
      the doc).

Diff:
---
 gas/testsuite/gas/elf/bss-prev.d    | 13 +++++++++++++
 gas/testsuite/gas/elf/bss-prev.s    |  6 ++++++
 gas/testsuite/gas/elf/bss-subsect.d | 11 +++++++++++
 gas/testsuite/gas/elf/bss-subsect.s | 10 ++++++++++
 gas/testsuite/gas/elf/elf.exp       |  7 +++++++
 5 files changed, 47 insertions(+)

diff --git a/gas/testsuite/gas/elf/bss-prev.d b/gas/testsuite/gas/elf/bss-prev.d
new file mode 100644
index 00000000000..b7ffac0a1c2
--- /dev/null
+++ b/gas/testsuite/gas/elf/bss-prev.d
@@ -0,0 +1,13 @@
+#name: .bss / .previous interaction
+#as: --no-pad-sections
+#readelf: -S --wide
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Addr(ess|) +Off +Size .*
+#...
+ *\[ [1-9]\] *\.text +PROGBITS +0*0 +0[0-9a-f]* 0+ .*
+ *\[ [1-9]\] *\.data +PROGBITS +0*0 +0[0-9a-f]* 0*1 .*
+ *\[ [1-9]\] *\.bss +NOBITS +0*0 +0[0-9a-f]* 0*1 .*
+#pass
diff --git a/gas/testsuite/gas/elf/bss-prev.s b/gas/testsuite/gas/elf/bss-prev.s
new file mode 100644
index 00000000000..27564cef23b
--- /dev/null
+++ b/gas/testsuite/gas/elf/bss-prev.s
@@ -0,0 +1,6 @@
+	.text
+	.data
+	.bss
+	.byte 0
+	.previous
+	.byte 1
diff --git a/gas/testsuite/gas/elf/bss-subsect.d b/gas/testsuite/gas/elf/bss-subsect.d
new file mode 100644
index 00000000000..ca598326af7
--- /dev/null
+++ b/gas/testsuite/gas/elf/bss-subsect.d
@@ -0,0 +1,11 @@
+#name: .bss <subsection>
+#as: --no-pad-sections
+#readelf: -S --wide
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Addr(ess|) +Off +Size .*
+#...
+ *\[ [1-9]\] *\.bss +NOBITS +0*0 +0[0-9a-f]* 0*a .*
+#pass
diff --git a/gas/testsuite/gas/elf/bss-subsect.s b/gas/testsuite/gas/elf/bss-subsect.s
new file mode 100644
index 00000000000..b3de5b8d6d6
--- /dev/null
+++ b/gas/testsuite/gas/elf/bss-subsect.s
@@ -0,0 +1,10 @@
+	.bss
+	.byte 0
+
+	.bss 2
+	.balign 2
+	.skip 2
+
+	.bss 1
+	.balign 4
+	.skip 4
diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
index a21dbcc19da..88ef09c7c84 100644
--- a/gas/testsuite/gas/elf/elf.exp
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -336,6 +336,13 @@ if { [is_elf_format] } then {
 
     run_dump_test "pr25917"
     run_dump_test "bss"
+    # Some targets treat .bss similar to .lcomm.
+    if { ![istarget "csky-*-*"]
+	 && ![istarget "mcore-*-*"]
+	 && ![istarget "spu-*-*"] } then {
+	run_dump_test "bss-prev" $dump_opts
+	run_dump_test "bss-subsect" $dump_opts
+    }
     run_dump_test "bad-bss"
     run_dump_test "bad-section-flag"
     run_dump_test "bad-size"

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-05  7:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-05  7:18 [binutils-gdb] ELF: test certain .bss usages Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).