[PATCH] powerpc/Makefile: use $(objtree) for crtsavres.o

A. Sverdlin posted 1 patch 1 week, 5 days ago
arch/powerpc/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] powerpc/Makefile: use $(objtree) for crtsavres.o
Posted by A. Sverdlin 1 week, 5 days ago
From: Alexander Sverdlin <alexander.sverdlin@siemens.com>

... otherwise it could be problematic to build external modules:

make[2]: Entering directory '.../kernel-module-hello-world'
|   CC [M]  hello-world.o
|   MODPOST Module.symvers
|   CC [M]  hello-world.mod.o
|   CC [M]  .module-common.o
|   LD [M]  hello-world.ko
| powerpc-poky-linux-ld.bfd: cannot find arch/powerpc/lib/crtsavres.o: No such file or directory

Fixes: da3de6df33f5 ("[POWERPC] Fix -Os kernel builds with newer gcc versions")
Cc: stable@vger.kernel.org
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
---
 arch/powerpc/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 9753fb87217c3..a58b1029592ce 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -58,7 +58,7 @@ ifeq ($(CONFIG_PPC64)$(CONFIG_LD_IS_BFD),yy)
 # There is a corresponding test in arch/powerpc/lib/Makefile
 KBUILD_LDFLAGS_MODULE += --save-restore-funcs
 else
-KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
+KBUILD_LDFLAGS_MODULE += $(objtree)/arch/powerpc/lib/crtsavres.o
 endif
 
 ifdef CONFIG_CPU_LITTLE_ENDIAN
-- 
2.51.0
Re: [PATCH] powerpc/Makefile: use $(objtree) for crtsavres.o
Posted by Christophe Leroy 1 week, 2 days ago

Le 19/09/2025 à 14:14, A. Sverdlin a écrit :
> [Vous ne recevez pas souvent de courriers de alexander.sverdlin@siemens.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
> 
> From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> 
> ... otherwise it could be problematic to build external modules:
> 
> make[2]: Entering directory '.../kernel-module-hello-world'
> |   CC [M]  hello-world.o
> |   MODPOST Module.symvers
> |   CC [M]  hello-world.mod.o
> |   CC [M]  .module-common.o
> |   LD [M]  hello-world.ko
> | powerpc-poky-linux-ld.bfd: cannot find arch/powerpc/lib/crtsavres.o: No such file or directory
> 
> Fixes: da3de6df33f5 ("[POWERPC] Fix -Os kernel builds with newer gcc versions")
> Cc: stable@vger.kernel.org
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>

This change is already done it seems, see 
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20250218-buildfix-extmod-powerpc-v2-1-1e78fcf12b56@efficios.com/

> ---
>   arch/powerpc/Makefile | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index 9753fb87217c3..a58b1029592ce 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -58,7 +58,7 @@ ifeq ($(CONFIG_PPC64)$(CONFIG_LD_IS_BFD),yy)
>   # There is a corresponding test in arch/powerpc/lib/Makefile
>   KBUILD_LDFLAGS_MODULE += --save-restore-funcs
>   else
> -KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
> +KBUILD_LDFLAGS_MODULE += $(objtree)/arch/powerpc/lib/crtsavres.o
>   endif
> 
>   ifdef CONFIG_CPU_LITTLE_ENDIAN
> --
> 2.51.0
> 

Re: [PATCH] powerpc/Makefile: use $(objtree) for crtsavres.o
Posted by Sverdlin, Alexander 1 week, 2 days ago
Hi Christophe,

On Mon, 2025-09-22 at 15:08 +0200, Christophe Leroy wrote:
> Le 19/09/2025 à 14:14, A. Sverdlin a écrit :
> > [Vous ne recevez pas souvent de courriers de alexander.sverdlin@siemens.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
> > 
> > From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> > 
> > ... otherwise it could be problematic to build external modules:
> > 
> > make[2]: Entering directory '.../kernel-module-hello-world'
> > >    CC [M]  hello-world.o
> > >    MODPOST Module.symvers
> > >    CC [M]  hello-world.mod.o
> > >    CC [M]  .module-common.o
> > >    LD [M]  hello-world.ko
> > > powerpc-poky-linux-ld.bfd: cannot find arch/powerpc/lib/crtsavres.o: No such file or directory
> > 
> > Fixes: da3de6df33f5 ("[POWERPC] Fix -Os kernel builds with newer gcc versions")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> 
> This change is already done it seems, see 
> https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20250218-buildfix-extmod-powerpc-v2-1-1e78fcf12b56@efficios.com/

thanks for the link! My bad, I didn't look into linux-next! Sorry for the noise!

-- 
Alexander Sverdlin
Siemens AG
www.siemens.com