From nobody Wed Sep 17 19:36:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2C4EC4332F for ; Fri, 16 Dec 2022 06:55:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229744AbiLPGz6 (ORCPT ); Fri, 16 Dec 2022 01:55:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229471AbiLPGzz (ORCPT ); Fri, 16 Dec 2022 01:55:55 -0500 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87867FCC2 for ; Thu, 15 Dec 2022 22:55:50 -0800 (PST) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4NYKch17dKz9sqm; Fri, 16 Dec 2022 07:55:48 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SJRcgJhfooxD; Fri, 16 Dec 2022 07:55:48 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4NYKch0L96z9sY5; Fri, 16 Dec 2022 07:55:48 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id F0B6C8B77C; Fri, 16 Dec 2022 07:55:47 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id sl70OE1yLI3i; Fri, 16 Dec 2022 07:55:47 +0100 (CET) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.7.180]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B5C048B764; Fri, 16 Dec 2022 07:55:47 +0100 (CET) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 2BG6QLiY1146537 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 16 Dec 2022 07:26:21 +0100 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 2BG6QJRo1146535; Fri, 16 Dec 2022 07:26:19 +0100 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Jan-Benedict Glaw Subject: [PATCH] powerpc: Pass correct CPU reference to assembler Date: Fri, 16 Dec 2022 07:26:11 +0100 Message-Id: <176b0f41a8b9e9f1191bf2b8857d121887c4fbe5.1671171965.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1671171970; l=4369; s=20211009; h=from:subject:message-id; bh=MsAxZIY2P8LB6twC4gR4YIS6KE8v8tD1GgT5YQokrCc=; b=1ZJ7BiphCjY6/t6vIiwEegHZQ7BAvmHgQ6ZtLjud2rvlDDvwQ5Q/6WqKMstxpbOXArUjy4SGxAU3 kwVP+0PeBlP4B1vQ2yk6cr4YQvNMuF/eVoCk857NVrQcEXSjWF7n X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/c= ompiler-version.h -include ./include/linux/kconfig.h -D__KERNEL__ -I ./arch= /powerpc -DHAVE_AS_ATHIGH=3D1 -fmacro-prefix-map=3D./=3D -D__ASSEMBLY__ -fn= o-PIE -m64 -Wl,-a64 -mabi=3Delfv1 -Wa,-me500 -Wa,-me500mc -mabi=3Delfv1 -mb= ig-endian -Wl,-soname=3Dlinux-vdso64.so.1 -D__VDSO64__ -s -c -o arch/pow= erpc/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: `s= tdu' arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `s= tdu' arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `s= td' arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `s= td' arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `l= d' arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `l= d' ... make[1]: *** [arch/powerpc/kernel/vdso/Makefile:76: arch/powerpc/kernel/vd= so/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) +=3D $(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. Use it as well for the assembler. With that change (And also commit 825eada7717c ("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/c= ompiler-version.h -include ./include/linux/kconfig.h -D__KERNEL__ -I ./arch= /powerpc -DHAVE_AS_ATHIGH=3D1 -fmacro-prefix-map=3D./=3D -D__ASSEMBLY__ -fn= o-PIE -m64 -Wl,-a64 -mabi=3Delfv1 -mcpu=3De500mc64 -Wa,-me500mc64 -mabi=3De= lfv1 -mbig-endian -Wl,-soname=3Dlinux-vdso64.so.1 -D__VDSO64__ -s -c -o = arch/powerpc/kernel/vdso/gettimeofday-64.o arch/powerpc/kernel/vdso/gettime= ofday.S Reported-by: Jan-Benedict Glaw Signed-off-by: Christophe Leroy --- Commit 825eada7717c is in powerpc/next-test branch. Make sure the SHA doesn= 't change when it goes into powerpc/next --- arch/powerpc/Makefile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index bf5f0a998273..3245eec95627 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -201,18 +201,15 @@ KBUILD_CFLAGS +=3D -fno-asynchronous-unwind-tables # often slow when they are implemented at all KBUILD_CFLAGS +=3D $(call cc-option,-mno-string) =20 -cpu-as-$(CONFIG_40x) +=3D -Wa,-m405 -cpu-as-$(CONFIG_44x) +=3D -Wa,-m440 cpu-as-$(CONFIG_ALTIVEC) +=3D $(call as-option,-Wa$(comma)-maltivec) -cpu-as-$(CONFIG_PPC_E500) +=3D -Wa,-me500 +cpu-as-$(CONFIG_TARGET_CPU_BOOL) +=3D -Wa,-m$(CONFIG_TARGET_CPU) =20 # When using '-many -mpower4' gas will first try and find a matching power4 # mnemonic and failing that it will allow any valid mnemonic that GAS knows # about. GCC will pass -many to GAS when assembling, clang does not. # LLVM IAS doesn't understand either flag: https://github.com/ClangBuiltLi= nux/linux/issues/675 # but LLVM IAS only supports ISA >=3D 2.06 for Book3S 64 anyway... -cpu-as-$(CONFIG_PPC_BOOK3S_64) +=3D $(call as-option,-Wa$(comma)-mpower4) = $(call as-option,-Wa$(comma)-many) -cpu-as-$(CONFIG_PPC_E500MC) +=3D $(call as-option,-Wa$(comma)-me500mc) +cpu-as-$(CONFIG_PPC_BOOK3S_64) +=3D $(call as-option,-Wa$(comma)-many) =20 KBUILD_AFLAGS +=3D $(cpu-as-y) KBUILD_CFLAGS +=3D $(cpu-as-y) --=20 2.38.1