I have been following this tutorial and have got stuck at the following code: leaq str(%rip), %rdi
.
My full assembly code is the following:
.data
.text
.globl _main
_main:
pushq %rbp
movq %rsp, %rbp
subq $32, %rsp
leaq str(%rip), %rdi
callq _printf
And my Makefile:
build:
as main.s -o main.o
ld main.o -e _main -lc -macosx_version_min 10.13 -arch x86_64 -o main
run: build
./main
And finally the output of the command make build
:
as main.s -o main.o
ld main.o -e _main -lc -macosx_version_min 10.13 -arch x86_64 -o main
Undefined symbols for architecture x86_64:
"str", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
make: *** [build] Error 1
How am I able to link the str
command for use in macOS assembly?