]> git.ipfire.org Git - thirdparty/gcc.git/commit
mingw: Ensure symbols are quoted in Intel syntax
authorLIU Hao <lh_mouse@126.com>
Fri, 8 May 2026 13:02:23 +0000 (21:02 +0800)
committerJonathan Yong <10walls@gmail.com>
Mon, 11 May 2026 11:33:46 +0000 (11:33 +0000)
commite06a4a3bedb86b6866da851f256ecf1f072ecf2c
treed098ed56add22247ad037a92ca2e92159060bfec
parent0646376b3e340ef1a0a55d143e38410f75f81276
mingw: Ensure symbols are quoted in Intel syntax

Previously, this code

   extern int shl;
   int get_shl(void) { return shl; }

gave errors like

   $ x86_64-w64-mingw32-gcc -masm=intel test.c
   ccUSyr0f.s: Assembler messages:
   ccUSyr0f.s:24: Error: invalid use of operator "shl"

because it contained

   .refptr.shl:
       .quad   shl

This `shl` should have referenced the symbol, but it appeared in an expression
context, where, in Intel syntax, it got interpreted as the shift-left operator.

This commit fixes the issue by emitting the target symbol with
`ASM_OUTPUT_LABELREF`, which will quote it properly with regard to the output
assembler syntax.

PR target/53929

gcc/ChangeLog:

* config/mingw/winnt.cc (mingw_pe_file_end): Use `ASM_OUTPUT_LABELREF`
to emit `name`.

Signed-off-by: LIU Hao <lh_mouse@126.com>
Signed-off-by: Jonathan Yong <10walls@gmail.com>
gcc/config/mingw/winnt.cc