Rust for Linux List
 help / color / mirror / Atom feed
* [PATCH] x86/rust: avoid duplication of RETPOLINE_RUSTFLAGS in recursive kbuild
@ 2026-10-13  8:42 Thomas Weißschuh
  2026-10-15  6:42 ` Alice Ryhl
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Weißschuh @ 2026-10-13  8:42 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, Miguel Ojeda, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
	Alexandre Courbot, Onur Özkan
  Cc: linux-kernel, rust-for-linux, Thomas Weißschuh

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@weissschuh.net>
---
This is the only instance of this problem in my kernel configuration.
---
 arch/x86/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 8af6b80cffdd..0973b0262661 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -26,7 +26,7 @@ ifdef CONFIG_MITIGATION_RETHUNK
 RETHUNK_CFLAGS		:= -mfunction-return=thunk-extern
 RETHUNK_RUSTFLAGS	:= -Zfunction-return=thunk-extern
 RETPOLINE_CFLAGS	+= $(RETHUNK_CFLAGS)
-RETPOLINE_RUSTFLAGS	+= $(RETHUNK_RUSTFLAGS)
+RETPOLINE_RUSTFLAGS	:= $(RETHUNK_RUSTFLAGS)
 endif
 
 export RETHUNK_CFLAGS

---
base-commit: 7704c4c5bb127673b4f0ead839919db573559e38
change-id: 20261013-rust-x86-rethunk-rebuilds-82c0109356d2

Best regards,
--  
Thomas Weißschuh <linux@weissschuh.net>


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

end of thread, other threads:[~2026-10-15  6:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-13  8:42 [PATCH] x86/rust: avoid duplication of RETPOLINE_RUSTFLAGS in recursive kbuild Thomas Weißschuh
2026-10-15  6:42 ` Alice Ryhl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox