Re: [PATCH] x86/rust: avoid duplication of RETPOLINE_RUSTFLAGS in recursive kbuild
From: Alice Ryhl
Date: Thu Oct 15 2026 - 02:43:07 EST
On Tue, Oct 13, 2026 at 10:42:26AM +0200, Thomas Weißschuh wrote:
> Currently the only modificiation of REPTOLINE_RUSTFLAGS is an append.
> There is no initial (re)set of the value. When kbuild is invoked
> recursively, for example through a top-level `make pacman-pkg`
> invocation, then the inner instance of kbuild will inherit the value
> from the outer one and append the same values again.
>
> Switching between recursive and non-recursive invocations of kbuild in
> the same build tree the command line changes and Rust code is rebuilt.
> While this is harmless, it is slow and unnecessary.
>
> Replace the append operation with a regular assignment. This avoids the
> duplicated values in a recursive kbuild invocation and therefore also
> the spurious rebuilds.
>
> RETPOLINE_CFLAGS is not affected as it is always reset to a fixed value
> further up in the Makefile.
>
> Fixes: d7868550d573 ("x86/rust: support MITIGATION_RETHUNK")
> Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>