linux/arch/arm/lib
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
..
ashldi3.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
ashrdi3.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
backtrace.S ARM: fix backtrace 2016-11-15 15:25:39 +00:00
bitops.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bswapsdi2.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
call_with_stack.S ARM: replace BSYM() with badr assembly macro 2015-05-08 17:33:50 +01:00
changebit.S ARM: 7171/1: unwind: add unwind directives to bitops assembly macros 2011-11-26 21:58:53 +00:00
clear_user.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
clearbit.S ARM: 7171/1: unwind: add unwind directives to bitops assembly macros 2011-11-26 21:58:53 +00:00
copy_from_user.S ARM: 8812/1: Optimise copy_{from/to}_user for !CPU_USE_DOMAINS 2018-11-12 10:51:59 +00:00
copy_page.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
copy_template.S ARM: 8827/1: fix argument count to match macro definition 2019-02-01 21:44:13 +00:00
copy_to_user.S ARM: 8812/1: Optimise copy_{from/to}_user for !CPU_USE_DOMAINS 2018-11-12 10:51:59 +00:00
csumipv6.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
csumpartial.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
csumpartialcopy.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
csumpartialcopygeneric.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
csumpartialcopyuser.S ARM: 8731/1: Fix csum_partial_copy_from_user() stack mismatch 2017-12-17 22:20:39 +00:00
delay-loop.S ARM: 8619/1: udelay: document the various constants 2016-10-19 10:52:36 +01:00
delay.c Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
div64.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
ecard.S ARM: remove unnecessary mach/hardware.h includes 2011-07-12 11:19:27 -05:00
findbit.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
floppydma.S
getuser.S ARM: 8813/1: Make aligned 2-byte getuser()/putuser() atomic on ARMv6+ 2018-11-12 10:52:04 +00:00
io-acorn.S arch: remove direct definitions of KERN_<LEVEL> uses 2012-07-30 17:25:13 -07:00
io-readsb.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
io-readsl.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
io-readsw-armv3.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
io-readsw-armv4.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
io-writesb.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
io-writesl.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
io-writesw-armv3.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
io-writesw-armv4.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
lib1funcs.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
lshrdi3.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
Makefile ARM: 8833/1: Ensure that NEON code always compiles with Clang 2019-02-12 15:20:09 +00:00
memchr.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
memcpy.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
memmove.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
memset.S ARM: implement memset32 & memset64 2017-09-08 18:26:48 -07:00
muldi3.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
putuser.S ARM: 8813/1: Make aligned 2-byte getuser()/putuser() atomic on ARMv6+ 2018-11-12 10:52:04 +00:00
setbit.S ARM: 7171/1: unwind: add unwind directives to bitops assembly macros 2011-11-26 21:58:53 +00:00
strchr.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
strrchr.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
testchangebit.S ARM: 7171/1: unwind: add unwind directives to bitops assembly macros 2011-11-26 21:58:53 +00:00
testclearbit.S ARM: 7171/1: unwind: add unwind directives to bitops assembly macros 2011-11-26 21:58:53 +00:00
testsetbit.S ARM: 7171/1: unwind: add unwind directives to bitops assembly macros 2011-11-26 21:58:53 +00:00
uaccess_with_memcpy.c ARM: 8797/1: spectre-v1.1: harden __copy_to_user 2018-10-05 10:51:15 +01:00
ucmpdi2.S Revert "arm: move exports to definitions" 2016-11-23 10:00:03 +00:00
xor-neon.c ARM: 8833/1: Ensure that NEON code always compiles with Clang 2019-02-12 15:20:09 +00:00