[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAhV-H5=w82CDx=1=PZjf4FVW_dGWe_e__QazwDTwE3kKXtPLQ@mail.gmail.com>
Date: Sat, 20 Sep 2025 16:23:52 +0800
From: Huacai Chen <chenhuacai@...nel.org>
To: Nathan Chancellor <nathan@...nel.org>
Cc: Tiezhu Yang <yangtiezhu@...ngson.cn>, Miguel Ojeda <ojeda@...nel.org>,
WANG Rui <wangrui@...ngson.cn>, rust-for-linux@...r.kernel.org,
loongarch@...ts.linux.dev, linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH v1 1/2] LoongArch: Make LTO case independent in Makefile
On Sat, Sep 20, 2025 at 2:15 PM Nathan Chancellor <nathan@...nel.org> wrote:
>
> Hi Tiezhu,
>
> On Tue, Sep 09, 2025 at 05:27:06PM +0800, Tiezhu Yang wrote:
> > LTO is not only used for Clang, it maybe used for Rust, make LTO case out
> > of CONFIG_CC_HAS_ANNOTATE_TABLEJUMP in Makefile.
> >
> > This is preparation for later patch, no function changes.
> >
> > Suggested-by: WANG Rui <wangrui@...ngson.cn>
> > Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>
> > ---
> > arch/loongarch/Makefile | 10 +++++-----
> > 1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
> > index a3a9759414f4..9d80af7f75c8 100644
> > --- a/arch/loongarch/Makefile
> > +++ b/arch/loongarch/Makefile
> > @@ -102,16 +102,16 @@ KBUILD_CFLAGS += $(call cc-option,-mthin-add-sub) $(call cc-option,-Wa$(comma)
> >
> > ifdef CONFIG_OBJTOOL
> > ifdef CONFIG_CC_HAS_ANNOTATE_TABLEJUMP
> > +KBUILD_CFLAGS += -mannotate-tablejump
> > +else
> > +KBUILD_CFLAGS += -fno-jump-tables # keep compatibility with older compilers
> > +endif
> > +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_CFLAGS += -mannotate-tablejump
> > -ifdef CONFIG_LTO_CLANG
> > KBUILD_LDFLAGS += -mllvm --loongarch-annotate-tablejump
> > endif
> > -else
> > -KBUILD_CFLAGS += -fno-jump-tables # keep compatibility with older compilers
> > -endif
> > endif
> >
> > KBUILD_RUSTFLAGS += --target=loongarch64-unknown-none-softfloat -Ccode-model=small
> > --
> > 2.42.0
> >
>
> This change is now in -next as commit b15212824a01 ("LoongArch: Make LTO
> case independent in Makefile"), where it breaks the build for clang-18,
> as '--loongarch-annotate-tablejump' is unimplemented there but there is
> no version check before using it.
>
> $ make -skj"$(nproc)" ARCH=loongarch LLVM=1 mrproper defconfig
>
> $ scripts/config -d LTO_NONE -e LTO_CLANG_THIN
>
> $ make -skj"$(nproc)" ARCH=loongarch LLVM=1 olddefconfig vmlinuz.efi
> ld.lld: error: -mllvm: ld.lld: Unknown command line argument '--loongarch-annotate-tablejump'.
> ...
>
> $ scripts/config -s CC_HAS_ANNOTATE_TABLEJUMP
> undef
Hmm, maybe we need this?
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
>
> Cheers,
> Nathan
Powered by blists - more mailing lists