rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rust: kbuild: support `-Cjump-tables=n` for Rust 1.93.0
@ 2025-11-01  9:40 Miguel Ojeda
  2025-11-01 11:15 ` Alice Ryhl
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Miguel Ojeda @ 2025-11-01  9:40 UTC (permalink / raw)
  To: Miguel Ojeda, Alex Gaynor, Nathan Chancellor, Nicolas Schier,
	Huacai Chen, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
	rust-for-linux, linux-kbuild, WANG Xuerui, loongarch,
	H. Peter Anvin, linux-kernel, patches

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 [1]
Link: https://github.com/rust-lang/rust/pull/105812 [2]
Link: https://github.com/rust-lang/rust/pull/145974 [3]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
 arch/loongarch/Makefile | 2 +-
 arch/x86/Makefile       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
index dc5bd3f1b8d2..96ca1a688984 100644
--- a/arch/loongarch/Makefile
+++ b/arch/loongarch/Makefile
@@ -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.
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 4db7e4bf69f5..c60371db49d9 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -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
-- 
2.51.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] rust: kbuild: support `-Cjump-tables=n` for Rust 1.93.0
  2025-11-01  9:40 [PATCH] rust: kbuild: support `-Cjump-tables=n` for Rust 1.93.0 Miguel Ojeda
@ 2025-11-01 11:15 ` Alice Ryhl
  2025-11-01 15:53   ` Miguel Ojeda
  2025-11-01 17:25 ` Nicolas Schier
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Alice Ryhl @ 2025-11-01 11:15 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Alex Gaynor, Nathan Chancellor, Nicolas Schier, Huacai Chen,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Danilo Krummrich, rust-for-linux,
	linux-kbuild, WANG Xuerui, loongarch, H. Peter Anvin,
	linux-kernel, patches

On Sat, Nov 1, 2025 at 10:40 AM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> 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 [1]
> Link: https://github.com/rust-lang/rust/pull/105812 [2]
> Link: https://github.com/rust-lang/rust/pull/145974 [3]
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

Does this need a CC stable too?

Reviewed-by: Alice Ryhl <aliceryhl@google.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] rust: kbuild: support `-Cjump-tables=n` for Rust 1.93.0
  2025-11-01 11:15 ` Alice Ryhl
@ 2025-11-01 15:53   ` Miguel Ojeda
  0 siblings, 0 replies; 6+ messages in thread
From: Miguel Ojeda @ 2025-11-01 15:53 UTC (permalink / raw)
  To: Alice Ryhl
  Cc: Miguel Ojeda, Alex Gaynor, Nathan Chancellor, Nicolas Schier,
	Huacai Chen, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Danilo Krummrich,
	rust-for-linux, linux-kbuild, WANG Xuerui, loongarch,
	H. Peter Anvin, linux-kernel, patches

On Sat, Nov 1, 2025 at 12:15 PM Alice Ryhl <aliceryhl@google.com> wrote:
>
> Does this need a CC stable too?

Definitely -- I just forgot my usual line:

Cc: stable@vger.kernel.org # 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] rust: kbuild: support `-Cjump-tables=n` for Rust 1.93.0
  2025-11-01  9:40 [PATCH] rust: kbuild: support `-Cjump-tables=n` for Rust 1.93.0 Miguel Ojeda
  2025-11-01 11:15 ` Alice Ryhl
@ 2025-11-01 17:25 ` Nicolas Schier
  2025-11-02  7:57 ` Trevor Gross
  2025-11-04 19:25 ` Miguel Ojeda
  3 siblings, 0 replies; 6+ messages in thread
From: Nicolas Schier @ 2025-11-01 17:25 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Alex Gaynor, Nathan Chancellor, Huacai Chen, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, x86, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, rust-for-linux,
	linux-kbuild, WANG Xuerui, loongarch, H. Peter Anvin,
	linux-kernel, patches

On Sat, Nov 01, 2025 at 10:40:11AM +0100, Miguel Ojeda wrote:
> 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 [1]
> Link: https://github.com/rust-lang/rust/pull/105812 [2]
> Link: https://github.com/rust-lang/rust/pull/145974 [3]
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
> ---
>  arch/loongarch/Makefile | 2 +-
>  arch/x86/Makefile       | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 

Acked-by: Nicolas Schier <nsc@kernel.org>

-- 
Nicolas

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] rust: kbuild: support `-Cjump-tables=n` for Rust 1.93.0
  2025-11-01  9:40 [PATCH] rust: kbuild: support `-Cjump-tables=n` for Rust 1.93.0 Miguel Ojeda
  2025-11-01 11:15 ` Alice Ryhl
  2025-11-01 17:25 ` Nicolas Schier
@ 2025-11-02  7:57 ` Trevor Gross
  2025-11-04 19:25 ` Miguel Ojeda
  3 siblings, 0 replies; 6+ messages in thread
From: Trevor Gross @ 2025-11-02  7:57 UTC (permalink / raw)
  To: Miguel Ojeda, Alex Gaynor, Nathan Chancellor, Nicolas Schier,
	Huacai Chen, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
	rust-for-linux, linux-kbuild, WANG Xuerui, loongarch,
	H. Peter Anvin, linux-kernel, patches

On Sat Nov 1, 2025 at 4:40 AM CDT, Miguel Ojeda wrote:
> 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 [1]
> Link: https://github.com/rust-lang/rust/pull/105812 [2]
> Link: https://github.com/rust-lang/rust/pull/145974 [3]
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

Reviewed-by: Trevor Gross <tmgross@umich.edu>

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] rust: kbuild: support `-Cjump-tables=n` for Rust 1.93.0
  2025-11-01  9:40 [PATCH] rust: kbuild: support `-Cjump-tables=n` for Rust 1.93.0 Miguel Ojeda
                   ` (2 preceding siblings ...)
  2025-11-02  7:57 ` Trevor Gross
@ 2025-11-04 19:25 ` Miguel Ojeda
  3 siblings, 0 replies; 6+ messages in thread
From: Miguel Ojeda @ 2025-11-04 19:25 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Alex Gaynor, Nathan Chancellor, Nicolas Schier, Huacai Chen,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
	rust-for-linux, linux-kbuild, WANG Xuerui, loongarch,
	H. Peter Anvin, linux-kernel, patches

On Sat, Nov 1, 2025 at 10:40 AM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> 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 [1]
> Link: https://github.com/rust-lang/rust/pull/105812 [2]
> Link: https://github.com/rust-lang/rust/pull/145974 [3]
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

It got stabilized and merged upstream.

Applied to `rust-fixes` -- thanks everyone!

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-11-04 19:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-01  9:40 [PATCH] rust: kbuild: support `-Cjump-tables=n` for Rust 1.93.0 Miguel Ojeda
2025-11-01 11:15 ` Alice Ryhl
2025-11-01 15:53   ` Miguel Ojeda
2025-11-01 17:25 ` Nicolas Schier
2025-11-02  7:57 ` Trevor Gross
2025-11-04 19:25 ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).