So I have been working with Assembly for a while now and I wanted to try using printf
in assembly.
I looked up how to do it on multiple sites and the gist I got was something along the lines of this:
global main
extern printf
section .data
msg db "Hello, World!", 0x0a, 0x00
section .text
_start:
push ebp
mov ebp, esp
push msg
call printf
mov eax, 0
leave
ret
I then assemble with NASM using:
nasm -f elf32 printing.asm -o printing.o
And link with GCC using:
gcc -m32 printing.o -o printing
And I get this error:
/usr/bin/ld: final link failed: Operation not supported
collect2: error: ld returned 1 exit status
As far as I know the commands were right so how can I fix this error? I did look into it for a bit and found nothing relevant, the only conclusion I can think up is maybe I need to fix some references to ld
?