我需要使用哪些编译标志来获取此`file`输出?

时间:2019-06-20 05:14:54

标签: c gcc mips embedded-linux mips32

我想编译一些代码以在具有MIPS架构的嵌入式Linux上运行。但是我无法让我的MIPS交叉编译器(mips-linux-gnu-gcc)正确地编译hello-world文件。我的意思是,它在编译时没有错误。它只是不能在我的嵌入式设备上运行。

我从设备上下载了一个示例可执行文件(显然可以正常运行)并运行file,这是我得到的输出:

ELF 32-bit MSB executable, MIPS, MIPS-I version 1 (SYSV), dynamically linked, interpreter /lib/ld-, stripped

但是当我用...编译代码时

mips-linux-gnu-gcc main.c

file在我的编译文件中的结果是:

ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, interpreter /lib/ld., for GNU/Linux 3.2.0, BuildID[sha1]=..., not stripped

我尝试将-mips1 -mfp32添加到编译命令中,但输出仍然不是我想要的:

ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, interpreter /lib/ld., for GNU/Linux 3.2.0, BuildID[sha1]=..., not stripped

我需要使用哪些标志来使编译器正确地编译程序?还是我需要一个完全不同的编译器? 我怀疑这只是标志,但我不知道哪个。我怀疑问题出在我得到的是MIPS32而不是MIPS-I。

0 个答案:

没有答案