Error: enabling Neon using -mfloat-gnuabi=hard


#1

I want to use FPU on Arm Cortex a9. I set the target variable in the python file as:
target = “llvm -target=arm-poky-linux-gnueabi -mfloat-abi=hard”

I then changed the toolchain in the make file as follows:

CXX = /opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++

PKG_CFLAGS = -std=c++11 -O2 -march=armv7-a -mcpu=cortex-a9 -mtune=cortex-a9 -mfloat-abi=hard -mfpu=neon -fPIC
-I${TVM_ROOT}/include
-I${DMLC_CORE}/include
-I${TVM_ROOT}/3rdparty/dlpack/include\

After doing all this I am getting the error as:

/opt/poky/1.7/sysroots/armv7a-vfp-neon-poky-linux-gnueabi/usr/include/gnu/stubs.h:10:29: fatal error: gnu/stubs-hard.h: No such file or directory #include <gnu/stubs-hard.h>

If I replace “hard” with “softfp” then tvm compiles perfectly and I am facing this issue only with “hard” option.

How can I correct this issue? I checked the gnu folder location and there is no stubs-hard.h file. If someone has faced similar issue then please let me know.


#2

The error you are seeing because your C library headers have all been configured with -mfloat-abi=softfp. The difference between -mfloat-abi=softfp -mfpu=neon and -mfloat-abi=hard -mfpu=neon is essentially with respect to how parameters are passed and whether they use the FP / Advanced SIMD register bank or they use memory / integer registers and thus (-mfloat-abi=softfp and -mfloat-abi=hard) fundamentally incompatible with each other.

Using -mfloat-abi=softfp -mfpu=neon, GCC will still continue to generate the FP / Neon instructions but just will not pass parameters in the SIMD / FPU registers.

For more on command line option differences you may want to read this blog https://community.arm.com/developer/tools-software/tools/b/tools-software-ides-blog/posts/arm-cortex-a-processors-and-gcc-command-lines?CommentSortBy=CreatedDate&CommentSortOrder=Descending or indeed actually the gcc manual pages.

What I’m trying to say is that given the environment you have and with the options you have chosen, this is expected behaviour.

I hope this helps.

regards
Ramana