I am on Mac Os X and I am having trouble compiling a .s ARM assembly file. my .s file is this:
mov r0, r1
just to see if it works.
but when i do
arm-elf-as my.s
i get an
a.out
file.
i do
chmod +x a.out
and
./a.out
but it says
cannot execute binary file
this has me confused, because it should be able to execute if i compiled it with arm-elf-as. How do i go about compiling this .s?
You're assembling it allright, you just can't run it on a Mac since Macs don't have ARM CPUs. If you install Xcode with iOS support, you can compile ARM code:
You won't be able to run anything, because for that you'll need a runtime system and and ARM CPU. You can use
-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk
or similar to compile for the iPhoneOS for example.