[PATCH] arm64: Paper over ARM_SMCCC_ARCH_WORKAROUND_3 Clang issue
Robin Murphy
robin.murphy at arm.com
Wed Mar 9 09:19:18 PST 2022
On 2022-03-09 15:57, Marc Zyngier wrote:
> Compiling the arm64 kernel with the BHB workarounds and Clang+LTO
> results in a bunch of:
>
> <instantiation>: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.
Alternatively, this is a perfectly valid cleanup, reducing the scope of
a header inclusion to the C prototype that actually needs it, thus
reducing header bloat for assembly files that don't. Which happens to
also have a pleasant side-effect in avoiding an inexplicable LTO nonsense :D
Even just in terms of that cleanup,
Reviewed-by: Robin Murphy <robin.murphy at arm.com>
FWIW, my gut feeling is that LTO has somehow blurred the lines between
different expansions of _AC() in ARM_SMCCC_ARCH_WORKAROUND_3 that it
remembers from other compilation units that it's busy munging together,
and confused itself.
Robin.
> Cc: James Morse <james.morse at arm.com>
> Cc: Nick Desaulniers <ndesaulniers at google.com>
> Cc: Will Deacon <will at kernel.org>
> Cc: Catalin Marinas <catalin.marinas at arm.com>
> Signed-off-by: Marc Zyngier <maz at kernel.org>
> ---
> 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 <linux/init.h>
> #include <uapi/linux/const.h>
>
> /*
> @@ -193,6 +192,7 @@
>
> #ifndef __ASSEMBLY__
>
> +#include <linux/init.h>
> #include <linux/linkage.h>
> #include <linux/types.h>
>
More information about the linux-arm-kernel
mailing list