Cross-compiling for ARM Cortex-A9 on x86

Hello list,

I have some problems using LLVM version 3.8.0 to cross-compile code for ARM Cortex-A9 on x86.

I am trying to generate LLVM IR using Clang: clang -S --emit-llvm --target=armv7a-linux-gnueabihf --sysroot=$(ARM_SYSROOT) --gcc-toolchain=$(ARM_GCC_TOOLCHAIN) -c -o translated.ll

But somehow clang it is trying to use soft-float and I get the following error: ‘gnu/stubs-soft.h’ file not found

Is there any way I can specify to use hard floating point? I have tried -mfloat-abi=hard but Clang does not recognize it.

Please, let me know if there is any other information you need.

Thanks in advance,


Hello Irune,

I tried to reproduce your command line options on a simple c file
containing some floating point instructions using the clang-3.8 binary
I have on my Ubuntu 16.04 machine with ARM_SYSROOT and
ARM_GCC_TOOLCHAIN configured to point at a Linaro Hard float toolchain
and clang used the hard float abi as expected. My clang-3.8 also
accepted -mfloat-abi=hard.

With my gcc toolchain the gnu/stubs-soft.h file is included from
gnu/stubs.h when __ARM_PCS_VFP is not defined.

With this in mind the only things I can think of are:
- There is something in your source code that is undefining __ARM_PCS_VFP.
- Your gcc toolchain has a different stubs.h that is always soft float.

As a first step; are you able to compile a hard float test program
that doesn't include anything from the C-library and does it use the
hard-float abi? If you can then I think there is likely to be
something in the source code or in the gcc toolchain you are
configuring against.



Hello Peter,

Thanks for your help!

I was able to compile a hard float test program that didn't include anything from the C-library. So I changed the gcc toolchain and it is working now.

Thanks again for your support.

Kind regards,