I am trying to test a simple Hello World program on my Raspberry Zero running NetBSD 9.1 with the GNU assembler. I am not actually sure if it is Arm64 or Armv7 or if there is a difference or if that matters.
Here is my code:
Code:
$ cat hllwrld.s
.global _start
_start: mov r0, #1
ldr r1, =helloworld
mov r2, #13
mov r8, #64
svc 0
mov r0, #0
mov r8, #93
svc 0
.data
helloworld: .ascii "Hello World!\n"
Code:
$ as -o hllwrld.o hllwrld.s
$ ld -o hllwrld hllwrld.o
$ ./hllwrld
-sh: Cannot execute ELF binary ./hllwrld
Could someone tell me what arguments I need to add to ether as or ld or could you point me in the right direction.
Also in case this is relevant:
Code:
NetBSD rpi 9.1 NetBSD 9.1 (RPI) #0: Sun Oct 18 19:24:30 UTC 2020 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/RPI evbarm
Thanks.