本文介绍了ARM编译错误,可执行文件使用的VFP寄存器,而不是目标文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过去几天我一直遇到这个问题,我无法理解这里到底发生了什么,或者问题是什么.

I have been having this problem for the last few days and I can't get my head around what is really happening here, or what is the problem.

我有一个带有这些标志的生成文件:

I have a makefile with these flags:

CC = arm-linux-gnueabihf-gcc-4.6
FLAGS = -O3 -march=armv7-a -mtune=cortex-a9 -mfpu=neon -ftree-vectorize -mfloat-abi=softfp -std=gnu99

我在 .a 文件中有一个库,其中包含一些目标文件,我需要做的就是将它们与我的可执行文件链接起来.我知道原型和所有这些,唯一抱怨的是:

I have a library in a .a file, which has some object files, all I need to do is link them in with my executable. I know the prototypes and all that, the only thing that complains is the following:

/usr/bin/ld: error: *EXECUTABLE* uses VFP register arguments, *OBJECTFILE* does not
/usr/bin/ld: failed to merge target specific data of file *OBJECTFILE*

当我不使用 -mfloat-abi=softfp 时,我收到另一个与浮点寄存器有关的错误.

When I don't use the -mfloat-abi=softfp, I get another error relating to floating point registers.

有谁知道是什么原因造成的,以及我可以做些什么来解决这个问题,例如让我的可执行文件不使用虚拟浮点寄存器参数?

Does anyone have any idea what is causing this, and what I can do to fix this, such as making it so that my executable does not use Virtual Floating Point Register arguments?

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

推荐答案

您的目标三元组表明您的编译器已针对 hard-float ABI 进行了配置.这意味着 libgcc 库也将是 hardfp.该错误消息表明您的系统至少有一部分正在使用 soft-float ABI.

Your target triplet indicates that your compiler is configured for the hard-float ABI. This means that the libgcc library will also be hardfp. The error message indicates that at least part of your system is using soft-float ABI.

如果编译器启用了 multilib(您可以通过 -print-multi-lib 来判断),那么您可以使用 -mfloat-abi=softfp,但如果没有,则该选项对您没有多大帮助:gcc 将愉快地生成 softfp 代码,但随后将没有可链接的兼容 libgcc.

If the compiler has multilib enabled (you can tell with -print-multi-lib) then you can use -mfloat-abi=softfp, but if not then that option won't help you much: gcc will happily generate softfp code, but then there'll be no compatible libgcc to link against.

基本上,hardfp 和 softfp 只是不兼容.您需要以一种或另一种方式配置整个系统.

Basically, hardfp and softfp are just not compatible. You need to get your whole system configured one way or the other.

一些发行版是或将是多架构".如果您有其中之一,则可以同时安装两个 ABI,但这是通过将所有内容加倍来完成的——兼容性问题仍然存在.

some distros are, or will be, "multiarch". If you have one of those then it's possible to install both ABIs at once, but that's done by doubling everything up -- the compatibility issues still exist.

这篇关于ARM编译错误,可执行文件使用的VFP寄存器,而不是目标文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 15:55