linux-stable/arch/powerpc
Christophe Leroy bfb03af71a powerpc: Pass correct CPU reference to assembler
Jan-Benedict reported issue with building ppc64e_defconfig
with mainline GCC work:

  powerpc64-linux-gcc -Wp,-MMD,arch/powerpc/kernel/vdso/.gettimeofday-64.o.d -nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated  -I./include -I./arch/powerpc/include/uapi -I./arch/powerpc/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -D__KERNEL__ -I ./arch/powerpc -DHAVE_AS_ATHIGH=1 -fmacro-prefix-map=./= -D__ASSEMBLY__ -fno-PIE -m64 -Wl,-a64 -mabi=elfv1 -Wa,-me500 -Wa,-me500mc -mabi=elfv1 -mbig-endian    -Wl,-soname=linux-vdso64.so.1 -D__VDSO64__ -s -c -o arch/powerpc/kernel/vdso/gettimeofday-64.o arch/powerpc/kernel/vdso/gettimeofday.S
	arch/powerpc/kernel/vdso/gettimeofday.S: Assembler messages:
	arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `stdu'
	arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `stdu'
	arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `std'
	arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `std'
	arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `ld'
	arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `ld'
	...
	make[1]: *** [arch/powerpc/kernel/vdso/Makefile:76: arch/powerpc/kernel/vdso/gettimeofday-64.o] Error 1
	make: *** [arch/powerpc/Makefile:387: vdso_prepare] Error 2

This is due to assembler being called with -me500mc which is
a 32 bits target.

The problem comes from the fact that CONFIG_PPC_E500MC is selected for
both the e500mc (32 bits) and the e5500 (64 bits), and therefore the
following makefile rule is wrong:

  cpu-as-$(CONFIG_PPC_E500MC)    += $(call as-option,-Wa$(comma)-me500mc)

Today we have CONFIG_TARGET_CPU which provides the identification of the
expected CPU, it is used for GCC. Once GCC knows the target CPU, it adds
the correct CPU option to assembler, no need to add it explicitly.

With that change (And also commit 45f7091aac ("powerpc/64: Set default
CPU in Kconfig")), it now is:

  powerpc64-linux-gcc -Wp,-MMD,arch/powerpc/kernel/vdso/.gettimeofday-64.o.d -nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated  -I./include -I./arch/powerpc/include/uapi -I./arch/powerpc/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -D__KERNEL__ -I ./arch/powerpc -DHAVE_AS_ATHIGH=1 -fmacro-prefix-map=./= -D__ASSEMBLY__ -fno-PIE -m64 -Wl,-a64 -mabi=elfv1 -mcpu=e500mc64 -mabi=elfv1 -mbig-endian    -Wl,-soname=linux-vdso64.so.1 -D__VDSO64__ -s -c -o arch/powerpc/kernel/vdso/gettimeofday-64.o arch/powerpc/kernel/vdso/gettimeofday.S

Reported-by: Jan-Benedict Glaw <jbglaw@lug-owl.de>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Acked-by: Pali Rohár <pali@kernel.org>
[mpe: Retain -Wa,-mpower4 -Wa,-many for Book3S 64 builds for now]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/758ad54128fa9dd2fdedc4c511592111cbded900.1671475543.git.christophe.leroy@csgroup.eu
2023-02-17 22:06:19 +11:00
..
boot Merge branch 'fixes' into next 2023-02-12 22:11:56 +11:00
configs powerpc/ps3: Refresh ps3_defconfig 2023-02-12 22:11:38 +11:00
crypto crypto: powerpc - Use address generation helper for asm 2023-02-10 22:17:36 +11:00
include powerpc/machdep: warn when machine_is() used too early 2023-02-15 22:41:11 +11:00
kernel powerpc/eeh: Set channel state after notifying the drivers 2023-02-15 22:41:11 +11:00
kexec powerpc/kexec_file: print error string on usable memory property update failure 2023-02-15 23:14:06 +11:00
kvm powerpc/kvm: Fix unannotated intra-function call warning 2023-01-30 16:01:04 +11:00
lib powerpc/kcsan: Add exclusions from instrumentation 2023-02-10 22:19:56 +11:00
math-emu powerpc/math-emu: Inhibit W=1 warnings 2022-09-08 11:11:18 +10:00
mm powerpc/mm: Rearrange if-else block to avoid clang warning 2023-02-16 23:53:16 +11:00
net powerpc/bpf/32: perform three operands ALU operations 2023-02-10 22:17:35 +11:00
perf powerpc/pseries/hv-24x7: convert to papr_sysparm API 2023-02-13 22:35:03 +11:00
platforms powerpc/pseries: Fix endianness issue when parsing PLPKS secvar flags 2023-02-16 21:16:22 +11:00
purgatory powerpc/kcsan: Add exclusions from instrumentation 2023-02-10 22:19:56 +11:00
sysdev powerpc/rtas: arch-wide function token lookup conversions 2023-02-13 22:35:03 +11:00
tools powerpc/64: Add UADDR64 relocation support 2022-03-09 21:47:53 +11:00
xmon powerpc/rtas: arch-wide function token lookup conversions 2023-02-13 22:35:03 +11:00
Kbuild kbuild: use more subdir- for visiting subdirectories while cleaning 2021-10-24 13:49:46 +09:00
Kconfig powerpc/pseries: Turn PSERIES_PLPKS into a hidden option 2023-02-12 22:12:38 +11:00
Kconfig.debug powerpc: Add support for early debugging via Serial 16550 console 2022-09-28 19:22:09 +10:00
Makefile powerpc: Pass correct CPU reference to assembler 2023-02-17 22:06:19 +11:00
Makefile.postlink