ARM compilation error, VPF registered used by executable, not object file
2016-04-22 10:03
1456 查看
http://stackoverflow.com/questions/9753749/arm-compilation-error-vpf-registered-used-by-executable-not-object-file 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 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* 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 gcc compilation arm
| |||||||||||||
a comment |
6 Answers
activeoldestvotesup vote25down voteaccepted | 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 usingsoft-float ABI. 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. Basically, hardfp and softfp are just not compatible. You need to get your whole system configured one way or the other. EDIT: some distros are, or will be, "multiarch". If you have one of those then it's possible to install bothABIs at once, but that's done by doubling everything up -- the compatibility issues still exist.
| ||||||||
a comment |
up vote9down vote | I have found on an arm hardfloat system where glibc binutils and gcc were crosscompiled, using gcc gives the same error. It is solved by exporting -mfloat-abi=hardto flags, then gcc compiles without errors.
| ||
add a comment |
up vote4down vote | Also the error can be solved by adding several flags, like -marm -mthumb-interwork. It was helpful for me to avoid this same error.
| |||
add a comment |
up vote1down vote | This is guesswork, but you may need to supply some or all of the floating point related switches for the link stage as well.
| ||
add a comment |
up vote1down vote | In my case CFLAGS = -O0 -g -Wall -I. -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softhas helped. As you can see, i used it for my stm32f407.
| ||
add a comment |
up vote0down vote | Use the same compiler options for linking also. Example: gcc -mfloat-abi=hard fpu=neon -c -o test.cpp test.o gcc -mfloat-abi=hard fpu=neon -c test1.cpp test1.o gcc test.o test1.o mfloat-abi=hard fpu=neon HardTest |
相关文章推荐
- 【Objective-C】07-自定义构造方法和description方法
- 浅析Objective-C的程序结构及面向对象的编程方式
- object detection
- Spark 基础 —— 类与伴生对象(companion object)
- object c NSNotificationCenter 通知中心
- Objective-C 单例模式
- 关于Python的Object继承
- Java 重写与重载区别 Java父类的Object方法 要重写tostring原因,多个catch处理逻辑
- Objective-序列帧动画一般使用步骤:
- Js中 json object 和 string 互相转换
- Objective-C 判断两个矩形是否相交
- Objective-C学习笔记(三)——用Objective-C编写第一个程序:Hello,World!
- 当需要对一个list<Map<String,Object>>中的map添加一个相同的数据是可以参考
- javascript里面的object详解
- Objective-C,Modules
- model.object对象查询过滤、增删改、Q
- javascript的window.ActiveXObject对象,区别浏览器的方法
- Objective-C语法之代码块(block)的使用
- js如何打印object对象
- 逆向工程Eclipse插件ObjectAid的安装方法