From: Jan Beulich Date: Fri, 9 Aug 2024 09:48:05 +0000 (+0200) Subject: gas: have scrubber also respect quoted labels X-Git-Tag: gdb-16-branchpoint~1204 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8d627d3b319fb0110e2e8f018202b8f231d56411;p=thirdparty%2Fbinutils-gdb.git 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 --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 # "# " 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