Skip to content

Error compiling files that require __ARM_NEON__ during allyesconfig build #287

@nathanchance

Description

@nathanchance

When building an arm32 allyesconfig build, this error pops up because __ARM_NEON__ is not defined:

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

These flags are very clearly supplied to Clang:

/usr/bin/ccache clang -Wp,-MD,arch/arm/lib/.xor-neon.o.d  -nostdinc -isystem /home/nathan/cbl/prebuilt/lib/clang/8.0.0/include -I./arch/arm/include -I./arch/arm/include/generated  -I./include -I./arch/arm/include/uapi -I./arch/arm/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -mlittle-endian -Qunused-arguments -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 --target=arm-linux-gnueabi --prefix=/home/nathan/cbl/prebuilt/bin/ --gcc-toolchain=/home/nathan/cbl/prebuilt -no-integrated-as -fno-PIE -fno-dwarf2-cfi-asm -mabi=aapcs-linux -mfpu=vfp -funwind-tables -marm -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=6 -march=armv6k -mtune=arm1136j-s -msoft-float -Uarm -fno-delete-null-pointer-checks -O2 -Wframe-larger-than=1024 -fstack-protector-strong -Wno-format-invalid-specifier -Wno-gnu -Wno-address-of-packed-member -Wno-tautological-compare -mno-global-merge -Wno-unused-const-variable -fno-inline-functions -pg -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -fno-strict-overflow -fno-merge-all-constants -fno-stack-check -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types -Wno-initializer-overrides -Wno-unused-value -Wno-format -Wno-sign-compare -Wno-format-zero-length -Wno-uninitialized -mfloat-abi=softfp -mfpu=neon   -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp    -DKBUILD_BASENAME='"xor_neon"' -DKBUILD_MODNAME='"xor_neon"' -c -o arch/arm/lib/xor-neon.o arch/arm/lib/xor-neon.c

However, it looks like the -march=armv6k is probably the problematic flag, according to lib/Basic/Targets/ARM.cpp in Clang (link):

  // 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));
  }

No idea how to reconcile this.

Metadata

Metadata

Assignees

Labels

[ARCH] arm32This bug impacts ARCH=arm[BUG] linuxA bug that should be fixed in the mainline kernel.[FIXED][LINUX] 5.1This bug was fixed in Linux 5.1

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions