1

I need to cross compile c++ code for an embedded device with the specs shown below with hardware float operations support. Cross compiling from Ubuntu 20.04 without hardware float support is easy, i can just run arm-linux-gnueabi-g++ -marm -mcpu=arm926ej-s -mfloat-abi=soft -mfpu=vfp and it will work. When running with -mfloat-abi=hard I get:

/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: error: ArmSimulateStartStop uses VFP register arguments, /usr/lib/gcc-cross/arm-linux-gnueabi/9/crtbegin.o does not
/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc-cross/arm-linux-gnueabi/9/crtbegin.o
/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: error: ArmSimulateStartStop uses VFP register arguments, /usr/lib/gcc-cross/arm-linux-gnueabi/9/crtend.o does not
/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc-cross/arm-linux-gnueabi/9/crtend.o
collect2: error: ld returned 1 exit status
make: *** [Makefile:12: CrossCompile] Error 1

I know this processor supports hardware float support, it says in the arm documentation. I downloaded buildroot and crosstool but I don't know how to configure them right for my device hardware. How can I cross compile with VFP support?

Device specs:

~ $ cat /proc/cpuinfo 
Processor       : ARM926EJ-S rev 5 (v5l) 
BogoMIPS        : 197.83 
Features        : swp half thumb fastmult edsp java 
CPU implementer : 0x41 
CPU architecture: 5TEJ 
CPU variant     : 0x0 
CPU part        : 0x926 
CPU revision    : 5

~ $ cat /proc/version 
Linux version 2.6.36 (owzafs@PCOWZAFS) (gcc version 4.4.1 (Sourcery G++ Lite 2010q1-202) ) #464 PREEMPT Thu Apr 19 13:50:56 CEST 2018 

Edit: According to GCC doc: Using -mfloat-abi=hard with VFP coprocessors is not supported. Use -mfloat-abi=softfp with the appropriate -mfpu option to allow the compiler to generate code that makes use of the hardware floating-point capabilities for these CPUs.

I used mfloat-abi=softfp and the code compiles, however, when running the binary on the device, I get Illegal instruction (and nothing else).

1

Looks like the objects crtbegin.o and crtend.o do not match with the main line build.

I feel that the best method is to recompile crtbegin.s and crtend.s needs to be recompiled with the same setting -mfloat-abi=hard, create the seperate crtbegin.o and crtend.o and retry.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.