ARM 컴파일 오류, 개체 파일이 아닌 실행 파일에서 사용되는 VFP 등록
나는 지난 며칠 동안이 문제를 겪어 왔으며 여기에서 실제로 일어나는 일이나 문제가 무엇인지에 대해 머리를 알 수 없습니다.
다음 플래그가있는 메이크 파일이 있습니다.
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 파일에 라이브러리가 있으며 실행 파일과 연결하기 만하면됩니다. 나는 프로토 타입과 그 모든 것을 알고 있으며 불평하는 유일한 것은 다음과 같습니다.
/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를 사용하지 않으면 부동 소수점 레지스터와 관련된 또 다른 오류가 발생합니다.
누구든지이 문제의 원인이 무엇인지, 내 실행 파일이 가상 부동 소수점 레지스터 인수를 사용하지 않도록 만드는 등이 문제를 해결하기 위해 무엇을 할 수 있는지 알고 있습니까?
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를 사용하고 있음을 나타냅니다 .
컴파일러가 multilib를 사용하도록 설정 한 경우 (으로 알 수 있음 -print-multi-lib
)을 사용할 수 -mfloat-abi=softfp
있지만 그렇지 않은 경우 해당 옵션이 도움이되지 않습니다. gcc는 기꺼이 softfp 코드를 생성하지만 연결할 호환 가능한 libgcc가 없습니다.
기본적으로 hardfp와 softfp는 호환되지 않습니다. 전체 시스템을 어떤 방식 으로든 구성해야합니다.
편집 : 일부 배포판은 "다중 아치"이거나 그럴 것입니다. 그중 하나가 있으면 두 ABI를 한 번 에 설치할 수 있지만 모든 것을 두 배로 늘려서 수행됩니다. 호환성 문제는 여전히 존재합니다.
glibc binutils와 gcc가 크로스 컴파일 된 arm hardfloat 시스템에서 gcc를 사용하면 동일한 오류가 발생합니다.
-mfloat-abi=hard
플래그 로 내 보내면 해결 된 다음 gcc가 오류없이 컴파일됩니다.
또한과 같은 여러 플래그를 추가하여 오류를 해결할 수 있습니다 -marm -mthumb-interwork
. 이 같은 오류를 피하는 것이 도움이되었습니다.
이것은 추측에 불과하지만 링크 단계에 대한 일부 또는 모든 부동 소수점 관련 스위치를 제공해야 할 수도 있습니다.
STM32F4에서 ARM 용 Atollic을 사용하여 문제가 발생했습니다 (FPU가있는 모든 STM32에 적용되는 것 같습니다).
SW 부동 소수점을 사용하는 것이 저에게 잘 작동하지 않았습니다 (따라서 올바르게 컴파일 됨).
STM32cubeMX가 TrueStudio (Atollic) 용 코드를 생성 할 때 C / C ++ 빌드 설정에서 FPU 단위를 설정하지 않습니다 (다른 IDE 용으로 생성 된 코드에 대해 확실하지 않음).
프로젝트 속성 빌드 설정 아래에 있는 "대상" 에서 FPU를 설정합니다.
- 어셈블러
- C 컴파일러
- C 링커
그런 다음 HW / SW fp를 혼합하거나 HW를 사용할 수 있습니다.
생성 된 명령 줄은 의도 한 대상에 대해 다음과 함께 추가됩니다.
-mfloat-abi=hard -mfpu=fpv4-sp-d16
링크에도 동일한 컴파일러 옵션을 사용하십시오.
예:
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
제 경우 CFLAGS = -O0 -g -Wall -I. -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=soft
에는 도움이되었습니다. 보시다시피 stm32f407에 사용했습니다.
나는 같은 문제에 직면했다. Cyclone V FPGA-SoC 용 Linux 애플리케이션을 구축하려고했습니다. 다음과 같은 문제에 직면했습니다.
Error: <application_name> uses VFP register arguments, main.o does not
I was using the toolchain arm-linux-gnueabihf-g++
provided by embedded software design tool of altera.
It is solved by exporting: mfloat-abi=hard
to flags, then arm-linux-gnueabihf-g++
compiles without errors. Also include the flags in both CC
& LD
.
In my particular case -g -march=armv7-a -mfloat-abi=hard -mfpu=neon -marm -mthumb-interwork
worked.
This answer may appear at the surface to be unrelated, but there is an indirect cause of this error message.
First, the "Uses VFP register..." error message is directly caused from mixing mfloat-abi=soft and mfloat-abi=hard options within your build. This setting must be consistent for all objects that are to be linked. This fact is well covered in the other answers to this question.
The indirect cause of this error may be due to the Eclipse editor getting confused by a self-inflicted error in the project's ".cproject" file. The Eclipse editor frequently reswizzles file links and sometimes it breaks itself when you make changes to your directory structures or file locations. This can also affect the path settings to your gcc compiler - and only for a subset of your project's files. While I'm not yet sure of exactly what causes this failure, replacing the .cproject file with a backup copy corrected this problem for me. In my case I noticed .java.null.pointer errors after adding an include directory path and started receiving the "VFP register error" messages out of the blue. In the build log I noticed that a different path to the gcc compiler was being used for some of my sources that were local to the workspace, but not all of them!? The two gcc compilers were using different float settings for unknown reasons - hence the VFP register error.
I compared the .cproject settings with a older copy and observed differences in entries for the sources causing the trouble - even though the overriding of project settings was disabled. By replacing the .cproject file with the old version the problem went away, and I'm leaving this answer as a reminder of what happened.
'developer tip' 카테고리의 다른 글
C # : 모든 스레드가 완료 될 때까지 대기 (0) | 2020.11.25 |
---|---|
나중에 열 수 있도록 Eclipse에 탭 그룹을 저장할 수 있습니까? (0) | 2020.11.25 |
Keras : 커널과 활동 정규화의 차이점 (0) | 2020.11.25 |
두 파일을 한 줄씩 일관되게 병합하는 방법 (0) | 2020.11.24 |
ModelState.IsValid가 아니어야 할 때에도? (0) | 2020.11.24 |