]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gas: have scrubber also respect quoted labels
authorJan Beulich <jbeulich@suse.com>
Fri, 9 Aug 2024 09:48:05 +0000 (11:48 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 9 Aug 2024 09:48:05 +0000 (11:48 +0200)
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.)

gas/app.c
gas/testsuite/gas/all/gas.exp
gas/testsuite/gas/all/quoted-label-blank.d [new file with mode: 0644]
gas/testsuite/gas/all/quoted-label-blank.s [new file with mode: 0644]

index fa877851f019063ab8dcf33d554f6cd1651efbb0..89e9dd0ac826d6bddbabaa83cb5153f77dd18331 100644 (file)
--- 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;
index d42d8df3cebcf6aa5eae9f8d8db0d4714f09cc71..45d037cc190421fa767866275dcaea21ab98a423 100644 (file)
@@ -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 (file)
index 0000000..92b5eca
--- /dev/null
@@ -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 (file)
index 0000000..530b6fc
--- /dev/null
@@ -0,0 +1,4 @@
+       .data
+       .globl  "blank-after"
+"blank-after" :
+       .byte 0