I am trying to dive into some x86 assembly programming on my Mac, but am having trouble producing an executable. The problem seems to be at the linking stage.
helloWorld.s:
.data
HelloWorldString:
.ascii "Hello World\n"
.text
.globl _start
_start:
# load all the arguments for write()
movl $4, %eax
movl $1, %ebx
movl $HelloWorldString, %ecx
movl $12, %edx
# raises software interrupt to call write()
int $0x80
# call exit()
movl $1, %eax
movl $0, %ebx
int $0x80
Assemble the program:
as -o helloWorld.o helloWorld.s
Link the object file:
ld -o helloWorld helloWorld.o
The error I get at this point is:
ld: could not find entry point "start" (perhaps missing crt1.o) for inferred architecture x86_64
Any advice on what I'm doing wrong / missing would be very helpful. thanks
_start
tostart
. – sidyll