在Mac上编译ARM .s文件
我使用的是 Mac Os X,但在编译 .s ARM 汇编文件时遇到问题。 我的 .s 文件是这样的:
mov r0, r1
只是为了看看它是否有效。 但当我这样做时 arm-elf-as my.s
我得到一个 a.out
文件。 我愿意 chmod +x a.out
和 ./a.out
但它说 无法执行二进制文件
这让我很困惑,因为如果我用arm-elf-as编译它,它应该能够执行。我该如何编译这个.s?
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 doarm-elf-as my.s
i get ana.out
file.
i dochmod +x a.out
and./a.out
but it sayscannot 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你已经组装好了,只是不能在 Mac 上运行它,因为 Mac 没有 ARM CPU。如果您安装支持 iOS 的 Xcode,则可以编译 ARM 代码:
您将无法运行任何内容,因为为此您需要一个运行时系统和 ARM CPU。例如,您可以使用 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk 或类似方法为 iPhoneOS 进行编译。
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.