* [PATCH] powerpc: add crtsavres.o to always-y instead of extra-y
@ 2023-01-19 8:24 Masahiro Yamada
2023-01-19 18:44 ` Nathan Chancellor
0 siblings, 1 reply; 12+ messages in thread
From: Masahiro Yamada @ 2023-01-19 8:24 UTC (permalink / raw)
To: Michael Ellerman, Nicholas Piggin, Christophe Leroy, linuxppc-dev
Cc: Tom Rix, Masahiro Yamada, llvm, Nick Desaulniers, linux-kernel,
Nathan Chancellor
crtsavres.o is linked to modules, but as commit d0e628cd817f ("kbuild:
doc: clarify the difference between extra-y and always-y") explained,
'make modules' does not build extra-y.
The following command fails:
$ make ARCH=powerpc LLVM=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[1]: *** [scripts/Makefile.modfinal:61: arch/powerpc/platforms/cell/spufs/spufs.ko] Error 1
make: *** [Makefile:1924: modules] Error 2
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 c53618c34b70..aa34854bc9f5 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -43,7 +43,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 \
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH] powerpc: add crtsavres.o to always-y instead of extra-y
2023-01-19 8:24 [PATCH] powerpc: add crtsavres.o to always-y instead of extra-y Masahiro Yamada
@ 2023-01-19 18:44 ` Nathan Chancellor
0 siblings, 0 replies; 12+ messages in thread
From: Nathan Chancellor @ 2023-01-19 18:44 UTC (permalink / raw)
To: Masahiro Yamada
Cc: llvm, Nick Desaulniers, linux-kernel, Nicholas Piggin, Tom Rix,
linuxppc-dev
On Thu, Jan 19, 2023 at 05:24:47PM +0900, Masahiro Yamada wrote:
> crtsavres.o is linked to modules, but as commit d0e628cd817f ("kbuild:
> doc: clarify the difference between extra-y and always-y") explained,
> 'make modules' does not build extra-y.
>
> The following command fails:
>
> $ make ARCH=powerpc LLVM=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[1]: *** [scripts/Makefile.modfinal:61: arch/powerpc/platforms/cell/spufs/spufs.ko] Error 1
> make: *** [Makefile:1924: modules] Error 2
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@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 c53618c34b70..aa34854bc9f5 100644
> --- a/arch/powerpc/lib/Makefile
> +++ b/arch/powerpc/lib/Makefile
> @@ -43,7 +43,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 \
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] powerpc: add crtsavres.o to always-y instead of extra-y
@ 2023-11-20 23:23 Masahiro Yamada
2023-11-21 0:51 ` Nicholas Piggin
2023-12-07 12:38 ` Michael Ellerman
0 siblings, 2 replies; 12+ messages in thread
From: Masahiro Yamada @ 2023-11-20 23:23 UTC (permalink / raw)
To: Michael Ellerman, Nicholas Piggin, Christophe Leroy, linuxppc-dev
Cc: Tom Rix, Masahiro Yamada, llvm, Nick Desaulniers, linux-kernel,
Nathan Chancellor
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(-)
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 \
--
2.40.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH] powerpc: add crtsavres.o to always-y instead of extra-y
2023-11-20 23:23 Masahiro Yamada
@ 2023-11-21 0:51 ` Nicholas Piggin
2023-11-21 9:55 ` Aneesh Kumar K.V
2024-01-30 9:54 ` Jan Stancek
2023-12-07 12:38 ` Michael Ellerman
1 sibling, 2 replies; 12+ messages in thread
From: Nicholas Piggin @ 2023-11-21 0:51 UTC (permalink / raw)
To: Masahiro Yamada, Michael Ellerman, Christophe Leroy, linuxppc-dev
Cc: Nathan Chancellor, Tom Rix, llvm, Nick Desaulniers, linux-kernel
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 \
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] powerpc: add crtsavres.o to always-y instead of extra-y
2023-11-21 0:51 ` Nicholas Piggin
@ 2023-11-21 9:55 ` Aneesh Kumar K.V
2023-11-22 3:09 ` Masahiro Yamada
2024-01-30 9:54 ` Jan Stancek
1 sibling, 1 reply; 12+ messages in thread
From: Aneesh Kumar K.V @ 2023-11-21 9:55 UTC (permalink / raw)
To: Nicholas Piggin, Masahiro Yamada, Michael Ellerman,
Christophe Leroy, linuxppc-dev
Cc: Nathan Chancellor, Tom Rix, llvm, Nick Desaulniers, linux-kernel
"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
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] powerpc: add crtsavres.o to always-y instead of extra-y
2023-11-21 9:55 ` Aneesh Kumar K.V
@ 2023-11-22 3:09 ` Masahiro Yamada
2023-11-22 12:54 ` Michael Ellerman
0 siblings, 1 reply; 12+ messages in thread
From: Masahiro Yamada @ 2023-11-22 3:09 UTC (permalink / raw)
To: Aneesh Kumar K.V
Cc: llvm, Nick Desaulniers, linux-kernel, Nathan Chancellor,
Nicholas Piggin, Tom Rix, linuxppc-dev
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")
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] powerpc: add crtsavres.o to always-y instead of extra-y
2023-11-22 3:09 ` Masahiro Yamada
@ 2023-11-22 12:54 ` Michael Ellerman
0 siblings, 0 replies; 12+ messages in thread
From: Michael Ellerman @ 2023-11-22 12:54 UTC (permalink / raw)
To: Masahiro Yamada, Aneesh Kumar K.V
Cc: Tom Rix, llvm, Nick Desaulniers, linux-kernel, Nathan Chancellor,
Nicholas Piggin, linuxppc-dev
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] powerpc: add crtsavres.o to always-y instead of extra-y
2023-11-21 0:51 ` Nicholas Piggin
2023-11-21 9:55 ` Aneesh Kumar K.V
@ 2024-01-30 9:54 ` Jan Stancek
2024-02-05 11:50 ` Michael Ellerman
1 sibling, 1 reply; 12+ messages in thread
From: Jan Stancek @ 2024-01-30 9:54 UTC (permalink / raw)
To: Nicholas Piggin
Cc: Masahiro Yamada, llvm, Nick Desaulniers, linux-kernel,
Nathan Chancellor, Tom Rix, linuxppc-dev, jstancek
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
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH] powerpc: add crtsavres.o to always-y instead of extra-y
2024-01-30 9:54 ` Jan Stancek
@ 2024-02-05 11:50 ` Michael Ellerman
2024-02-05 13:21 ` Jan Stancek
0 siblings, 1 reply; 12+ messages in thread
From: Michael Ellerman @ 2024-02-05 11:50 UTC (permalink / raw)
To: Jan Stancek, Nicholas Piggin
Cc: Tom Rix, Masahiro Yamada, llvm, Nick Desaulniers, linux-kernel,
Nathan Chancellor, linuxppc-dev, jstancek
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
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH] powerpc: add crtsavres.o to always-y instead of extra-y
2024-02-05 11:50 ` Michael Ellerman
@ 2024-02-05 13:21 ` Jan Stancek
2024-02-05 20:50 ` Masahiro Yamada
0 siblings, 1 reply; 12+ messages in thread
From: Jan Stancek @ 2024-02-05 13:21 UTC (permalink / raw)
To: Michael Ellerman
Cc: Tom Rix, Masahiro Yamada, llvm, Nick Desaulniers, linux-kernel,
Nathan Chancellor, Nicholas Piggin, linuxppc-dev
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
>
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] powerpc: add crtsavres.o to always-y instead of extra-y
2024-02-05 13:21 ` Jan Stancek
@ 2024-02-05 20:50 ` Masahiro Yamada
0 siblings, 0 replies; 12+ messages in thread
From: Masahiro Yamada @ 2024-02-05 20:50 UTC (permalink / raw)
To: Jan Stancek
Cc: llvm, Nick Desaulniers, linux-kernel, Nathan Chancellor,
Nicholas Piggin, Tom Rix, linuxppc-dev
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.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.
>
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
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] powerpc: add crtsavres.o to always-y instead of extra-y
2023-11-20 23:23 Masahiro Yamada
2023-11-21 0:51 ` Nicholas Piggin
@ 2023-12-07 12:38 ` Michael Ellerman
1 sibling, 0 replies; 12+ messages in thread
From: Michael Ellerman @ 2023-12-07 12:38 UTC (permalink / raw)
To: Nicholas Piggin, Christophe Leroy, linuxppc-dev, Masahiro Yamada
Cc: Nathan Chancellor, Tom Rix, llvm, Nick Desaulniers, linux-kernel
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
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2024-02-05 20:52 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-19 8:24 [PATCH] powerpc: add crtsavres.o to always-y instead of extra-y Masahiro Yamada
2023-01-19 18:44 ` Nathan Chancellor
-- strict thread matches above, loose matches on Subject: below --
2023-11-20 23:23 Masahiro Yamada
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 12:54 ` Michael Ellerman
2024-01-30 9:54 ` Jan Stancek
2024-02-05 11:50 ` Michael Ellerman
2024-02-05 13:21 ` Jan Stancek
2024-02-05 20:50 ` Masahiro Yamada
2023-12-07 12:38 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).