Jim*_*Jim 63 gcc arm compilation
我最近几天一直遇到这个问题而且我无法理解这里真正发生的事情,或者问题是什么.
我有一个带有这些标志的makefile:
CC = arm-linux-gnueabihf-gcc-4.6
FLAGS = -O3 -march=armv7-a -mtune=cortex-a9 -mfpu=neon -ftree-vectorize -mfloat-abi=softfp -std=gnu99
Run Code Online (Sandbox Code Playgroud)
我在.a文件中有一个库,它有一些目标文件,我需要做的就是用可执行文件链接它们.我知道原型和所有这些,唯一抱怨的是以下内容:
/usr/bin/ld: error: *EXECUTABLE* uses VFP register arguments, *OBJECTFILE* does not
/usr/bin/ld: failed to merge target specific data of file *OBJECTFILE*
Run Code Online (Sandbox Code Playgroud)
当我不使用-mfloat-abi = softfp时,我得到另一个与浮点寄存器有关的错误.
有没有人知道造成这种情况的原因,以及我可以做些什么来解决这个问题,例如让我的可执行文件不使用虚拟浮点寄存器参数?
x@x:~/Desktop/perf_test$ make
arm-linux-gnueabihf-gcc-4.6 -c -O3 -march=armv7-a -mtune=cortex-a9 -mfpu=neon -ftree-vectorize -std=gnu99 -mfloat-abi=softfp perf_test.c ../baseline/util.c
arm-linux-gnueabihf-gcc-4.6 -o perf_test perf_test.o util.o ../baseline/lib.a
/usr/bin/ld: error: perf_test uses VFP register arguments, perf_test.o does not
/usr/bin/ld: failed to merge target specific data of file perf_test.o
/usr/bin/ld: error: perf_test uses VFP register arguments, util.o does not
/usr/bin/ld: failed to merge target specific data of file util.o
/usr/bin/ld: error: perf_test uses VFP register arguments, ../baseline/lib.a(a.o) does not
/usr/bin/ld: failed to merge target specific data of file ../baseline/lib.a(a.o)
/usr/bin/ld: error: perf_test uses VFP register arguments, ../baseline/lib.a(b.o) does not
/usr/bin/ld: failed to merge target specific data of file ../baseline/lib.a(b.o)
/usr/bin/ld: error: perf_test uses VFP register arguments, ../baseline/lib.a(c.o) does not
/usr/bin/ld: failed to merge target specific data of file ../baseline/lib.a(c.o)
/usr/bin/ld: error: perf_test uses VFP register arguments, ../baseline/lib.a(d.o) does not
/usr/bin/ld: failed to merge target specific data of file ../baseline/lib.a(d.o)
/usr/bin/ld: error: perf_test uses VFP register arguments, ../baseline/lib.a(e.o) does not
/usr/bin/ld: failed to merge target specific data of file ../baseline/lib.a(e.o)
/usr/bin/ld: error: perf_test uses VFP register arguments, ../baseline/lib.a(f.o) does not
/usr/bin/ld: failed to merge target specific data of file ../baseline/lib.a(f.o)
collect2: ld returned 1 exit status
make: *** [perf_test] Error 1
Run Code Online (Sandbox Code Playgroud)
ams*_*ams 49
您的目标三元组表示您的编译器已配置为硬浮动 ABI.这意味着libgcc库也将是hardfp.错误消息表明您的系统的至少一部分正在使用软浮动 ABI.
如果编译器启用了multilib(你可以告诉-print-multi-lib),那么你可以使用-mfloat-abi=softfp,但如果没有那么那个选项对你没有多大帮助:gcc会愉快地生成softfp代码,但是那时就没有兼容的libgcc来链接.
基本上,hardfp和softfp是不兼容的.您需要以某种方式配置整个系统.
编辑:一些发行版是或将是"multiarch".如果您有其中一个,那么可以同时安装两个 ABI,但这是通过将所有内容加倍来完成的 - 兼容性问题仍然存在.
白い熊*_*白い熊 14
我发现在一个arm hardfloat系统中glibc binutils和gcc被交叉编译,使用gcc给出了同样的错误.
它通过导出-mfloat-abi=hard到标志来解决,然后gcc编译没有错误.