linux/arch/arm64
Nathan Chancellor d2995249a2 arm64: alternatives: Use vdso/bits.h instead of linux/bits.h
When building with CONFIG_LTO after commit ba00c2a04f ("arm64: fix the
build with binutils 2.27"), the following build error occurs:

  In file included from arch/arm64/kernel/module-plts.c:6:
  In file included from include/linux/elf.h:6:
  In file included from arch/arm64/include/asm/elf.h:8:
  In file included from arch/arm64/include/asm/hwcap.h:9:
  In file included from arch/arm64/include/asm/cpufeature.h:9:
  In file included from arch/arm64/include/asm/alternative-macros.h:5:
  In file included from include/linux/bits.h:22:
  In file included from include/linux/build_bug.h:5:
  In file included from include/linux/compiler.h:248:
  In file included from arch/arm64/include/asm/rwonce.h:71:
  include/asm-generic/rwonce.h:67:9: error: expected string literal in 'asm'
          return __READ_ONCE(*(unsigned long *)addr);
                ^
  arch/arm64/include/asm/rwonce.h:43:16: note: expanded from macro '__READ_ONCE'
                  asm volatile(__LOAD_RCPC(b, %w0, %1)                    \
                              ^
  arch/arm64/include/asm/rwonce.h:17:2: note: expanded from macro '__LOAD_RCPC'
          ALTERNATIVE(                                                    \
          ^

Similar to the issue resolved by commit 0072dc1b53 ("arm64: avoid
BUILD_BUG_ON() in alternative-macros"), there is a circular include
dependency through <linux/bits.h> when CONFIG_LTO is enabled due to
<asm/rwonce.h> appearing in the include chain before the contents of
<asm/alternative-macros.h>, which results in ALTERNATIVE() not getting
expanded properly because it has not been defined yet.

Avoid this issue by including <vdso/bits.h>, which includes the
definition of the BIT() macro, instead of <linux/bits.h>, as BIT() is the
only macro from bits.h that is relevant to this header.

Fixes: ba00c2a04f ("arm64: fix the build with binutils 2.27")
Link: https://github.com/ClangBuiltLinux/linux/issues/1728
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20221003193759.1141709-1-nathan@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2022-10-05 10:44:44 +01:00
..
boot ARM: SoC: late updates for 6.0 2022-08-05 10:02:33 -07:00
configs arm64: defconfig: Add Coresight as module 2022-09-29 18:14:20 +01:00
crypto crypto: arm64/poly1305 - fix a read out-of-bound 2022-07-29 18:29:17 +08:00
hyperv
include arm64: alternatives: Use vdso/bits.h instead of linux/bits.h 2022-10-05 10:44:44 +01:00
kernel Merge branch 'for-next/misc' into for-next/core 2022-09-30 09:18:26 +01:00
kvm Merge branch 'for-next/alternatives' into for-next/core 2022-09-30 09:18:22 +01:00
lib Networking changes for 6.0. 2022-08-03 16:29:08 -07:00
mm Merge branch 'for-next/misc' into for-next/core 2022-09-30 09:18:26 +01:00
net bpf, arm64: Fix bpf trampoline instruction endianness 2022-08-10 16:50:57 +02:00
tools Merge branch 'for-next/alternatives' into for-next/core 2022-09-30 09:18:22 +01:00
xen
Kbuild
Kconfig Merge branch 'for-next/misc' into for-next/core 2022-09-30 09:18:26 +01:00
Kconfig.debug
Kconfig.platforms ARM: new SoC support for 6.0 2022-08-02 08:29:18 -07:00
Makefile