[v3,1/9] gas: have scrubber also respect quoted labels

Message ID 3bfd6cff-3477-4ac2-a945-f24098c4a414@suse.com
State New
Headers
Series gas: scrubber adjustments |

Commit Message

Jan Beulich July 31, 2024, 11:54 a.m. UTC
  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.)
---
v3: New.
  

Patch

--- a/gas/app.c
+++ b/gas/app.c
@@ -1113,6 +1113,8 @@  do_scrub_chars (size_t (*get) (char *, s
 	    }
 	  else if (state == 3)
 	    old_state = 9;
+	  else if (state == 0)
+	    old_state = 11; /* Now seeing label definition.  */
 	  else
 	    old_state = state;
 	  state = 5;
--- 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).
--- /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
--- /dev/null
+++ b/gas/testsuite/gas/all/quoted-label-blank.s
@@ -0,0 +1,4 @@ 
+	.data
+	.globl	"blank-after"
+"blank-after" :
+	.byte 0