Subject: Re: [next] arm64: efi-rt-wrapper.S:8: Error: unknown mnemonic `bti' -- `bti c'

From: Catalin Marinas <[email-masked]>
Date: Fri, 17 Dec 2021 14:00:24 +0000

Thanks Naresh for the report.

On Thu, Dec 16, 2021 at 09:30:44AM +0530, Naresh Kamboju wrote:
> [ Please ignore this email if it is already reported ]
> 
> While building Linux next 20211215 arm64 defconfig with gcc-8
> following warnings / errors noticed.
> and gcc-9, gcc-10 and gcc-11 builds pass.
> 
> make --silent --keep-going --jobs=8
> O=/home/tuxbuild/.cache/tuxmake/builds/current \
>   ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- \
>   CROSS_COMPILE_COMPAT=arm-linux-gnueabihf- \
>   'CC=sccache aarch64-linux-gnu-gcc' \
>   'HOSTCC=sccache gcc'
> 
> /builds/linux/arch/arm64/kernel/efi-rt-wrapper.S: Assembler messages:
> /builds/linux/arch/arm64/kernel/efi-rt-wrapper.S:8: Error: unknown
> mnemonic `bti' -- `bti c'
> make[3]: *** [/builds/linux/scripts/Makefile.build:411:
> arch/arm64/kernel/efi-rt-wrapper.o] Error 1

We defined the bti macro in assembler.h but that's not included by
linkage.h and not all asm files seem to include the former. At a quick
grep we need the diff below, not sure it's the best solution:

diff --git a/arch/arm64/crypto/nh-neon-core.S b/arch/arm64/crypto/nh-neon-core.S
index 51c0a534ef87..bf6f7ee46d63 100644
--- a/arch/arm64/crypto/nh-neon-core.S
+++ b/arch/arm64/crypto/nh-neon-core.S
@@ -8,6 +8,7 @@
  */
 
 #include <linux/linkage.h>
+#include <asm/assembler.h>
 
 	KEY		.req	x0
 	MESSAGE		.req	x1
diff --git a/arch/arm64/kernel/efi-rt-wrapper.S b/arch/arm64/kernel/efi-rt-wrapper.S
index 75691a2641c1..9fde85521146 100644
--- a/arch/arm64/kernel/efi-rt-wrapper.S
+++ b/arch/arm64/kernel/efi-rt-wrapper.S
@@ -4,6 +4,7 @@
  */
 
 #include <linux/linkage.h>
+#include <asm/assembler.h>
 
 SYM_FUNC_START(__efi_rt_asm_wrapper)
 	stp	x29, x30, [sp, #-32]!
diff --git a/arch/arm64/kernel/reloc_test_syms.S b/arch/arm64/kernel/reloc_test_syms.S
index c50f45fa29fa..57bf78446a29 100644
--- a/arch/arm64/kernel/reloc_test_syms.S
+++ b/arch/arm64/kernel/reloc_test_syms.S
@@ -4,6 +4,7 @@
  */
 
 #include <linux/linkage.h>
+#include <asm/assembler.h>
 
 SYM_FUNC_START(absolute_data64)
 	ldr	x0, 0f

-- 
Catalin