public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] gas: have scrubber also respect quoted labels
@ 2024-08-09  9:49 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2024-08-09  9:49 UTC (permalink / raw)
  To: binutils-cvs

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

commit 8d627d3b319fb0110e2e8f018202b8f231d56411
Author: Jan Beulich <jbeulich@suse.com>
Date:   Fri Aug 9 11:48:05 2024 +0200

    gas: have scrubber also respect quoted labels
    
    For the handling of ':' elsewhere in the scrubber to be correct with
    regard to labels, the state after parsing a string found at the start of
    a line must match that after finding a symbol character at the start of
    a line. (Things are largely okay when there's whitespace ahead of the
    label: Whitespace after the colon then is retained rather than dropped
    for typical targets like x86, but read.c will know to deal with that.)

Diff:
---
 gas/app.c                                  | 2 ++
 gas/testsuite/gas/all/gas.exp              | 1 +
 gas/testsuite/gas/all/quoted-label-blank.d | 9 +++++++++
 gas/testsuite/gas/all/quoted-label-blank.s | 4 ++++
 4 files changed, 16 insertions(+)

diff --git a/gas/app.c b/gas/app.c
index fa877851f01..89e9dd0ac82 100644
--- a/gas/app.c
+++ b/gas/app.c
@@ -1108,6 +1108,8 @@ do_scrub_chars (size_t (*get) (char *, size_t), char *tostart, size_t tolen,
 	    }
 	  else if (state == 3)
 	    old_state = 9;
+	  else if (state == 0)
+	    old_state = 11; /* Now seeing label definition.  */
 	  else
 	    old_state = state;
 	  state = 5;
diff --git a/gas/testsuite/gas/all/gas.exp b/gas/testsuite/gas/all/gas.exp
index d42d8df3ceb..45d037cc190 100644
--- a/gas/testsuite/gas/all/gas.exp
+++ b/gas/testsuite/gas/all/gas.exp
@@ -477,6 +477,7 @@ if [is_elf_format] {
 }
 
 run_dump_test quoted-sym-names
+run_dump_test quoted-label-blank
 
 # Targets where # is not a line comment character don't transform
 # "# <line> <file>" into .linefile (PR gas/29120).
diff --git a/gas/testsuite/gas/all/quoted-label-blank.d b/gas/testsuite/gas/all/quoted-label-blank.d
new file mode 100644
index 00000000000..92b5ecad51c
--- /dev/null
+++ b/gas/testsuite/gas/all/quoted-label-blank.d
@@ -0,0 +1,9 @@
+#nm: --extern-only --numeric-sort
+#name: quoted label name followed by whitespace
+# No quoted strings handling (TC_STRING_ESCAPES set to 0):
+#notarget: powerpc*-*-aix* powerpc*-*-beos* powerpc-*-macos* rs6000-*-*
+# Certain LABELS_WITHOUT_COLONS targets:
+#notarget: mmix-*-* tic54*-*-* z80-*-*
+
+#...
+0+00 D blank-after
diff --git a/gas/testsuite/gas/all/quoted-label-blank.s b/gas/testsuite/gas/all/quoted-label-blank.s
new file mode 100644
index 00000000000..530b6fc5388
--- /dev/null
+++ b/gas/testsuite/gas/all/quoted-label-blank.s
@@ -0,0 +1,4 @@
+	.data
+	.globl	"blank-after"
+"blank-after" :
+	.byte 0

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

only message in thread, other threads:[~2024-08-09  9:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-09  9:49 [binutils-gdb] gas: have scrubber also respect quoted labels 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).