In AT&T syntax, mov $message, %rdi
, the $
means immediate, meaning the address of message.
In GAS's Intel syntax, mov rdi, message
means absolute addressing, meaning the content at message. To get the actual address of message, you need to supply the offset
keyword: mov rdi, offset message
.
Disassebly of the two binaries shows the difference:
AT&T:
0000000000000000 <main>:
0: 48 c7 c7 00 00 00 00 mov $0x0,%rdi
Intel:
0000000000000000 <main>:
0: 48 8b 3c 25 00 00 00 00 mov 0x0,%rdi