rust/Makefile | 3 ++- scripts/Makefile.compiler | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-)
The `-Cunsafe-allow-abi-mismatch=fixed-x18` workaround was added to
handle a rustdoc bug where target modifiers were not properly saved [1].
This bug was fixed in Rust 1.90.0 [2]. Restrict the workaround to only
apply for Rust 1.88.x and 1.89.x versions that are affected by the
bug, preserving ABI compatibility checks on newer compiler versions.
Add `rustc-max-version` macro to `scripts/Makefile.compiler` for
version upper bound checks, mirroring the existing `rustc-min-version`.
Link: https://github.com/rust-lang/rust/issues/144521 [1]
Link: https://github.com/rust-lang/rust/pull/144523 [2]
Suggested-by: Gary Guo <gary@garyguo.net>
Link: https://lore.kernel.org/rust-for-linux/DG4JM9PU51M0.1YRGM9HVTY24U@garyguo.net/
Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://lore.kernel.org/rust-for-linux/CANiq72n39eU9WE=Yh0_yJzmqMxo=QAaU2pN0UqP9jZ7bT7rhgA@mail.gmail.com/
Cc: stable@vger.kernel.org # Useful in 6.18.y and later.
Signed-off-by: HeeSu Kim <mlksvender@gmail.com>
---
Changes in v4:
- Add rustc-max-version macro for cleaner version bounds
- Use rustc-max-version instead of test-lt for readability
Changes in v3:
- Remove Fixes: tag (this is a feature, not a fix)
- Use full URLs with Link: tags instead of GitHub-style references
- Add Link: to lore.kernel.org for Suggested-by attribution
- Add Cc: stable for potential backporting to 6.18.y
Changes in v2:
- Change approach: bound to affected Rust versions instead of ARM64-only
(the flag is simply ignored on non-ARM64 architectures)
rust/Makefile | 3 ++-
scripts/Makefile.compiler | 4 ++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/rust/Makefile b/rust/Makefile
index 5c0155b83454..1e8a75bc2878 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -136,7 +136,8 @@ pin_init-flags := \
# `rustdoc` did not save the target modifiers, thus workaround for
# the time being (https://github.com/rust-lang/rust/issues/144521).
-rustdoc_modifiers_workaround := $(if $(call rustc-min-version,108800),-Cunsafe-allow-abi-mismatch=fixed-x18)
+# The bug was fixed in Rust 1.90.0, so only apply for 1.88.x and 1.89.x.
+rustdoc_modifiers_workaround := $(if $(call rustc-min-version,108800),$(if $(call rustc-max-version,108999),-Cunsafe-allow-abi-mismatch=fixed-x18))
# Similarly, for doctests (https://github.com/rust-lang/rust/issues/146465).
doctests_modifiers_workaround := $(rustdoc_modifiers_workaround)$(if $(call rustc-min-version,109100),$(comma)sanitizer)
diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler
index ef91910de265..85268f6f1494 100644
--- a/scripts/Makefile.compiler
+++ b/scripts/Makefile.compiler
@@ -71,6 +71,10 @@ clang-min-version = $(call test-ge, $(CONFIG_CLANG_VERSION), $1)
# Usage: rustc-$(call rustc-min-version, 108500) += -Cfoo
rustc-min-version = $(call test-ge, $(CONFIG_RUSTC_VERSION), $1)
+# rustc-max-version
+# Usage: rustc-$(call rustc-max-version, 109000) += -Cfoo
+rustc-max-version = $(call test-le, $(CONFIG_RUSTC_VERSION), $1)
+
# ld-option
# Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
--
2.52.0
On Wed, Feb 04, 2026 at 08:48:43AM +0900, HeeSu Kim wrote: > The `-Cunsafe-allow-abi-mismatch=fixed-x18` workaround was added to > handle a rustdoc bug where target modifiers were not properly saved [1]. > > This bug was fixed in Rust 1.90.0 [2]. Restrict the workaround to only > apply for Rust 1.88.x and 1.89.x versions that are affected by the > bug, preserving ABI compatibility checks on newer compiler versions. > > Add `rustc-max-version` macro to `scripts/Makefile.compiler` for > version upper bound checks, mirroring the existing `rustc-min-version`. > > Link: https://github.com/rust-lang/rust/issues/144521 [1] > Link: https://github.com/rust-lang/rust/pull/144523 [2] > Suggested-by: Gary Guo <gary@garyguo.net> > Link: https://lore.kernel.org/rust-for-linux/DG4JM9PU51M0.1YRGM9HVTY24U@garyguo.net/ > Suggested-by: Miguel Ojeda <ojeda@kernel.org> > Link: https://lore.kernel.org/rust-for-linux/CANiq72n39eU9WE=Yh0_yJzmqMxo=QAaU2pN0UqP9jZ7bT7rhgA@mail.gmail.com/ > Cc: stable@vger.kernel.org # Useful in 6.18.y and later. > Signed-off-by: HeeSu Kim <mlksvender@gmail.com> Acked-by: Nathan Chancellor <nathan@kernel.org> I assume Miguel will pick this up. > --- > Changes in v4: > - Add rustc-max-version macro for cleaner version bounds > - Use rustc-max-version instead of test-lt for readability > > Changes in v3: > - Remove Fixes: tag (this is a feature, not a fix) > - Use full URLs with Link: tags instead of GitHub-style references > - Add Link: to lore.kernel.org for Suggested-by attribution > - Add Cc: stable for potential backporting to 6.18.y > > Changes in v2: > - Change approach: bound to affected Rust versions instead of ARM64-only > (the flag is simply ignored on non-ARM64 architectures) > > rust/Makefile | 3 ++- > scripts/Makefile.compiler | 4 ++++ > 2 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/rust/Makefile b/rust/Makefile > index 5c0155b83454..1e8a75bc2878 100644 > --- a/rust/Makefile > +++ b/rust/Makefile > @@ -136,7 +136,8 @@ pin_init-flags := \ > > # `rustdoc` did not save the target modifiers, thus workaround for > # the time being (https://github.com/rust-lang/rust/issues/144521). > -rustdoc_modifiers_workaround := $(if $(call rustc-min-version,108800),-Cunsafe-allow-abi-mismatch=fixed-x18) > +# The bug was fixed in Rust 1.90.0, so only apply for 1.88.x and 1.89.x. > +rustdoc_modifiers_workaround := $(if $(call rustc-min-version,108800),$(if $(call rustc-max-version,108999),-Cunsafe-allow-abi-mismatch=fixed-x18)) > > # Similarly, for doctests (https://github.com/rust-lang/rust/issues/146465). > doctests_modifiers_workaround := $(rustdoc_modifiers_workaround)$(if $(call rustc-min-version,109100),$(comma)sanitizer) > diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler > index ef91910de265..85268f6f1494 100644 > --- a/scripts/Makefile.compiler > +++ b/scripts/Makefile.compiler > @@ -71,6 +71,10 @@ clang-min-version = $(call test-ge, $(CONFIG_CLANG_VERSION), $1) > # Usage: rustc-$(call rustc-min-version, 108500) += -Cfoo > rustc-min-version = $(call test-ge, $(CONFIG_RUSTC_VERSION), $1) > > +# rustc-max-version > +# Usage: rustc-$(call rustc-max-version, 109000) += -Cfoo > +rustc-max-version = $(call test-le, $(CONFIG_RUSTC_VERSION), $1) Minor meta comment: It is generally perferred to add a macro like this in a separate change to make it easier to backport if it is needed in the future. > # ld-option > # Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y) > ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3)) > -- > 2.52.0 >
Add `rustc-max-version` macro to `scripts/Makefile.compiler` for
version upper bound checks, mirroring the existing `rustc-min-version`.
This will be used to bound workarounds to specific compiler version
ranges.
Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://lore.kernel.org/rust-for-linux/CANiq72n39eU9WE=Yh0_yJzmqMxo=QAaU2pN0UqP9jZ7bT7rhgA@mail.gmail.com/
Acked-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: HeeSu Kim <mlksvender@gmail.com>
---
Changes in v5:
- Split rustc-max-version macro into separate patch for easier backporting
(was part of the workaround patch in v4)
scripts/Makefile.compiler | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler
index ef91910de265..85268f6f1494 100644
--- a/scripts/Makefile.compiler
+++ b/scripts/Makefile.compiler
@@ -71,6 +71,10 @@ clang-min-version = $(call test-ge, $(CONFIG_CLANG_VERSION), $1)
# Usage: rustc-$(call rustc-min-version, 108500) += -Cfoo
rustc-min-version = $(call test-ge, $(CONFIG_RUSTC_VERSION), $1)
+# rustc-max-version
+# Usage: rustc-$(call rustc-max-version, 109000) += -Cfoo
+rustc-max-version = $(call test-le, $(CONFIG_RUSTC_VERSION), $1)
+
# ld-option
# Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
--
2.52.0
On Thu, Feb 05, 2026 at 10:18:14PM +0900, HeeSu Kim wrote:
> Add `rustc-max-version` macro to `scripts/Makefile.compiler` for
> version upper bound checks, mirroring the existing `rustc-min-version`.
>
> This will be used to bound workarounds to specific compiler version
> ranges.
>
> Suggested-by: Miguel Ojeda <ojeda@kernel.org>
> Link: https://lore.kernel.org/rust-for-linux/CANiq72n39eU9WE=Yh0_yJzmqMxo=QAaU2pN0UqP9jZ7bT7rhgA@mail.gmail.com/
> Acked-by: Nathan Chancellor <nathan@kernel.org>
> Signed-off-by: HeeSu Kim <mlksvender@gmail.com>
> ---
> Changes in v5:
> - Split rustc-max-version macro into separate patch for easier backporting
> (was part of the workaround patch in v4)
>
> scripts/Makefile.compiler | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler
> index ef91910de265..85268f6f1494 100644
> --- a/scripts/Makefile.compiler
> +++ b/scripts/Makefile.compiler
> @@ -71,6 +71,10 @@ clang-min-version = $(call test-ge, $(CONFIG_CLANG_VERSION), $1)
> # Usage: rustc-$(call rustc-min-version, 108500) += -Cfoo
> rustc-min-version = $(call test-ge, $(CONFIG_RUSTC_VERSION), $1)
>
> +# rustc-max-version
> +# Usage: rustc-$(call rustc-max-version, 109000) += -Cfoo
> +rustc-max-version = $(call test-le, $(CONFIG_RUSTC_VERSION), $1)
> +
Acked-by: Nicolas Schier <nsc@kernel.org>
(nit-picking; not crucial for this very patch set)
For readability, a less-than version check might be easier to read; and
that would probably better match the suggested version range check:
rustc-lt-version = $(if $(call rustc-min-version, $(1)),,y)
rustc-version-range = $(and $(call rustc-lt-version,$(2)), $(call rustc-min-version,$(1)))
so that the actual version check could become
# The bug was fixed in Rust 1.90.0, so only apply for 1.88.x to < 1.90.0
rustdoc_modifiers_workaround := $(if $(call rustc-version-range, 108800, 109000), \
-Cunsafe-allow-abi-mismatch=fixed-x18)
or:
ifeq ($(call rustc-version-range, 108800, 109000),y)
rustdoc_modifiers_workaround := -Cunsafe-allow-abi-mismatch=fixed-x18
endif
--
Nicolas
The `-Cunsafe-allow-abi-mismatch=fixed-x18` workaround was added to
handle a rustdoc bug where target modifiers were not properly saved [1].
This bug was fixed in Rust 1.90.0 [2]. Restrict the workaround to only
apply for Rust 1.88.x and 1.89.x versions that are affected by the
bug, preserving ABI compatibility checks on newer compiler versions.
Link: https://github.com/rust-lang/rust/issues/144521 [1]
Link: https://github.com/rust-lang/rust/pull/144523 [2]
Suggested-by: Gary Guo <gary@garyguo.net>
Link: https://lore.kernel.org/rust-for-linux/DG4JM9PU51M0.1YRGM9HVTY24U@garyguo.net/
Cc: stable@vger.kernel.org # Useful in 6.18.y and later.
Acked-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: HeeSu Kim <mlksvender@gmail.com>
---
Changes in v5:
- Split rustc-max-version macro into separate patch for easier backporting
Changes in v4:
- Add rustc-max-version macro for cleaner version bounds
- Use rustc-max-version instead of test-lt for readability
Changes in v3:
- Remove Fixes: tag (this is a feature, not a fix)
- Use full URLs with Link: tags instead of GitHub-style references
- Add Link: to lore.kernel.org for Suggested-by attribution
- Add Cc: stable for potential backporting to 6.18.y
Changes in v2:
- Change approach: bound to affected Rust versions instead of ARM64-only
(the flag is simply ignored on non-ARM64 architectures)
rust/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/rust/Makefile b/rust/Makefile
index 5c0155b83454..1e8a75bc2878 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -136,7 +136,8 @@ pin_init-flags := \
# `rustdoc` did not save the target modifiers, thus workaround for
# the time being (https://github.com/rust-lang/rust/issues/144521).
-rustdoc_modifiers_workaround := $(if $(call rustc-min-version,108800),-Cunsafe-allow-abi-mismatch=fixed-x18)
+# The bug was fixed in Rust 1.90.0, so only apply for 1.88.x and 1.89.x.
+rustdoc_modifiers_workaround := $(if $(call rustc-min-version,108800),$(if $(call rustc-max-version,108999),-Cunsafe-allow-abi-mismatch=fixed-x18))
# Similarly, for doctests (https://github.com/rust-lang/rust/issues/146465).
doctests_modifiers_workaround := $(rustdoc_modifiers_workaround)$(if $(call rustc-min-version,109100),$(comma)sanitizer)
--
2.52.0
© 2016 - 2026 Red Hat, Inc.