如何在 gnu 汇编器中为 MIPS cpu 进行汇编
我正在学习 MIPS 汇编,并且想使用 as
或 gas
命令来汇编 MIPS 汇编
查看 手册页 我尝试使用
as -mips32 myfile.asm
但它说这是一个无法识别的选项
我也尝试使用
as -march=r3000 myfile.asm
但也不起作用它说
汇编器消息:致命错误:无效 -march= 选项:`r3000'
那么,如何使用 gnu 汇编器来汇编 MIPS 程序集
I learning MIPS assembly and I want to assemble a MIPS assembly using as
or gas
command
Looking at the manual page
I tried to assemble using
as -mips32 myfile.asm
But it said it is an unrecognized option
I also tried to use
as -march=r3000 myfile.asm
but that also didn't work it said
Assembler messages: Fatal error: invalid -march= option: `r3000'
So, how do you assemble MIPS assembly using the gnu assembler
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否有针对 MIPS 构建的 GNU Binutils 版本?它不像 clang 那样可以使用 clang -target mips -march=mips1 -c foo.s &&
llvm-objdump -d foo.o
(MIPS1 包括 R2000 和 R3000)。例如,要在 x86-64 桌面上运行适用于 ARM 的 GAS,我可以运行
arm-none-eabi-as
,因为我安装了arm-none-eabi-binutils
我的 Arch Linux 系统上的软件包。您需要类似的东西,或者自己从源代码配置和构建 Binutils,以获得可以运行的mips-something-something-as
可执行文件。只是简单的
as
(/usr/bin/as
) 将成为您系统的本机汇编器,因此如果您使用的是 x86-64,则 x86-64 不支持对于其他 ISA。 (as --32
的 i386 除外,因为 Binutils 将 amd64 和 i386 视为同一 ISA 的不同版本)。Do you have a version of GNU Binutils built to target MIPS? It's not like clang where you can use
clang -target mips -march=mips1 -c foo.s
&&llvm-objdump -d foo.o
(MIPS1 includes R2000 and R3000).For example, to run GAS for ARM on my x86-64 desktop, I can run
arm-none-eabi-as
since I installed thearm-none-eabi-binutils
package on my Arch Linux system. You'd need something similar, or configure and build Binutils from source yourself, to get amips-something-something-as
executable you could run.Just plain
as
(/usr/bin/as
) will be a native assembler for your system, so x86-64 if you're on x86-64, with no support for other ISAs. (Except for i386 withas --32
because Binutils considers amd64 and i386 as different versions of the same ISA).