From patchwork Thu Aug 8 22:11:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Ojeda X-Patchwork-Id: 13758239 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7EF1815DBB6; Thu, 8 Aug 2024 22:12:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723155130; cv=none; b=a7zH+Dq1OoQyJmCXwLdf9Up3Tt5XuF3n9iB3fR+BVZ+wksbwoFx82dFPbXUHOzXhDvF5YYyvINt18pxrLKhNm43bOvhW4QrwOccwpO1Uap0Ndmllykzrk68x6ck2insDE0MLx0RYlEnKFcP8LzcmJZLMHNBQIwx85FlFPryX1CQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723155130; c=relaxed/simple; bh=eMcrbKMzXg14IvqJEdwphrNH5oXng/0pxQDFBFqyhJM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mgSSFj6CSIL8bRqoDwKlBAWMIWjqFRhrudOEV5SqwiQzIWrRn9J0c5j+EJr7zKqHBDscsOdM19wIXExKbxHJVQuBp7U2pYtrWyV3dpM/94o3aK+K57bqEOne4sVUH/pZU4dlMbgstcaDFLrRPzP0CEEW4+9NIo+6B66SszgF7wM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Gj9h9Gix; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Gj9h9Gix" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 362B7C32782; Thu, 8 Aug 2024 22:12:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723155130; bh=eMcrbKMzXg14IvqJEdwphrNH5oXng/0pxQDFBFqyhJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gj9h9GixbdlI1aJLW7/1WfMWb21t9bIecPEeihj2PiGhjid3YWsqSHkowuheQhRFj pvcVf96hI2zX8kBiYkQl6m00pnrOGqn7/MFiZUfnpoUfEhH7lIt73l5zmMBQ+P+0SV bc1PheUkxIoe9Bkevym33o7uKi0ZPCAr8CQpktzYwT1EUfZO8tCON3fzQKolMQfVu5 fxR/xnIv4yLSj+n8dA1phDlkFnLJV7v3X3uhJ8QE1ZRaEdnZ5vcVpK7Tw5jtccPdvo aUH4JEWsVWGeE8r3fliPG6Sp/spc2pYNMXQKLB44BZBo0ZPUxG2OVpn3+CRuLPZgNz 1wHFeyVImGRwQ== From: Miguel Ojeda To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Masahiro Yamada Cc: Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, Nathan Chancellor , Nicolas Schier , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev Subject: [PATCH 3/6] kbuild: rust: re-run Kconfig if the version text changes Date: Fri, 9 Aug 2024 00:11:35 +0200 Message-ID: <20240808221138.873750-4-ojeda@kernel.org> In-Reply-To: <20240808221138.873750-1-ojeda@kernel.org> References: <20240808221138.873750-1-ojeda@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 Reviewed-by: Nicolas Schier --- Masahiro: I think leaving the `depends on RUST` in `RUSTC_VERSION` is OK, but since this is different from the C side, please let me know if you prefer otherwise. Thanks! Makefile | 5 +++-- init/Kconfig | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) -- 2.46.0 diff --git a/Makefile b/Makefile index 8ad55d6e7b60..2b5f9f098b6f 100644 --- a/Makefile +++ b/Makefile @@ -648,9 +648,10 @@ endif # The expansion should be delayed until arch/$(SRCARCH)/Makefile is included. # Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile. -# CC_VERSION_TEXT is referenced from Kconfig (so it needs export), +# CC_VERSION_TEXT and RUSTC_VERSION_TEXT are referenced from Kconfig (so they need export), # and from include/config/auto.conf.cmd to detect the compiler upgrade. CC_VERSION_TEXT = $(subst $(pound),,$(shell LC_ALL=C $(CC) --version 2>/dev/null | head -n 1)) +RUSTC_VERSION_TEXT = $(subst $(pound),,$(shell LC_ALL=C $(RUSTC) --version 2>/dev/null | head -n 1)) ifneq ($(findstring clang,$(CC_VERSION_TEXT)),) include $(srctree)/scripts/Makefile.clang @@ -671,7 +672,7 @@ ifdef config-build # KBUILD_DEFCONFIG may point out an alternative default configuration # used for 'make defconfig' include $(srctree)/arch/$(SRCARCH)/Makefile -export KBUILD_DEFCONFIG KBUILD_KCONFIG CC_VERSION_TEXT +export KBUILD_DEFCONFIG KBUILD_KCONFIG CC_VERSION_TEXT RUSTC_VERSION_TEXT config: outputmakefile scripts_basic FORCE $(Q)$(MAKE) $(build)=scripts/kconfig $@ diff --git a/init/Kconfig b/init/Kconfig index 2f974f412374..b0238c4b6e79 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1926,7 +1926,9 @@ config RUST config RUSTC_VERSION_TEXT string depends on RUST - default "$(shell,LC_ALL=C $(RUSTC) --version 2>/dev/null | head -n 1)" + default "$(RUSTC_VERSION_TEXT)" + help + See `CC_VERSION_TEXT`. config BINDGEN_VERSION_TEXT string