如何在 gnu 汇编器中为 MIPS cpu 进行汇编

发布于 2025-01-16 19:51:46 字数 420 浏览 3 评论 0原文

我正在学习 MIPS 汇编,并且想使用 asgas 命令来汇编 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

擦肩而过的背影 2025-01-23 19:51:46

您是否有针对 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 the arm-none-eabi-binutils package on my Arch Linux system. You'd need something similar, or configure and build Binutils from source yourself, to get a mips-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 with as --32 because Binutils considers amd64 and i386 as different versions of the same ISA).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文