Integrated as: Differing behaviour in intel and at&t syntax modes (original) (raw)

January 23, 2023, 4:24pm 1

Trying to port nasm assembly I encountered some discrepancy in the two syntax modes. Here’s a short reproducer.

# This works.
.att_syntax prefix
    .set reg, %rax
    xor reg, reg	# xor %rax, %rax

# This doesn't, although it works with GNU as.
.intel_syntax noprefix
    .set reg, rax
    xor reg, reg

# reg.s:11:2: error: invalid operand for instruction
#        xor reg, reg
#        ^

I’m aware that the reproducer is kinda misusing symbols, but it comes in handy for macros. In my case it is crucial for porting the nasm assembly.

So my question, is the above behavior intentional or a flaw? Any ideas how to work around it?

Morell February 4, 2023, 1:36am 2

Never mind, I’ve bitten the bullet and translated each and every loc to att syntax (no fun). I may open a github issue later.