All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] LoongArch: Fix build error for LTO with LLVM-18
@ 2025-09-23 13:01 Huacai Chen
  2025-09-23 23:07 ` Nathan Chancellor
  0 siblings, 1 reply; 2+ messages in thread
From: Huacai Chen @ 2025-09-23 13:01 UTC (permalink / raw)
  To: Huacai Chen
  Cc: loongarch, Xuefeng Li, Guo Ren, Xuerui Wang, Jiaxun Yang,
	linux-kernel, Huacai Chen, Nathan Chancellor, WANG Rui

Commit b15212824a01 ("LoongArch: Make LTO case independent in Makefile")
moves "KBUILD_LDFLAGS += -mllvm --loongarch-annotate-tablejump" out of
CONFIG_CC_HAS_ANNOTATE_TABLEJUMP, which breaks the build for LLVM-18, as
'--loongarch-annotate-tablejump' is unimplemented there:

ld.lld: error: -mllvm: ld.lld: Unknown command line argument '--loongarch-annotate-tablejump'.

Call ld-option to detect '--loongarch-annotate-tablejump' before use, so
as to fix the build error.

Fixes: b15212824a01 ("LoongArch: Make LTO case independent in Makefile")
Reported-by: Nathan Chancellor <nathan@kernel.org>
Suggested-by: WANG Rui <wangrui@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
 arch/loongarch/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
index ae419e32f22e..fcfa793f9bb0 100644
--- a/arch/loongarch/Makefile
+++ b/arch/loongarch/Makefile
@@ -115,7 +115,7 @@ ifdef CONFIG_LTO_CLANG
 # The annotate-tablejump option can not be passed to LLVM backend when LTO is enabled.
 # Ensure it is aware of linker with LTO, '--loongarch-annotate-tablejump' also needs to
 # be passed via '-mllvm' to ld.lld.
-KBUILD_LDFLAGS			+= -mllvm --loongarch-annotate-tablejump
+KBUILD_LDFLAGS			+= $(call ld-option,-mllvm --loongarch-annotate-tablejump)
 endif
 endif
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] LoongArch: Fix build error for LTO with LLVM-18
  2025-09-23 13:01 [PATCH] LoongArch: Fix build error for LTO with LLVM-18 Huacai Chen
@ 2025-09-23 23:07 ` Nathan Chancellor
  0 siblings, 0 replies; 2+ messages in thread
From: Nathan Chancellor @ 2025-09-23 23:07 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Huacai Chen, loongarch, Xuefeng Li, Guo Ren, Xuerui Wang,
	Jiaxun Yang, linux-kernel, WANG Rui

On Tue, Sep 23, 2025 at 09:01:22PM +0800, Huacai Chen wrote:
> Commit b15212824a01 ("LoongArch: Make LTO case independent in Makefile")
> moves "KBUILD_LDFLAGS += -mllvm --loongarch-annotate-tablejump" out of
> CONFIG_CC_HAS_ANNOTATE_TABLEJUMP, which breaks the build for LLVM-18, as
> '--loongarch-annotate-tablejump' is unimplemented there:
> 
> ld.lld: error: -mllvm: ld.lld: Unknown command line argument '--loongarch-annotate-tablejump'.
> 
> Call ld-option to detect '--loongarch-annotate-tablejump' before use, so
> as to fix the build error.
> 
> Fixes: b15212824a01 ("LoongArch: Make LTO case independent in Makefile")
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Suggested-by: WANG Rui <wangrui@loongson.cn>
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org> # build

> ---
>  arch/loongarch/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
> index ae419e32f22e..fcfa793f9bb0 100644
> --- a/arch/loongarch/Makefile
> +++ b/arch/loongarch/Makefile
> @@ -115,7 +115,7 @@ ifdef CONFIG_LTO_CLANG
>  # The annotate-tablejump option can not be passed to LLVM backend when LTO is enabled.
>  # Ensure it is aware of linker with LTO, '--loongarch-annotate-tablejump' also needs to
>  # be passed via '-mllvm' to ld.lld.
> -KBUILD_LDFLAGS			+= -mllvm --loongarch-annotate-tablejump
> +KBUILD_LDFLAGS			+= $(call ld-option,-mllvm --loongarch-annotate-tablejump)
>  endif
>  endif
>  
> -- 
> 2.47.3
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-09-23 23:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-23 13:01 [PATCH] LoongArch: Fix build error for LTO with LLVM-18 Huacai Chen
2025-09-23 23:07 ` Nathan Chancellor

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.