On Wed, Mar 09, 2022 at 03:57:16PM +0000, Marc Zyngier wrote: > Compiling the arm64 kernel with the BHB workarounds and Clang+LTO > results in a bunch of: > > :4:2: error: invalid fixup for movz/movk instruction > mov w0, #ARM_SMCCC_ARCH_WORKAROUND_3 > > when compiling arch/arm64/kernel/entry.S, and makes no sense at all. > > As it turns out, moving a single include line around makes the > problem disappear. Why, you'd ask? Well, I don't have the faintest > idea, and I'm running out of patience. So make of that what you want. > > Cc: James Morse > Cc: Nick Desaulniers > Cc: Will Deacon > Cc: Catalin Marinas > Signed-off-by: Marc Zyngier > --- > include/linux/arm-smccc.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h > index 220c8c60e021..0a341dd9ff61 100644 > --- a/include/linux/arm-smccc.h > +++ b/include/linux/arm-smccc.h > @@ -5,7 +5,6 @@ > #ifndef __LINUX_ARM_SMCCC_H > #define __LINUX_ARM_SMCCC_H > > -#include > #include > > /* > @@ -193,6 +192,7 @@ > > #ifndef __ASSEMBLY__ > > +#include > #include > #include > > -- > 2.34.1 I am still looking at this but I wanted to post a preliminary finding. It seems the source of the error is that ARM_SMCCC_ARCH_WORKAROUND_3 is not getting expanded by the preprocessor. If you preprocess arch/arm64/kernel/entry.S without LTO then with LTO, it reveals the attached diff, which shows just "#ARM_SMCCC_ARCH_WORKAROUND_3", rather than "# (((1) << 31) | ((0) << 30) | (((0) & 0x3F) << 24) | ((0x3fff) & 0xFFFF))". $ make -skj"$(nproc)" ARCH=arm64 LLVM=1 mrproper defconfig arch/arm64/kernel/entry.s I'll see if I can figure out what is going wrong in the include chain. Cheers, Nathan