I am trying to assemble a simple Hello World program with the GNU assembler (as) on a Raspberry Pi 3 B+ running NetBSD 9.1
What flags do I need to add to as or ld to make them assemble the code correctly for the architecture I am using?
$ as -o hllwrld.o hllwrld.s
$ ld -o hllwrld hllwrld.o
$ ./hllwrld
-sh: Cannot execute ELF binary ./hllwrld
$ uname -a
NetBSD rpi 9.1 NetBSD 9.1 (RPI) #0: Sun Oct 18 19:24:30 UTC 2020 [email protected]:/usr/src/sys/arch/evbarm/compile/RPI evbarm
Is this aarch64 or arm64?
I know there are man pages but I am just learning assembly so I have no idea what configurations/flags/arguments I even need to be looking for.
Thanks for any help.
This may be failing for a number of reasons, all of which come down to missing arguments and/or flags to ld and may include runtime linker information, startup code, and libraries.
Give this a try for a hint and see what's happing behind the scenes: