I am trying to create a simple program in nasm that should display the letter a
. however, It is giving me a Segfault and saying this:
./a.out: Symbol `printf' causes overflow in R_X86_64_PC32 relocation
Segmentation fault (core dumped)
Basically, I am trying to move the value 0x61
(hex for letter a) into memory address 1234, and then pass that as an argument to printf. Here is my exact code:
extern printf
section .text
global main
main:
push rbp
mov rax,0
mov qword [1234], 0x61 ; move 0x61 into address 1234
mov rdi, qword [1234] ; mov address 1234 into rdi
call printf ; should print the letter a
pop rbp
mov rax,0
ret
I am running Linux x86_64