Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 7377575

Browse files
ojedaDarksonn
authored andcommitted
FROMLIST: kbuild: rust: re-run Kconfig if the version text changes
Re-run Kconfig if we detect the Rust compiler has changed via the version text, like it is done for C. Unlike C, and unlike `RUSTC_VERSION`, the `RUSTC_VERSION_TEXT` is kept under `depends on RUST`, since it should not be needed unless `RUST` is enabled. Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Link: https://lore.kernel.org/r/20240808221138.873750-4-ojeda@kernel.org Change-Id: I3e7f8a3f9f5c0de49b4e3fc1bbd819203debbbe1 Signed-off-by: Alice Ryhl <aliceryhl@google.com>
1 parent bb71f70 commit 7377575

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,9 +680,10 @@ endif
680680

681681
# The expansion should be delayed until arch/$(SRCARCH)/Makefile is included.
682682
# Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
683-
# CC_VERSION_TEXT is referenced from Kconfig (so it needs export),
683+
# CC_VERSION_TEXT and RUSTC_VERSION_TEXT are referenced from Kconfig (so they need export),
684684
# and from include/config/auto.conf.cmd to detect the compiler upgrade.
685685
CC_VERSION_TEXT = $(subst $(pound),,$(shell LC_ALL=C $(CC) --version 2>/dev/null | head -n 1))
686+
RUSTC_VERSION_TEXT = $(subst $(pound),,$(shell LC_ALL=C $(RUSTC) --version 2>/dev/null | head -n 1))
686687

687688
ifneq ($(findstring clang,$(CC_VERSION_TEXT)),)
688689
include $(srctree)/scripts/Makefile.clang
@@ -703,7 +704,7 @@ ifdef config-build
703704
# KBUILD_DEFCONFIG may point out an alternative default configuration
704705
# used for 'make defconfig'
705706
include $(srctree)/arch/$(SRCARCH)/Makefile
706-
export KBUILD_DEFCONFIG KBUILD_KCONFIG CC_VERSION_TEXT
707+
export KBUILD_DEFCONFIG KBUILD_KCONFIG CC_VERSION_TEXT RUSTC_VERSION_TEXT
707708

708709
config: outputmakefile scripts_basic FORCE
709710
$(Q)$(MAKE) $(build)=scripts/kconfig $@

init/Kconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1930,7 +1930,9 @@ config RUST
19301930
config RUSTC_VERSION_TEXT
19311931
string
19321932
depends on RUST
1933-
default "$(shell,LC_ALL=C $(RUSTC) --version 2>/dev/null | head -n 1)"
1933+
default "$(RUSTC_VERSION_TEXT)"
1934+
help
1935+
See `CC_VERSION_TEXT`.
19341936

19351937
config BINDGEN_VERSION_TEXT
19361938
string

0 commit comments

Comments
 (0)