]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rust: kbuild: support `-Cjump-tables=n` for Rust 1.93.0
authorMiguel Ojeda <ojeda@kernel.org>
Sat, 1 Nov 2025 09:40:11 +0000 (10:40 +0100)
committerMiguel Ojeda <ojeda@kernel.org>
Tue, 4 Nov 2025 18:11:39 +0000 (19:11 +0100)
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.

Link: https://github.com/rust-lang/rust/issues/116592
Link: https://github.com/rust-lang/rust/pull/105812
Link: https://github.com/rust-lang/rust/pull/145974
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>
arch/loongarch/Makefile
arch/x86/Makefile

index dc5bd3f1b8d2cbe070cbc4257f21796ad41650ef..96ca1a688984e9add8cb545047d5f3a8d2077721 100644 (file)
@@ -109,7 +109,7 @@ endif
 ifdef CONFIG_RUSTC_HAS_ANNOTATE_TABLEJUMP
 KBUILD_RUSTFLAGS               += -Cllvm-args=--loongarch-annotate-tablejump
 else
-KBUILD_RUSTFLAGS               += -Zno-jump-tables # keep compatibility with older compilers
+KBUILD_RUSTFLAGS               += $(if $(call rustc-min-version,109300),-Cjump-tables=n,-Zno-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.
index 8fbff3106c56eb92699e1126f41dbbb371620d99..1a27efcf3c205a3b78476bd47988e90ce839d87e 100644 (file)
@@ -98,7 +98,7 @@ ifeq ($(CONFIG_X86_KERNEL_IBT),y)
 #   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104816
 #
 KBUILD_CFLAGS += $(call cc-option,-fcf-protection=branch -fno-jump-tables)
-KBUILD_RUSTFLAGS += -Zcf-protection=branch -Zno-jump-tables
+KBUILD_RUSTFLAGS += -Zcf-protection=branch $(if $(call rustc-min-version,109300),-Cjump-tables=n,-Zno-jump-tables)
 else
 KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)
 endif