RFC: Formalization of the Intel assembly syntax (PR53929)

LIU Hao lh_mouse@126.com
Tue Jan 23 01:27:34 GMT 2024


在 2024-01-22 16:39, Jan Beulich 写道:
> Right, I did some work in that direction a while ago. But iirc there are
> still cases left to be addressed.

Attached is a draft patch for GCC, bootstrapped on {i686,x86_64}-w64-mingw32 with GCC 13.2 and 
binutils 2.41.0.

This addresses the issue when a bad name exists in the same translation unit. In the case of an 
external symbol there's still an error:

```
extern int bx;
int get(const char* p) { return p[bx]; }
```

```
lh_mouse@lhmouse-pc ~/Desktop $ x86_64-w64-mingw32-gcc -S -o - -masm=intel test.c | fgrep bx
         mov     rax, QWORD PTR .refptr.bx[rip]
         .section        .rdata$.refptr.bx, "dr"
         .globl  .refptr.bx
.refptr.bx:
         .quad   bx
lh_mouse@lhmouse-pc ~/Desktop $ x86_64-w64-mingw32-gcc  -masm=intel test.c | fgrep bx
C:\Users\lh_mouse\AppData\Local\Temp\ccuyuu6c.s: Assembler messages:
C:\Users\lh_mouse\AppData\Local\Temp\ccuyuu6c.s:29: Error: invalid use of register
C:\Users\lh_mouse\AppData\Local\Temp\ccuyuu6c.s:29: Warning: register value used as expression
lh_mouse@lhmouse-pc ~/Desktop $
```




-- 
Best regards,
LIU Hao

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0401-Always-quote-labels-in-Intel-syntax.patch
Type: text/x-patch
Size: 1325 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20240123/c2ecec9a/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://sourceware.org/pipermail/binutils/attachments/20240123/c2ecec9a/attachment-0001.sig>


More information about the Binutils mailing list