Re: [PATCH] rust: Makefile: apply fixed-x18 workaround only on arm64
From: Gary Guo
Date: Mon Feb 02 2026 - 09:24:50 EST
On Mon Feb 2, 2026 at 10:21 PM GMT, HeeSu Kim wrote:
> The `-Cunsafe-allow-abi-mismatch=fixed-x18` option is a workaround for
> a rustdoc issue (rust-lang/rust#144521) where target modifiers were not
> properly saved. This affects both rustdoc and doctests builds.
>
> However, `fixed-x18` is an ARM64-specific ABI modifier related to the
> x18 register reservation (used for Shadow Call Stack). Currently, this
> workaround is applied unconditionally on all architectures, which is
> incorrect and may cause issues on non-ARM64 builds.
>
> Restrict the workaround to only apply when building for arm64
> (SRCARCH=arm64).
>
> Fixes: 68e8e79e1bdc ("rust: fix `rustdoc` target modifiers")
> Signed-off-by: HeeSu Kim <mlksvender@xxxxxxxxx>
> ---
> rust/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/rust/Makefile b/rust/Makefile
> index 5c0155b83..2bd547611 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 `fixed-x18` modifier is ARM64-specific, so only apply it there.
> +rustdoc_modifiers_workaround := $(if $(filter arm64,$(SRCARCH)),$(if $(call rustc-min-version,108800),-Cunsafe-allow-abi-mismatch=fixed-x18))
It looks like this bug has been fixed upstream already. While you're at it,
would you mind also add code so that we stop applying the workaround for
versions with bug fixed already?
Thanks,
Gary
>
> # 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)