linux/arch
Nathan Chancellor de9c0d49d8 ARM: 8833/1: Ensure that NEON code always compiles with Clang
While building arm32 allyesconfig, I ran into the following errors:

  arch/arm/lib/xor-neon.c:17:2: error: You should compile this file with
  '-mfloat-abi=softfp -mfpu=neon'

  In file included from lib/raid6/neon1.c:27:
  /home/nathan/cbl/prebuilt/lib/clang/8.0.0/include/arm_neon.h:28:2:
  error: "NEON support not enabled"

Building V=1 showed NEON_FLAGS getting passed along to Clang but
__ARM_NEON__ was not getting defined. Ultimately, it boils down to Clang
only defining __ARM_NEON__ when targeting armv7, rather than armv6k,
which is the '-march' value for allyesconfig.

>From lib/Basic/Targets/ARM.cpp in the Clang source:

  // This only gets set when Neon instructions are actually available, unlike
  // the VFP define, hence the soft float and arch check. This is subtly
  // different from gcc, we follow the intent which was that it should be set
  // when Neon instructions are actually available.
  if ((FPU & NeonFPU) && !SoftFloat && ArchVersion >= 7) {
    Builder.defineMacro("__ARM_NEON", "1");
    Builder.defineMacro("__ARM_NEON__");
    // current AArch32 NEON implementations do not support double-precision
    // floating-point even when it is present in VFP.
    Builder.defineMacro("__ARM_NEON_FP",
                        "0x" + Twine::utohexstr(HW_FP & ~HW_FP_DP));
  }

Ard Biesheuvel recommended explicitly adding '-march=armv7-a' at the
beginning of the NEON_FLAGS definitions so that __ARM_NEON__ always gets
definined by Clang. This doesn't functionally change anything because
that code will only run where NEON is supported, which is implicitly
armv7.

Link: https://github.com/ClangBuiltLinux/linux/issues/287

Suggested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Acked-by: Nicolas Pitre <nico@linaro.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
2019-02-12 15:20:09 +00:00
..
alpha Kbuild late updates for v4.21 2019-01-06 16:33:10 -08:00
arc arch: remove redundant UAPI generic-y defines 2019-01-06 10:22:15 +09:00
arm ARM: 8833/1: Ensure that NEON code always compiles with Clang 2019-02-12 15:20:09 +00:00
arm64 Kbuild late updates for v4.21 2019-01-06 16:33:10 -08:00
c6x arch: remove redundant UAPI generic-y defines 2019-01-06 10:22:15 +09:00
csky arch: remove redundant UAPI generic-y defines 2019-01-06 10:22:15 +09:00
h8300 arch: remove redundant UAPI generic-y defines 2019-01-06 10:22:15 +09:00
hexagon arch: remove redundant UAPI generic-y defines 2019-01-06 10:22:15 +09:00
ia64 arch: remove redundant UAPI generic-y defines 2019-01-06 10:22:15 +09:00
m68k arch: remove redundant UAPI generic-y defines 2019-01-06 10:22:15 +09:00
microblaze arch: remove redundant UAPI generic-y defines 2019-01-06 10:22:15 +09:00
mips arch: remove redundant UAPI generic-y defines 2019-01-06 10:22:15 +09:00
nds32 arch: remove redundant UAPI generic-y defines 2019-01-06 10:22:15 +09:00
nios2 arch: remove redundant UAPI generic-y defines 2019-01-06 10:22:15 +09:00
openrisc arch: remove redundant UAPI generic-y defines 2019-01-06 10:22:15 +09:00
parisc arch: remove redundant UAPI generic-y defines 2019-01-06 10:22:15 +09:00
powerpc arch: remove redundant UAPI generic-y defines 2019-01-06 10:22:15 +09:00
riscv arch: remove redundant UAPI generic-y defines 2019-01-06 10:22:15 +09:00
s390 Kbuild late updates for v4.21 2019-01-06 16:33:10 -08:00
sh Kbuild late updates for v4.21 2019-01-06 16:33:10 -08:00
sparc arch: remove redundant UAPI generic-y defines 2019-01-06 10:22:15 +09:00
um Merge branch 'akpm' (patches from Andrew) 2019-01-05 09:16:18 -08:00
unicore32 arch: remove redundant UAPI generic-y defines 2019-01-06 10:22:15 +09:00
x86 Kbuild late updates for v4.21 2019-01-06 16:33:10 -08:00
xtensa arch: remove redundant UAPI generic-y defines 2019-01-06 10:22:15 +09:00
.gitignore
Kconfig jump_label: move 'asm goto' support test to Kconfig 2019-01-06 09:46:51 +09:00