From: Nathan Chancellor <nathan@kernel.org>
To: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Huacai Chen <chenhuacai@kernel.org>,
Miguel Ojeda <ojeda@kernel.org>, WANG Rui <wangrui@loongson.cn>,
rust-for-linux@vger.kernel.org, loongarch@lists.linux.dev,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH v1 1/2] LoongArch: Make LTO case independent in Makefile
Date: Fri, 19 Sep 2025 23:15:36 -0700 [thread overview]
Message-ID: <20250920061536.GA1460394@ax162> (raw)
In-Reply-To: <20250909092707.3127-2-yangtiezhu@loongson.cn>
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@loongson.cn>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.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
Cheers,
Nathan
next prev parent reply other threads:[~2025-09-20 6:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-09 9:27 [PATCH v1 0/2] Fix objtool warnings with RUST on LoongArch Tiezhu Yang
2025-09-09 9:27 ` [PATCH v1 1/2] LoongArch: Make LTO case independent in Makefile Tiezhu Yang
2025-09-20 6:15 ` Nathan Chancellor [this message]
2025-09-20 8:23 ` Huacai Chen
2025-09-20 9:19 ` Tiezhu Yang
2025-09-20 10:22 ` Tiezhu Yang
2025-09-20 11:41 ` Huacai Chen
2025-09-20 12:52 ` Tiezhu Yang
2025-09-23 1:10 ` Nathan Chancellor
2025-09-23 3:13 ` Tiezhu Yang
2025-09-09 9:27 ` [PATCH v1 2/2] LoongArch: Handle jump tables option for RUST Tiezhu Yang
2025-09-09 10:16 ` Miguel Ojeda
2025-09-09 18:06 ` Matthew Maurer
2025-09-09 20:14 ` Miguel Ojeda
2025-09-18 9:15 ` [PATCH v1 0/2] Fix objtool warnings with RUST on LoongArch Huacai Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250920061536.GA1460394@ax162 \
--to=nathan@kernel.org \
--cc=chenhuacai@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=loongarch@lists.linux.dev \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=wangrui@loongson.cn \
--cc=yangtiezhu@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.