I found an example and was editing it for gas.
extern printf .global _start .data hello: db "Hello", 0xa, 0 .text _start: mov %rdi, hello mov %rax, 0 call printf mov %rax, 0 ret But it doesn't work. What's wrong? What does this mean:
hello: db "Hello", 0xa, 0 I understand what it scope of memory, but I don't understand this string
db "Hello", 0xa, 0 And here
_start: mov %rdi, hello mov %rax, 0 call printf mov %rax, 0 ret os: linux (debian). intel 64-bit
dbis a NASM directive. In GAS you want.asciiz "Hello\n". Also, AT&T syntax ismov $0, %eax, with the destination last.