[PATCH v2] kbuild: Add missing $(objtree) prefix to powerpc crtsavres.o artifact

Kienan Stewart posted 1 patch 10 months ago
arch/powerpc/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v2] kbuild: Add missing $(objtree) prefix to powerpc crtsavres.o artifact
Posted by Kienan Stewart 10 months ago
In the upstream commit 214c0eea43b2ea66bcd6467ea57e47ce8874191b
("kbuild: add $(objtree)/ prefix to some in-kernel build artifacts")
artifacts required for building out-of-tree kernel modules had
$(objtree) prepended to them to prepare for building in other
directories.

When building external modules for powerpc,
arch/powerpc/lib/crtsavres.o is required for certain
configurations. This artifact is missing the prepended $(objtree).

Fixes: 13b25489b6f8 ("kbuild: change working directory to external module directory with M=")
Acked-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <n.schier@avm.de>
Tested-by: Nicolas Schier <n.schier@avm.de>
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
---
Changes in v2:
- Added Review-by/Tested-by/Fixes/Acked-By
- Removed mention of possible work-around for external modules (while
the build will pass, `make modules_install` will fail)
- Link to v1: https://lore.kernel.org/r/20250127-buildfix-extmod-powerpc-v1-1-450012b16263@efficios.com
---
 arch/powerpc/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index f3804103c56ccfdb16289468397ccaea71bf721e..9933b98df69d7f7b9aaf33d36155cc61ab4460c7 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

---
base-commit: ffd294d346d185b70e28b1a28abe367bbfe53c04
change-id: 20250127-buildfix-extmod-powerpc-a744e1331f83

Best regards,
-- 
Kienan Stewart <kstewart@efficios.com>
Re: [PATCH v2] kbuild: Add missing $(objtree) prefix to powerpc crtsavres.o artifact
Posted by Madhavan Srinivasan 3 months, 1 week ago
On Tue, 18 Feb 2025 15:26:39 -0500, Kienan Stewart wrote:
> In the upstream commit 214c0eea43b2ea66bcd6467ea57e47ce8874191b
> ("kbuild: add $(objtree)/ prefix to some in-kernel build artifacts")
> artifacts required for building out-of-tree kernel modules had
> $(objtree) prepended to them to prepare for building in other
> directories.
> 
> When building external modules for powerpc,
> arch/powerpc/lib/crtsavres.o is required for certain
> configurations. This artifact is missing the prepended $(objtree).
> 
> [...]

Applied to powerpc/next.

[1/1] kbuild: Add missing $(objtree) prefix to powerpc crtsavres.o artifact
      https://git.kernel.org/powerpc/c/46104a7d3ccd2acfe508e661393add0615c27a22

Thanks
Re: [PATCH v2] kbuild: Add missing $(objtree) prefix to powerpc crtsavres.o artifact
Posted by Mathieu Desnoyers 9 months, 1 week ago
On 18-Feb-2025 03:26:39 PM, Kienan Stewart wrote:
> In the upstream commit 214c0eea43b2ea66bcd6467ea57e47ce8874191b
> ("kbuild: add $(objtree)/ prefix to some in-kernel build artifacts")
> artifacts required for building out-of-tree kernel modules had
> $(objtree) prepended to them to prepare for building in other
> directories.
> 
> When building external modules for powerpc,
> arch/powerpc/lib/crtsavres.o is required for certain
> configurations. This artifact is missing the prepended $(objtree).

FYI, the issue resolved here breaks the build of LTTng-modules against
recent kernels on powerpc. I would gladly welcome upstreaming of this
fix into the Linux kernel.

Thanks!

Mathieu

> 
> Fixes: 13b25489b6f8 ("kbuild: change working directory to external module directory with M=")
> Acked-by: Masahiro Yamada <masahiroy@kernel.org>
> Reviewed-by: Nicolas Schier <n.schier@avm.de>
> Tested-by: Nicolas Schier <n.schier@avm.de>
> Signed-off-by: Kienan Stewart <kstewart@efficios.com>
> ---
> Changes in v2:
> - Added Review-by/Tested-by/Fixes/Acked-By
> - Removed mention of possible work-around for external modules (while
> the build will pass, `make modules_install` will fail)
> - Link to v1: https://lore.kernel.org/r/20250127-buildfix-extmod-powerpc-v1-1-450012b16263@efficios.com
> ---
>  arch/powerpc/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index f3804103c56ccfdb16289468397ccaea71bf721e..9933b98df69d7f7b9aaf33d36155cc61ab4460c7 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
> 
> ---
> base-commit: ffd294d346d185b70e28b1a28abe367bbfe53c04
> change-id: 20250127-buildfix-extmod-powerpc-a744e1331f83
> 
> Best regards,
> -- 
> Kienan Stewart <kstewart@efficios.com>
> 

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com