Re: [PATCH v2] powerpc: Pass correct CPU reference to assembler

From: Pali Rohár
Date: Fri Dec 16 2022 - 20:10:34 EST


On Friday 16 December 2022 09:35:50 Christophe Leroy wrote:
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index bf5f0a998273..528452ce80b4 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -201,18 +201,20 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
> # often slow when they are implemented at all
> KBUILD_CFLAGS += $(call cc-option,-mno-string)
>
> -cpu-as-$(CONFIG_40x) += -Wa,-m405
> -cpu-as-$(CONFIG_44x) += -Wa,-m440
> cpu-as-$(CONFIG_ALTIVEC) += $(call as-option,-Wa$(comma)-maltivec)
> -cpu-as-$(CONFIG_PPC_E500) += -Wa,-me500
> +
> +ifeq ($(CONFIG_TARGET_CPU),powerpc)
> +cpu-as-$(CONFIG_TARGET_CPU_BOOL) += -Wa,-mppc
> +else
> +cpu-as-$(CONFIG_TARGET_CPU_BOOL) += -Wa,-m$(CONFIG_TARGET_CPU)
> +endif

This change will break compilation for e500 cores. Kconfig sets
CONFIG_TARGET_CPU to string "8540" for e500 cores because gcc uses
-mcpu=8540 for e500 but GNU AS uses -me500 for e500 cores.