public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Binutils <binutils@sourceware.org>
Cc: Nick Clifton <nickc@redhat.com>, Alan Modra <amodra@gmail.com>
Subject: [PATCH 15/22] ELF: test certain .bss usages
Date: Fri, 15 Dec 2023 13:16:37 +0100	[thread overview]
Message-ID: <ed6e76e3-5c19-478f-9a9f-1c52542aa79a@suse.com> (raw)
In-Reply-To: <5e1fe3bc-78ca-4c54-a19c-f8efa015f839@suse.com>

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).

--- /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
--- /dev/null
+++ b/gas/testsuite/gas/elf/bss-prev.s
@@ -0,0 +1,6 @@
+	.text
+	.data
+	.bss
+	.byte 0
+	.previous
+	.byte 1
--- /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
--- /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
--- 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"


  parent reply	other threads:[~2023-12-15 12:16 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15 11:59 [PATCH 00/22] ELF: correct handling of simplified section directives Jan Beulich
2023-12-15 12:06 ` [PATCH 01/22] Arm: drop .bss override Jan Beulich
2023-12-15 12:06 ` [PATCH 02/22] Arm64: " Jan Beulich
2023-12-15 12:07 ` [PATCH 03/22] RISC-V: " Jan Beulich
2023-12-21  6:44   ` Nelson Chu
2023-12-15 12:08 ` [PATCH 04/22] IA64: " Jan Beulich
2023-12-15 12:09 ` [PATCH 05/22] bfin: " Jan Beulich
2023-12-15 12:10 ` [PATCH 06/22] m32c: " Jan Beulich
2023-12-15 12:10 ` [PATCH 07/22] m68k: " Jan Beulich
2023-12-15 12:11 ` [PATCH 08/22] microblaze: drop/restrict override of .text, .data, and .bss Jan Beulich
2023-12-15 12:12 ` [PATCH 09/22] rl78: drop .bss override Jan Beulich
2023-12-15 12:12 ` [PATCH 10/22] rx: " Jan Beulich
2023-12-15 12:13 ` [PATCH 11/22] s390: " Jan Beulich
2023-12-15 12:14 ` [PATCH 12/22] score: " Jan Beulich
2023-12-15 12:15 ` [PATCH 13/22] visium: drop .bss and .skip overrides Jan Beulich
2023-12-15 12:16 ` [PATCH 14/22] z80: drop .bss override Jan Beulich
2023-12-15 12:16 ` Jan Beulich [this message]
2023-12-15 12:16 ` [PATCH 16/22] gas: correct .bss documentation for non-ELF Jan Beulich
2023-12-15 12:17 ` [PATCH 17/22] v850: drop .bss override Jan Beulich
2023-12-15 12:18 ` [PATCH 18/22] d30v: fix .text/.data interaction with .previous Jan Beulich
2023-12-15 12:19 ` [PATCH 19/22] hppa/ELF: " Jan Beulich
2023-12-15 16:37   ` John David Anglin
2023-12-15 12:19 ` [PATCH 20/22] nios2: " Jan Beulich
2023-12-15 19:00   ` Sandra Loosemore
2023-12-15 12:20 ` [PATCH 21/22] pru: " Jan Beulich
2023-12-15 12:20 ` [PATCH 22/22] ELF: test certain .text/.data usages Jan Beulich
2024-01-02  0:40 ` [PATCH 00/22] ELF: correct handling of simplified section directives Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ed6e76e3-5c19-478f-9a9f-1c52542aa79a@suse.com \
    --to=jbeulich@suse.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).