C/C++ 到 MIPS 汇编 [英] C/C++ to MIPS Assembly

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

问题描述

我知道要编译为程序集,我应该将 -S 选项与 gccg++ 一起使用,但是我如何获得 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.

我使用的是 64 位 Ubuntu,如果有帮助的话.

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

推荐答案

您需要一个构建为 MIPS 的 gcc 版本 交叉编译器.您可以从 此处.此工具链适用于 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.

更新 8/2017:Mentor 的站点上似乎不再提供适用于 MIPS 的 Sourcery CodeBench 免费交叉编译器.在 Imagination 的网站.

UPDATE 8/2017: It looks like Sourcery CodeBench free cross compiler for MIPS is no longer available at Mentor's site. Try the free toolchain at Imagination's site.

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

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