RFC: Formalization of the Intel assembly syntax (PR53929)

LIU Hao lh_mouse@126.com
Fri Jan 19 01:42:48 GMT 2024


在 2024-01-18 17:02, Fangrui Song 写道:
> Thanks for the proposal. I hope that -masm=intel becomes more useful:)
> 
> Do you have a list of assembly in the unambiguous cases that fail to
> be parsed today as a gas PR?
> For example,

Not really. Most of these are results from high-level languages. For example:

    # Expected: `movl shr(%rip), %eax`
    # Actual: error: invalid use of operator "shr"
    mov eax, DWORD PTR shr[rip]

    # Expected: `movl dword(%rip), %eax`
    # Actual: accepted as `movl 4(%rip), %eax`
    mov eax, DWORD ptr dword[rip]


In addition, `as -msyntax=intel -mnaked-reg` doesn't seem to be equivalent to `.intel_syntax noprefix`:

    $ as -msyntax=intel -mnaked-reg <<< 'mov eax, DWORD PTR gs:0x48' -o a.o
    {standard input}: Assembler messages:
    {standard input}:1: Error: invalid use of register

    $ as <<< '.intel_syntax noprefix;  mov eax, DWORD PTR gs:0x48' -o a.o && objdump -Mintel -d a.o
    ...
    0000000000000000 <.text>:
       0:	65 8b 04 25 48 00 00 	mov    eax,DWORD PTR gs:0x48



-- 
Best regards,
LIU Hao

-------------- 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://gcc.gnu.org/pipermail/gcc/attachments/20240119/40802bf6/attachment-0001.sig>


More information about the Gcc mailing list