在C到MIPS程序集中编译代码

我写了一个C程序,我需要在MIPS汇编代码中看到它。

如何安装或运行将* .c文件作为* .txt或* .something_else以查看其MIPS汇编代码的软件?

我的操作系统是Linux。

非常感谢 !!

BTW我的代码是:

#include  #include  #include  #define SIZE 128 int main () { char mychar , string [SIZE]; int i; int count =0 ; printf ("Please enter your string: \n\n"); fgets (string, SIZE, stdin); printf ("Please enter char to find: "); mychar = getchar(); for (i=0 ; string[i] != '\0' ; i++ ) if ( string[i] == mychar ) count++; printf ("The char %c appears %d times\n" ,mychar ,count); return 0; } 

你想要的是一个MIPS交叉编译器,除非你在MIPS盒子上运行Linux,在这种情况下你需要一个常规的MIPS编译器。 以下是在Linux上设置交叉编译器的方法。

编译完成后,您将希望看到MIPS反汇编。 objdump可以帮助你。

您需要安装MIPS交叉编译库,然后需要将-S-march=mips*选项之一传递给gcc。

您可以使用Dan Kegels优秀且易于使用的交叉工具来编译您自己的MIPS交叉编译器。