Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22022

ARM cross-compilation, "VFP registered used by x.out, not y.o" issue on Linux but not on Windows

$
0
0

I am cross-compiling a project for an ARM Cortex-M4F target. I have been cross-compiling this project successfully for months on a Windows 7 PC and I have now to be able to cross-compile it also from a Linux environment (running in a virtual machine inside the Windows environment). The build is done with the exact same portable Makefile so the compiler and linker calls are exactly the same, except for the paths.

While everything goes well on Windows, I have a bunch of errors on Linux (Ubuntu 18.04 (Bionic Beaver)) when the linker is called (compilation of all files goes well):

/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o: Conflicting CPU architectures 13/1

/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o

myProgram.out uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-nano-vfprintf_i.o) does not [And more like this...]

I've read the question & answers of ARM compilation error, VFP registered used by executable, not object file as well as How to (cross-)compile to both ARM hard- and soft-float (softfp) with a single GCC (cross-)compiler? and although they were really helpful to understand one part of the problem, none of them led me to a solution.

On both OSes I am using arm-none-eabi-gcc V6.3.1:

Windows 7 64-bit

gcc version 6.3.1 20170215 (release) [ARM/embedded-6-branch revision 245512] (GNU Tools for ARM Embedded Processors 6-2017-q1-update)

Ubuntu 18.04

gcc version 6.3.1 20170620 (15:6.3.1+svn253039-1build1)

And both seem to have similar multi-lib:

Windows 7 64-bit

.;
thumb;@mthumb
hard;@mfloat-abi=hard
thumb/v6-m;@mthumb@march=armv6s-m
thumb/v7-m;@mthumb@march=armv7-m
thumb/v7e-m;@mthumb@march=armv7e-m
thumb/v7-ar;@mthumb@march=armv7
thumb/v8-m.base;@mthumb@march=armv8-m.base
thumb/v8-m.main;@mthumb@march=armv8-m.main
thumb/v7e-m/fpv4-sp/softfp;@mthumb@march=armv7e-m@mfpu=fpv4-sp-d16@mfloat-abi=softfp
thumb/v7e-m/fpv4-sp/hard;@mthumb@march=armv7e-m@mfpu=fpv4-sp-d16@mfloat-abi=hard
thumb/v7e-m/fpv5-sp/softfp;@mthumb@march=armv7e-m@mfpu=fpv5-sp-d16@mfloat-abi=softfp
thumb/v7e-m/fpv5-sp/hard;@mthumb@march=armv7e-m@mfpu=fpv5-sp-d16@mfloat-abi=hard
thumb/v7e-m/fpv5/softfp;@mthumb@march=armv7e-m@mfpu=fpv5-d16@mfloat-abi=softfp
thumb/v7e-m/fpv5/hard;@mthumb@march=armv7e-m@mfpu=fpv5-d16@mfloat-abi=hard
thumb/v7-ar/fpv3/softfp;@mthumb@march=armv7@mfpu=vfpv3-d16@mfloat-abi=softfp
thumb/v7-ar/fpv3/hard;@mthumb@march=armv7@mfpu=vfpv3-d16@mfloat-abi=hard
thumb/v8-m.main/fpv5-sp/softfp;@mthumb@march=armv8-m.main@mfpu=fpv5-sp-d16@mfloat-abi=softfp
thumb/v8-m.main/fpv5-sp/hard;@mthumb@march=armv8-m.main@mfpu=fpv5-sp-d16@mfloat-abi=hard
thumb/v8-m.main/fpv5/softfp;@mthumb@march=armv8-m.main@mfpu=fpv5-d16@mfloat-abi=softfp
thumb/v8-m.main/fpv5/hard;@mthumb@march=armv8-m.main@mfpu=fpv5-d16@mfloat-abi=hard

Ubuntu 18.04

.; thumb;@mthumb
hard;@mfloat-abi=hard
thumb/v6-m;@mthumb@march=armv6s-m
thumb/v7-m;@mthumb@march=armv7-m
thumb/v7e-m;@mthumb@march=armv7e-m
thumb/v7-ar;@mthumb@march=armv7
thumb/v7e-m/fpv4-sp/softfp;@mthumb@march=armv7e-m@mfpu=fpv4-sp-d16@mfloat-abi=softfp
thumb/v7e-m/fpv4-sp/hard;@mthumb@march=armv7e-m@mfpu=fpv4-sp-d16@mfloat-abi=hard
thumb/v7e-m/fpv5/softfp;@mthumb@march=armv7e-m@mfpu=fpv5-d16@mfloat-abi=softfp
thumb/v7e-m/fpv5/hard;@mthumb@march=armv7e-m@mfpu=fpv5-d16@mfloat-abi=hard
thumb/v7-ar/fpv3/softfp;@mthumb@march=armv7@mfpu=vfpv3-d16@mfloat-abi=softfp
thumb/v7-ar/fpv3/hard;@mthumb@march=armv7@mfpu=vfpv3-d16@mfloat-abi=hard
thumb/v7-ar/fpv3/hard/be;@mthumb@march=armv7@mfpu=vfpv3-d16@mfloat-abi=hard@mbig-endian

From what I've read here and there it's very important to specify if we want hard or soft float implementation. I want to use the hardware, so every gcc call (assembly compiler, C compiler, linker) has those two flags:

-mfloat-abi=hard -mfpu=fpv4-sp-d16

Here are the other compiler flags:

-ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin --short-enums -MP -MD

And linker flags:

-Xlinker -mthumb -mabi=aapcs -mcpu=cortex-m4 -lrdimon -u _printf_float --specs=nano.specs -lc -lnosys -Wl,--gc-sections

I simply don't see here what could be the cause of those error messages since the implementation is specified every time. The only hypothesis I have is that some libraries (like lib_a-nano that we see in the error) are built for a soft implementation. But let's say this is the issue, how do I use the same library built for the hard implementation?


Viewing all articles
Browse latest Browse all 22022

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>