C / C ++到MIPS组装 [英] C/C++ to MIPS Assembly

查看:211
本文介绍了C / C ++到MIPS组装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道要编译到汇编,我应该使用 -S 选项与 gcc g ++ ,但是如何获得MIPS程序集?

I know that to compile to assembly, I should use the -Soption with gcc or g++, but how do I get MIPS assembly?

我尝试了

g++ -march=mips2 dll.c 

给出错误

dll.c:1:0: error: bad value (mips2) for -march= switch

我看到一个建议是编译命令 mips_gcc 我找不到如何安装该编译器。

I saw a suggestion of the compile command mips_gcc, but I can't find how to install that compiler.

我使用Ubuntu 64位,如果这有帮助。

I'm using Ubuntu 64-bit, if that helps.

推荐答案

您需要一个版本的gcc,该版本构建为MIPS 交叉编译器< a>。您可以从此处。此工具链适用于Windows和Linux。

You need a version of gcc that is built as a MIPS cross compiler. You can download the free Mentor/Codesourcery MIPS gnu/gcc cross compilation tool chain from here. This toolchain is available for both Windows and Linux.

下载,安装并添加工具链到您的路径后,您会说:

After downloading, installing and adding the tool chain to your path you would say:

mips-linux-gnu-g++ -march=mips32r2 -S dll.c

将您的代码编译为MIPS32R2程序集。

to compile your code to MIPS32R2 assembly.

这篇关于C / C ++到MIPS组装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆