Skip to contentSkip to conversation

rust: kbuild: support `-Cjump-tables=n` for Rust 1.93.0

PATCH Applied Miguel Ojeda 5 participants 6 messages Nov 1, 2025 – Nov 4, 2025

Subsystems (4)
lore
Share & tools
lore

Miguel Ojeda

author maintainer
#0 lore raw

PATCH 1/1 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.

---
 arch/loongarch/Makefile | 2 +-
 arch/x86/Makefile       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/loongarch/Makefile +1 -1
index dc5bd3f1b8d2..96ca1a688984 100644
@@ -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.
arch/x86/Makefile +1 -1
index 4db7e4bf69f5..c60371db49d9 100644
@@ -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

base-commit: dcb6fa37fd7bc9c3d2b066329b0d27dedf8becaa

Signature · 1 line
2.51.2
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Miguel Ojeda

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

Quoted 6 lines

Thus support the upcoming version.

Does this need a CC stable too?

#2 lore raw
Quoted 2 lines · Alice Ryhl

Does this need a CC stable too?

Definitely -- I just forgot my usual line:

Cc: [email protected] # Needed in 6.12.y and later (Rust is pinned in older LTSs).

Thanks!

I will apply this when upstream's PR gets merged and send it together with a couple other fixes.

Cheers,
Miguel

maintainer Acked-by on v1 1/1
#3 lore raw
In reply to Miguel Ojeda
Quoted 10 lines · Miguel Ojeda

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.

Quoted 9 lines
---
 arch/loongarch/Makefile | 2 +-
 arch/x86/Makefile       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
Nicolas
reviewer Reviewed-by on v1 1/1
#4 lore raw
In reply to Miguel Ojeda
Quoted 8 lines · Miguel Ojeda

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

Quoted 6 lines

Thus support the upcoming version.

Quoted 33 lines
---
 arch/loongarch/Makefile | 2 +-
 arch/x86/Makefile       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/loongarch/Makefile +1 -1
index dc5bd3f1b8d2..96ca1a688984 100644
@@ -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.
arch/x86/Makefile +1 -1
index 4db7e4bf69f5..c60371db49d9 100644
@@ -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

base-commit: dcb6fa37fd7bc9c3d2b066329b0d27dedf8becaa

Applied
#5 lore raw
In reply to Miguel Ojeda
Quoted 9 lines · Miguel Ojeda

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

Quoted 6 lines

Thus support the upcoming version.

It got stabilized and merged upstream.

Applied to rust-fixes -- thanks everyone!

Cheers,
Miguel