我的目标是一台需要MIPS-I可执行文件的旧路由器,但-mips1生产的是MIPS32可执行文件。
以下是编译命令:
buildroot-2019.02.5/output/host/bin/mips-linux-gcc-7.4.0 -march=mips1 -mtune=mips1 -static ~/helloworld.c -o /tmp/hw.1013 -msoft-float但文件是MIPS32,不是MIPS-I
file /tmp/hw.1013
/tmp/hw.1013: ELF 32-bit MSB executable, MIPS, MIPS32 version 1 (SYSV), statically linked, not stripped较早版本的gcc会生成正确的MIPS-I二进制文件。
./mips-gcc --version
uClibc mips-rawgcc (GCC) 4.1.2
./mips-gcc -march=mips1 -static ~/helloworld.c -o /tmp/hw.1013 -msoft-float
file /tmp/hw.1013
/tmp/hw.1013: ELF 32-bit MSB executable, MIPS, MIPS-I version 1 (SYSV), statically linked, not stripped发布于 2020-02-01 04:24:20
我用Debian buster的gcc 8 mipsel交叉编译器包也遇到了同样的问题。原来是因为标准库是为mips32r2编译的。
实际上,如果您执行gcc -c source.c并查看对象文件readelf -h source.o的elf头中的标志,您可以看到,gcc确实生成了MIPS-I程序集。但是,当链接到较新的ISA库时,ld将使用较新的ISA标记可执行文件。
我怀疑你也有同样的问题,因为buildroot自2014年以来一直没有支持MIPS-I。请向readelf -h查询,例如。您的静态uClibc库。在我的buildroot-2014.11工具链中,它位于output/host/usr/mipsel-buildroot-linux-uclibc/sysroot/usr/lib/libc.a下
https://stackoverflow.com/questions/58222225
复制相似问题