[Clang] Fails to build on ARM < 7
-mfpu=neon
without -march=armv7-a
(or similar) is not enough with Clang.
FAILED: kernel_neon@sta/kernel_neon.c.o
clang -Ikernel_neon@sta -I. -I.. -Xclang -fcolor-diagnostics -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -Werror -std=c11 -g '-DWAYPIPE_REL_SRC_DIR="../"' -fPIC -mfpu=neon -MD -MQ 'kernel_neon@sta/kernel_neon.c.o' -MF 'kernel_neon@sta/kernel_neon.c.o.d' -o 'kernel_neon@sta/kernel_neon.c.o' -c ../kernel_neon.c
In file included from ../kernel_neon.c:29:
/usr/lib/clang/8.0.1/include/arm_neon.h:28:2: error: "NEON support not enabled"
#error "NEON support not enabled"
^
1 error generated.
$ clang -target armv6-pc-linux-gnueabihf -mfpu=neon -E -dM -</dev/null | fgrep NEON
$ clang -target armv6-pc-linux-gnueabihf -march=armv7-a -mfpu=neon -E -dM -</dev/null | fgrep NEON
#define __ARM_NEON 1
#define __ARM_NEON_FP 0x4
#define __ARM_NEON__ 1
https://github.com/llvm/llvm-project/blob/llvmorg-8.0.1/clang/lib/Basic/Targets/ARM.cpp#L692-L703
Edited by Jan Beich