I'm trying to call printf in nasm 64 bit linux. But it outputs segmentation fault when i run it. I alligned the stack, add a 0 escape character to the end of the string. But it still output segfault.
The code:
section .data
_DATA1 db "aa", 0
section .text
global main
extern printf
main:
sub rsp, 16
lea r13, [_DATA1]
mov rdi, r13
call printf
add rsp, 16
mov rax, 0
ret
assemble and link with
nasm -f elf64 a.asm
gcc -no-pie a.o
Where did i do something wrong?