Skip to content

Commit b06449a

Browse files
committed
rust: kbuild: support -Cjump-tables=n for Rust 1.93.0
Rust 1.93.0 (expected 2026-01-22) is stabilizing `-Zno-jump-tables` [1][2] as `-Cjump-tables=n` [3]. Without this change, one would eventually see: RUSTC L rust/core.o error: unknown unstable option: `no-jump-tables` Thus support the upcoming version. Cc: stable@vger.kernel.org # Needed in 6.12.y and later (Rust is pinned in older LTSs). Link: rust-lang/rust#116592 [1] Link: rust-lang/rust#105812 [2] Link: rust-lang/rust#145974 [3] Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Trevor Gross <tmgross@umich.edu> Acked-by: Nicolas Schier <nsc@kernel.org> Link: https://patch.msgid.link/20251101094011.1024534-1-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent 6146a0f commit b06449a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

arch/loongarch/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ endif
109109
ifdef CONFIG_RUSTC_HAS_ANNOTATE_TABLEJUMP
110110
KBUILD_RUSTFLAGS += -Cllvm-args=--loongarch-annotate-tablejump
111111
else
112-
KBUILD_RUSTFLAGS += -Zno-jump-tables # keep compatibility with older compilers
112+
KBUILD_RUSTFLAGS += $(if $(call rustc-min-version,109300),-Cjump-tables=n,-Zno-jump-tables) # keep compatibility with older compilers
113113
endif
114114
ifdef CONFIG_LTO_CLANG
115115
# The annotate-tablejump option can not be passed to LLVM backend when LTO is enabled.

arch/x86/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ ifeq ($(CONFIG_X86_KERNEL_IBT),y)
9898
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104816
9999
#
100100
KBUILD_CFLAGS += $(call cc-option,-fcf-protection=branch -fno-jump-tables)
101-
KBUILD_RUSTFLAGS += -Zcf-protection=branch -Zno-jump-tables
101+
KBUILD_RUSTFLAGS += -Zcf-protection=branch $(if $(call rustc-min-version,109300),-Cjump-tables=n,-Zno-jump-tables)
102102
else
103103
KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)
104104
endif

0 commit comments

Comments
 (0)