Check if your crross-compiler GCC toolchain is supporting hard-float

I recently recognized my GCC toolchains are not consistent regarding floating-point support.

If you want to check your toolchain against hard-float, too, keep on reading.

Let’ have a look at, for example, arm-cortex-a8___gcc-8.3.0___glibc-2.29___linux-4.4.174___float-auto___ctng-crosstool-ng-1.24.0:

This nicely named crosstool-ng (a toolchain generator) build toolchain states float=auto, which means GCC may choose the right floating-point engine like the crosstool-ng ARCH_FLOAT_AUTO config option expresses:

Unfortunately, this does not mean crosstool-ng ist choosing the floating-point option, instead of it’s saying the resulting compiler is deciding.
However, the compiler can only make this decision if we have a multi-lib compiler containing hard-float and soft-float variants, which this one do not have:

A multi-lib compiler would list something like:

Additionally, we may check by grepping the compiler verbose:

So I assumed its a soft-float compiler. Let’s do some more checks:

is not telling us something about hard-float, which would be --with-float=hard .

So next check:

This is telling us what the toolchain expects in case of building for hard-float. The resulting text contains something like:

Which means, if we have an hard-float toolchain we should find* in the toolchain folder:

But it found nothing.

Some more testing. We are compiling a simple hello world, and checking the resulting binary:

Which states explicitly soft-float ABI.

Or, for older compilers:

Should list Tag_ABI_VFP_args: VFP floating-point registers a hard-float one would have, but it does not.

Last one: Explicitly compiling for hard-float:

So, for sure, no hard float support.

Further Reading:

Demystifying ARM Floating Point Compiler Options – greate ARM floating-point compiler options overview


The following two tabs change content below.

Mike Bergmann

Technical software developer loving low level, bit peeking, embedded development as well as GUI, OO, and X-platform development.

Have your say