I have made a nasm assembly hello world program like this:
global start
section .text
start:
mov rax, 0x20000004
mov rdi, 1
lea rsi, [rel msg]
mov rdx, msg.len
syscall
mov rax, 0x20000001
mov rdi, 0
syscall
section .data
msg: db "Hello, World!", 10
.len: equ $ - msg
Doing nasm -f macho64 print.asm
does fine, but ld -macosx_version_min 10.10 -o print print.o
gives an error like so:
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for inferred architecture x86_64
I have no idea what this means :). Could someone please help me fix this problem? Thanks! P.S. I am using a Mac with OS X Yosemite.