I am trying to write a simple assembly program with GNU assembler (as) in MAC OS. Part of the program looks like the following:
.intel_syntax noprefix
.globl _main
.text
...
mov rdx, len
syscall
...
.data
message: .asciz "this is a message!\n"
len = . - message
After assembly and link, the executable code viewed in the debugger is:
movq 0x14, %rdx
syscall
But what I really want is movq $0x14, %rdx
instead of movq 0x14, %rdx
I tried to put the .data
section before the .text
section but still getting the same result.
How can I get the correct immediate mode with intel syntax?