i try to use printf in my asm code but i get Segmentation fault(core dumped)
This is my code :
section .data
msg db "current char is %d", 0x0a, 0x00
section .text
global main
extern printf
main:
push rbp
mov rbp, rsp
push 123
push msg
xor rax,rax
call printf
mov rsp, rbp
pop rbp
mov rax, 1
mov rbx, 0
int 0x80
BTW i use :
nasm elf64 file.asm
Then
gcc file.o
i would love any help or suggestions. thanks.