All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: Nicholas Piggin <npiggin@gmail.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	linuxppc-dev@lists.ozlabs.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,
	jstancek@redhat.com
Subject: Re: [PATCH] powerpc: add crtsavres.o to always-y instead of extra-y
Date: Tue, 30 Jan 2024 10:54:20 +0100	[thread overview]
Message-ID: <ZbjHTMhQ4Z9lRR6L@t14s> (raw)
In-Reply-To: <CX42TU4QHS1Z.A0UUHMDAMZOL@wheely>

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


WARNING: multiple messages have this Message-ID (diff)
From: Jan Stancek <jstancek@redhat.com>
To: Nicholas Piggin <npiggin@gmail.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>,
	llvm@lists.linux.dev, Nick Desaulniers <ndesaulniers@google.com>,
	linux-kernel@vger.kernel.org,
	Nathan Chancellor <nathan@kernel.org>, Tom Rix <trix@redhat.com>,
	linuxppc-dev@lists.ozlabs.org, jstancek@redhat.com
Subject: Re: [PATCH] powerpc: add crtsavres.o to always-y instead of extra-y
Date: Tue, 30 Jan 2024 10:54:20 +0100	[thread overview]
Message-ID: <ZbjHTMhQ4Z9lRR6L@t14s> (raw)
In-Reply-To: <CX42TU4QHS1Z.A0UUHMDAMZOL@wheely>

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


  parent reply	other threads:[~2024-01-30 10:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-20 23:23 [PATCH] powerpc: add crtsavres.o to always-y instead of extra-y Masahiro Yamada
2023-11-20 23:23 ` Masahiro Yamada
2023-11-21  0:51 ` Nicholas Piggin
2023-11-21  0:51   ` Nicholas Piggin
2023-11-21  9:55   ` Aneesh Kumar K.V
2023-11-22  3:09     ` Masahiro Yamada
2023-11-22  3:09       ` Masahiro Yamada
2023-11-22 12:54       ` Michael Ellerman
2023-11-22 12:54         ` Michael Ellerman
2024-01-30  9:54   ` Jan Stancek [this message]
2024-01-30  9:54     ` Jan Stancek
2024-02-05 11:50     ` Michael Ellerman
2024-02-05 11:50       ` Michael Ellerman
2024-02-05 13:21       ` Jan Stancek
2024-02-05 13:21         ` Jan Stancek
2024-02-05 20:50         ` Masahiro Yamada
2024-02-05 20:50           ` Masahiro Yamada
2023-12-07 12:38 ` Michael Ellerman
2023-12-07 12:38   ` Michael Ellerman
  -- strict thread matches above, loose matches on Subject: below --
2023-01-19  8:24 Masahiro Yamada
2023-01-19  8:24 ` Masahiro Yamada
2023-01-19 18:44 ` Nathan Chancellor
2023-01-19 18:44   ` Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZbjHTMhQ4Z9lRR6L@t14s \
    --to=jstancek@redhat.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=llvm@lists.linux.dev \
    --cc=masahiroy@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=npiggin@gmail.com \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.