Message ID | 20231120232332.4100288-1-masahiroy@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp281555vqb; Mon, 20 Nov 2023 15:24:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IGYUumn+jyqdFyms1gj5g1ZVpySYT6ALON0O3Z42tSbzYucc3iewhDwSQuF2lGx2j6EpB6R X-Received: by 2002:a17:90a:fa03:b0:283:a384:5732 with SMTP id cm3-20020a17090afa0300b00283a3845732mr1438361pjb.9.1700522691570; Mon, 20 Nov 2023 15:24:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700522691; cv=none; d=google.com; s=arc-20160816; b=tvyoO3blrpdWaF/KJ6MG3SokwmF+o0IdsSbjJ/mQxszNI4luIqzdsAYKknA8rh94Oo lg54j0CoaaS3eZjr0U3t7gJ3WWi7uaWAfhurIAnmk29BcpuRfjw0UMCLCbDS1Lw1ogcV 6Mdqrsujbnme8faQiz9F6nRg/vp93bpF5WT0wwvMz6bzU7qpvw0tVFMkPwGqPHzbKTAn Hc/+JWRVbAdsxuS29XzGkK7mUZX1rts8N4GMtc1LzaF52zqeklmmiVPVHFsLqu/20SHd IlGB6hGDCJY/H9OhSgXLXqLsn8IK0YTaXrIGMwmFNM/yjC6SiK22C8TBfqFWzPNm9jw6 KFkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=yo3uFp47oTk4OROXXkYWaQkds7ZBDfXfjBSBdxK8EMA=; fh=kX28LnxzqQb0xX1Xvxb3Idm77XKPV4yUEVuY41u085k=; b=fUghLTBTBNHdo+//Wsoxzz5gDTJQkDm6OOEK1wDHDNOPTZLckk3r2aENX1I784W7rk CKKv4fHKH6ZZ0geLixAJ2sQNICIo5Rzg2tN+xhXjWXsGon7sdQ2axe/7QqURhPcpR8qP sxPYQV8f3CmNKTosR7IlIK0SrMUY56wHOi9t2hP+y4RDCzlgloTJ4zM/ePeuwpQ4FMpd TgsrtPrz2FZW/Bk2f+S4MpJzYhp5iNBRdino4m7Caa5+2kAwkS14aKUKVMqou1Yv2dIc PeIeqBBBMyXTrC9lIH7T130v+o5ai0PRJUVUF90mgtTC1z/BP9sOUMVe9twj/WTZMJXy XQ8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=H8jniV24; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id li16-20020a17090b48d000b0028525597500si3302425pjb.150.2023.11.20.15.24.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 15:24:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=H8jniV24; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 9B0108032A33; Mon, 20 Nov 2023 15:24:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229902AbjKTXYK (ORCPT <rfc822;heyuhang3455@gmail.com> + 27 others); Mon, 20 Nov 2023 18:24:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbjKTXYI (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 20 Nov 2023 18:24:08 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13A3FC1 for <linux-kernel@vger.kernel.org>; Mon, 20 Nov 2023 15:24:05 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F25B3C433C8; Mon, 20 Nov 2023 23:24:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700522644; bh=67KEhLI0mEivJdbrkeCl+vFBBtgFo5YzYmUACDBON68=; h=From:To:Cc:Subject:Date:From; b=H8jniV24tZu68db9VGGm2q1zQTL4/mK90DWnFoovUtdjLOvX2sQaRAW9tq1BGVaOj 7qX3z2eK3d6lvNNIKtJbLJ2Iw6euVJSNcBNlnv+gaQPgDbbDNXtCt6jA+iyW4IO6VF 7m73afQT36H+vXmRCSH6nm2IjaNzTcC3ZhCVDkOaspknxf90tcCYnday6+8h5BfdBt wAl5D26oA/ehLsMMoHU5dV8CgCujZme+ru+sGtfkmjw6neS289tR8vbajgFjncYRxV JeGody4kjKgtnTgAbfwsz//Tmoq8zfFqKBbk7I1ak4r57jtbn+mag/3++tZF5bz1dT qAH0aq2JpD5mw== From: Masahiro Yamada <masahiroy@kernel.org> To: Michael Ellerman <mpe@ellerman.id.au>, Nicholas Piggin <npiggin@gmail.com>, Christophe Leroy <christophe.leroy@csgroup.eu>, linuxppc-dev@lists.ozlabs.org Cc: Masahiro Yamada <masahiroy@kernel.org>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Tom Rix <trix@redhat.com>, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH] powerpc: add crtsavres.o to always-y instead of extra-y Date: Tue, 21 Nov 2023 08:23:32 +0900 Message-Id: <20231120232332.4100288-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 20 Nov 2023 15:24:49 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783127281779556674 X-GMAIL-MSGID: 1783127281779556674 |
Series |
powerpc: add crtsavres.o to always-y instead of extra-y
|
|
Commit Message
Masahiro Yamada
Nov. 20, 2023, 11:23 p.m. UTC
crtsavres.o is linked to modules. However, as explained in commit
d0e628cd817f ("kbuild: doc: clarify the difference between extra-y
and always-y"), 'make modules' does not build extra-y.
For example, the following command fails:
$ make ARCH=powerpc LLVM=1 KBUILD_MODPOST_WARN=1 mrproper ps3_defconfig modules
[snip]
LD [M] arch/powerpc/platforms/cell/spufs/spufs.ko
ld.lld: error: cannot open arch/powerpc/lib/crtsavres.o: No such file or directory
make[3]: *** [scripts/Makefile.modfinal:56: arch/powerpc/platforms/cell/spufs/spufs.ko] Error 1
make[2]: *** [Makefile:1844: modules] Error 2
make[1]: *** [/home/masahiro/workspace/linux-kbuild/Makefile:350: __build_one_by_one] Error 2
make: *** [Makefile:234: __sub-make] Error 2
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
arch/powerpc/lib/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Tue Nov 21, 2023 at 9:23 AM AEST, Masahiro Yamada wrote: > crtsavres.o is linked to modules. However, as explained in commit > d0e628cd817f ("kbuild: doc: clarify the difference between extra-y > and always-y"), 'make modules' does not build extra-y. > > For example, the following command fails: > > $ make ARCH=powerpc LLVM=1 KBUILD_MODPOST_WARN=1 mrproper ps3_defconfig modules > [snip] > LD [M] arch/powerpc/platforms/cell/spufs/spufs.ko > ld.lld: error: cannot open arch/powerpc/lib/crtsavres.o: No such file or directory > make[3]: *** [scripts/Makefile.modfinal:56: arch/powerpc/platforms/cell/spufs/spufs.ko] Error 1 > make[2]: *** [Makefile:1844: modules] Error 2 > make[1]: *** [/home/masahiro/workspace/linux-kbuild/Makefile:350: __build_one_by_one] Error 2 > make: *** [Makefile:234: __sub-make] Error 2 > Thanks. Is this the correct Fixes tag? Fixes: d0e628cd817f ("powerpc/64: Do not link crtsavres.o in vmlinux") Hmm, looks like LLD might just do this now automatically for us too without --save-restore-funcs (https://reviews.llvm.org/D79977). But we probably still need it for older versions, so we still need your patch. Reviewed-by: Nicholas Piggin <npiggin@gmail.com> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > --- > > arch/powerpc/lib/Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile > index 51ad0397c17a..6eac63e79a89 100644 > --- a/arch/powerpc/lib/Makefile > +++ b/arch/powerpc/lib/Makefile > @@ -45,7 +45,7 @@ obj-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o > # so it is only needed for modules, and only for older linkers which > # do not support --save-restore-funcs > ifndef CONFIG_LD_IS_BFD > -extra-$(CONFIG_PPC64) += crtsavres.o > +always-$(CONFIG_PPC64) += crtsavres.o > endif > > obj-$(CONFIG_PPC_BOOK3S_64) += copyuser_power7.o copypage_power7.o \
On Tue, Nov 21, 2023 at 6:55 PM Aneesh Kumar K.V <aneesh.kumar@kernel.org> wrote: > > "Nicholas Piggin" <npiggin@gmail.com> writes: > > > On Tue Nov 21, 2023 at 9:23 AM AEST, Masahiro Yamada wrote: > >> crtsavres.o is linked to modules. However, as explained in commit > >> d0e628cd817f ("kbuild: doc: clarify the difference between extra-y > >> and always-y"), 'make modules' does not build extra-y. > >> > >> For example, the following command fails: > >> > >> $ make ARCH=powerpc LLVM=1 KBUILD_MODPOST_WARN=1 mrproper ps3_defconfig modules > >> [snip] > >> LD [M] arch/powerpc/platforms/cell/spufs/spufs.ko > >> ld.lld: error: cannot open arch/powerpc/lib/crtsavres.o: No such file or directory > >> make[3]: *** [scripts/Makefile.modfinal:56: arch/powerpc/platforms/cell/spufs/spufs.ko] Error 1 > >> make[2]: *** [Makefile:1844: modules] Error 2 > >> make[1]: *** [/home/masahiro/workspace/linux-kbuild/Makefile:350: __build_one_by_one] Error 2 > >> make: *** [Makefile:234: __sub-make] Error 2 > >> > > > > Thanks. Is this the correct Fixes tag? > > > > Fixes: d0e628cd817f ("powerpc/64: Do not link crtsavres.o in vmlinux") > > > > I am finding a different commit ID: > > commit baa25b571a168aff5a13bfdc973f1229e2b12b63 > Author: Nicholas Piggin <npiggin@gmail.com> > Date: Fri May 12 01:56:49 2017 +1000 > > powerpc/64: Do not link crtsavres.o in vmlinux > > The 64-bit linker creates save/restore functions on demand with final > links, so vmlinux does not require crtsavres.o. > > > -aneesh Yeah, I think the correct tag is: Fixes: baa25b571a16 ("powerpc/64: Do not link crtsavres.o in vmlinux")
Masahiro Yamada <masahiroy@kernel.org> writes: > On Tue, Nov 21, 2023 at 6:55 PM Aneesh Kumar K.V > <aneesh.kumar@kernel.org> wrote: >> >> "Nicholas Piggin" <npiggin@gmail.com> writes: >> >> > On Tue Nov 21, 2023 at 9:23 AM AEST, Masahiro Yamada wrote: >> >> crtsavres.o is linked to modules. However, as explained in commit >> >> d0e628cd817f ("kbuild: doc: clarify the difference between extra-y >> >> and always-y"), 'make modules' does not build extra-y. >> >> >> >> For example, the following command fails: >> >> >> >> $ make ARCH=powerpc LLVM=1 KBUILD_MODPOST_WARN=1 mrproper ps3_defconfig modules >> >> [snip] >> >> LD [M] arch/powerpc/platforms/cell/spufs/spufs.ko >> >> ld.lld: error: cannot open arch/powerpc/lib/crtsavres.o: No such file or directory >> >> make[3]: *** [scripts/Makefile.modfinal:56: arch/powerpc/platforms/cell/spufs/spufs.ko] Error 1 >> >> make[2]: *** [Makefile:1844: modules] Error 2 >> >> make[1]: *** [/home/masahiro/workspace/linux-kbuild/Makefile:350: __build_one_by_one] Error 2 >> >> make: *** [Makefile:234: __sub-make] Error 2 >> >> >> > >> > Thanks. Is this the correct Fixes tag? >> > >> > Fixes: d0e628cd817f ("powerpc/64: Do not link crtsavres.o in vmlinux") >> > >> >> I am finding a different commit ID: >> >> commit baa25b571a168aff5a13bfdc973f1229e2b12b63 >> Author: Nicholas Piggin <npiggin@gmail.com> >> Date: Fri May 12 01:56:49 2017 +1000 >> >> powerpc/64: Do not link crtsavres.o in vmlinux >> >> The 64-bit linker creates save/restore functions on demand with final >> links, so vmlinux does not require crtsavres.o. > > Yeah, I think the correct tag is: > > Fixes: baa25b571a16 ("powerpc/64: Do not link crtsavres.o in vmlinux") Yep, I used that when applying. cheers
On Tue, 21 Nov 2023 08:23:32 +0900, Masahiro Yamada wrote: > crtsavres.o is linked to modules. However, as explained in commit > d0e628cd817f ("kbuild: doc: clarify the difference between extra-y > and always-y"), 'make modules' does not build extra-y. > > For example, the following command fails: > > $ make ARCH=powerpc LLVM=1 KBUILD_MODPOST_WARN=1 mrproper ps3_defconfig modules > [snip] > LD [M] arch/powerpc/platforms/cell/spufs/spufs.ko > ld.lld: error: cannot open arch/powerpc/lib/crtsavres.o: No such file or directory > make[3]: *** [scripts/Makefile.modfinal:56: arch/powerpc/platforms/cell/spufs/spufs.ko] Error 1 > make[2]: *** [Makefile:1844: modules] Error 2 > make[1]: *** [/home/masahiro/workspace/linux-kbuild/Makefile:350: __build_one_by_one] Error 2 > make: *** [Makefile:234: __sub-make] Error 2 > > [...] Applied to powerpc/next. [1/1] powerpc: add crtsavres.o to always-y instead of extra-y https://git.kernel.org/powerpc/c/1b1e38002648819c04773647d5242990e2824264 cheers
On Tue, Nov 21, 2023 at 10:51:34AM +1000, Nicholas Piggin wrote: >On Tue Nov 21, 2023 at 9:23 AM AEST, Masahiro Yamada wrote: >> crtsavres.o is linked to modules. However, as explained in commit >> d0e628cd817f ("kbuild: doc: clarify the difference between extra-y >> and always-y"), 'make modules' does not build extra-y. >> >> For example, the following command fails: >> >> $ make ARCH=powerpc LLVM=1 KBUILD_MODPOST_WARN=1 mrproper ps3_defconfig modules >> [snip] >> LD [M] arch/powerpc/platforms/cell/spufs/spufs.ko >> ld.lld: error: cannot open arch/powerpc/lib/crtsavres.o: No such file or directory >> make[3]: *** [scripts/Makefile.modfinal:56: arch/powerpc/platforms/cell/spufs/spufs.ko] Error 1 >> make[2]: *** [Makefile:1844: modules] Error 2 >> make[1]: *** [/home/masahiro/workspace/linux-kbuild/Makefile:350: __build_one_by_one] Error 2 >> make: *** [Makefile:234: __sub-make] Error 2 >> > >Thanks. Is this the correct Fixes tag? > >Fixes: d0e628cd817f ("powerpc/64: Do not link crtsavres.o in vmlinux") > >Hmm, looks like LLD might just do this now automatically for us >too without --save-restore-funcs (https://reviews.llvm.org/D79977). >But we probably still need it for older versions, so we still need >your patch. Hi, I'm still seeing the error of crtsavres.o missing when building external modules after "make LLVM=1 modules_prepare". Should it be built also in archprepare? Thanks, Jan diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 051247027..a62334194 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -57,8 +57,11 @@ ifeq ($(CONFIG_PPC64)$(CONFIG_LD_IS_BFD),yy) # Have the linker provide sfpr if possible. # There is a corresponding test in arch/powerpc/lib/Makefile KBUILD_LDFLAGS_MODULE += --save-restore-funcs +crtsavres_prepare: else KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o +crtsavres_prepare: + $(MAKE) $(build)=arch/powerpc/lib arch/powerpc/lib/crtsavres.o endif ifdef CONFIG_CPU_LITTLE_ENDIAN @@ -389,7 +392,7 @@ vdso_prepare: prepare0 $(build)=arch/powerpc/kernel/vdso include/generated/vdso64-offsets.h) endif -archprepare: checkbin +archprepare: checkbin crtsavres_prepare archheaders: $(Q)$(MAKE) $(build)=arch/powerpc/kernel/syscalls all
Jan Stancek <jstancek@redhat.com> writes: > On Tue, Nov 21, 2023 at 10:51:34AM +1000, Nicholas Piggin wrote: >>On Tue Nov 21, 2023 at 9:23 AM AEST, Masahiro Yamada wrote: >>> crtsavres.o is linked to modules. However, as explained in commit >>> d0e628cd817f ("kbuild: doc: clarify the difference between extra-y >>> and always-y"), 'make modules' does not build extra-y. >>> >>> For example, the following command fails: >>> >>> $ make ARCH=powerpc LLVM=1 KBUILD_MODPOST_WARN=1 mrproper ps3_defconfig modules >>> [snip] >>> LD [M] arch/powerpc/platforms/cell/spufs/spufs.ko >>> ld.lld: error: cannot open arch/powerpc/lib/crtsavres.o: No such file or directory >>> make[3]: *** [scripts/Makefile.modfinal:56: arch/powerpc/platforms/cell/spufs/spufs.ko] Error 1 >>> make[2]: *** [Makefile:1844: modules] Error 2 >>> make[1]: *** [/home/masahiro/workspace/linux-kbuild/Makefile:350: __build_one_by_one] Error 2 >>> make: *** [Makefile:234: __sub-make] Error 2 >>> >> >>Thanks. Is this the correct Fixes tag? >> >>Fixes: d0e628cd817f ("powerpc/64: Do not link crtsavres.o in vmlinux") >> >>Hmm, looks like LLD might just do this now automatically for us >>too without --save-restore-funcs (https://reviews.llvm.org/D79977). >>But we probably still need it for older versions, so we still need >>your patch. > > Hi, > > I'm still seeing the error of crtsavres.o missing when building external modules > after "make LLVM=1 modules_prepare". Should it be built also in archprepare? Or modules_prepare? Example patch below. cheers diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 051247027da0..82cdef40a9cd 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -59,6 +59,11 @@ ifeq ($(CONFIG_PPC64)$(CONFIG_LD_IS_BFD),yy) KBUILD_LDFLAGS_MODULE += --save-restore-funcs else KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o + +crtsavres_prepare: scripts + $(MAKE) $(build)=arch/powerpc/lib arch/powerpc/lib/crtsavres.o + +modules_prepare: crtsavres_prepare endif ifdef CONFIG_CPU_LITTLE_ENDIAN
On Mon, Feb 5, 2024 at 12:50 PM Michael Ellerman <mpe@ellerman.id.au> wrote: > > Jan Stancek <jstancek@redhat.com> writes: > > On Tue, Nov 21, 2023 at 10:51:34AM +1000, Nicholas Piggin wrote: > >>On Tue Nov 21, 2023 at 9:23 AM AEST, Masahiro Yamada wrote: > >>> crtsavres.o is linked to modules. However, as explained in commit > >>> d0e628cd817f ("kbuild: doc: clarify the difference between extra-y > >>> and always-y"), 'make modules' does not build extra-y. > >>> > >>> For example, the following command fails: > >>> > >>> $ make ARCH=powerpc LLVM=1 KBUILD_MODPOST_WARN=1 mrproper ps3_defconfig modules > >>> [snip] > >>> LD [M] arch/powerpc/platforms/cell/spufs/spufs.ko > >>> ld.lld: error: cannot open arch/powerpc/lib/crtsavres.o: No such file or directory > >>> make[3]: *** [scripts/Makefile.modfinal:56: arch/powerpc/platforms/cell/spufs/spufs.ko] Error 1 > >>> make[2]: *** [Makefile:1844: modules] Error 2 > >>> make[1]: *** [/home/masahiro/workspace/linux-kbuild/Makefile:350: __build_one_by_one] Error 2 > >>> make: *** [Makefile:234: __sub-make] Error 2 > >>> > >> > >>Thanks. Is this the correct Fixes tag? > >> > >>Fixes: d0e628cd817f ("powerpc/64: Do not link crtsavres.o in vmlinux") > >> > >>Hmm, looks like LLD might just do this now automatically for us > >>too without --save-restore-funcs (https://reviews.llvm.org/D79977). > >>But we probably still need it for older versions, so we still need > >>your patch. > > > > Hi, > > > > I'm still seeing the error of crtsavres.o missing when building external modules > > after "make LLVM=1 modules_prepare". Should it be built also in archprepare? > > Or modules_prepare? > > Example patch below. I tested your patch with my setup and that works for me as well. > > cheers > > > diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile > index 051247027da0..82cdef40a9cd 100644 > --- a/arch/powerpc/Makefile > +++ b/arch/powerpc/Makefile > @@ -59,6 +59,11 @@ ifeq ($(CONFIG_PPC64)$(CONFIG_LD_IS_BFD),yy) > KBUILD_LDFLAGS_MODULE += --save-restore-funcs > else > KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o > + > +crtsavres_prepare: scripts > + $(MAKE) $(build)=arch/powerpc/lib arch/powerpc/lib/crtsavres.o > + > +modules_prepare: crtsavres_prepare > endif > > ifdef CONFIG_CPU_LITTLE_ENDIAN >
On Mon, Feb 5, 2024 at 10:22 PM Jan Stancek <jstancek@redhat.com> wrote: > > On Mon, Feb 5, 2024 at 12:50 PM Michael Ellerman <mpe@ellerman.idau> wrote: > > > > Jan Stancek <jstancek@redhat.com> writes: > > > On Tue, Nov 21, 2023 at 10:51:34AM +1000, Nicholas Piggin wrote: > > >>On Tue Nov 21, 2023 at 9:23 AM AEST, Masahiro Yamada wrote: > > >>> crtsavres.o is linked to modules. However, as explained in commit > > >>> d0e628cd817f ("kbuild: doc: clarify the difference between extra-y > > >>> and always-y"), 'make modules' does not build extra-y. > > >>> > > >>> For example, the following command fails: > > >>> > > >>> $ make ARCH=powerpc LLVM=1 KBUILD_MODPOST_WARN=1 mrproper ps3_defconfig modules > > >>> [snip] > > >>> LD [M] arch/powerpc/platforms/cell/spufs/spufs.ko > > >>> ld.lld: error: cannot open arch/powerpc/lib/crtsavres.o: No such file or directory > > >>> make[3]: *** [scripts/Makefile.modfinal:56: arch/powerpc/platforms/cell/spufs/spufs.ko] Error 1 > > >>> make[2]: *** [Makefile:1844: modules] Error 2 > > >>> make[1]: *** [/home/masahiro/workspace/linux-kbuild/Makefile:350: __build_one_by_one] Error 2 > > >>> make: *** [Makefile:234: __sub-make] Error 2 > > >>> > > >> > > >>Thanks. Is this the correct Fixes tag? > > >> > > >>Fixes: d0e628cd817f ("powerpc/64: Do not link crtsavres.o in vmlinux") > > >> > > >>Hmm, looks like LLD might just do this now automatically for us > > >>too without --save-restore-funcs (https://reviews.llvm.org/D79977). > > >>But we probably still need it for older versions, so we still need > > >>your patch. > > > > > > Hi, > > > > > > I'm still seeing the error of crtsavres.o missing when building external modules > > > after "make LLVM=1 modules_prepare". Should it be built also in archprepare? > > > > Or modules_prepare? > > > > Example patch below. > > I tested your patch with my setup and that works for me as well. > Please note 'make ARCH=powerpc clean' will remove '*.o' files globally. Kbuild promised you would still be able to compile external modules after 'make clean' (until you run 'make mrproper'), but that would not work in this case. So, the external module support for powerpc is broken in another way, already. Perhaps, an easy workaround might be to change the suffix, but I did not test it at all. mv arch/powerpc/lib/crtsavres.o arch/powerpc/lib/crtsavres.o.do_not_remove_me
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile index 51ad0397c17a..6eac63e79a89 100644 --- a/arch/powerpc/lib/Makefile +++ b/arch/powerpc/lib/Makefile @@ -45,7 +45,7 @@ obj-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o # so it is only needed for modules, and only for older linkers which # do not support --save-restore-funcs ifndef CONFIG_LD_IS_BFD -extra-$(CONFIG_PPC64) += crtsavres.o +always-$(CONFIG_PPC64) += crtsavres.o endif obj-$(CONFIG_PPC_BOOK3S_64) += copyuser_power7.o copypage_power7.o \