From patchwork Mon Sep 2 16:55:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Ojeda X-Patchwork-Id: 13787527 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 A868E1AB6E8; Mon, 2 Sep 2024 16:56:07 +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=1725296167; cv=none; b=Wz+eo7g/1rLgWJ6XyL3z33oRPHjWR5xueSFpjY7Q5Jz4iTdq6wBS9x9deXeVD8prh7mwnepPPmZMz6b71KhXXmNVf6Xd8mX+r5U1yCS6umLZolcY8al0VYEXRGY/eLpSJYKHLPKNpBRtpKWuyje3k1MkcgMcWAe+U25oJeyFKTg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725296167; c=relaxed/simple; bh=6+P3G2uD3pU9h/ana8iXMMrjSzmZVYjkyTEYm9ga1t8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IVPMkktFzz0MIYNmSV3Lei25eVtFYzesM1ehDZVqWswSJ7L8tGiLh1CPbfGZWe2Ethdm/HWlScLZnLDdW5ig//LUgrkdhk/mq5qenuSyVO+1jrSN+M5hclJ1zqs4P6GsEqGZfq0/t1JN6VWKHPpJChSzTpDCzbo4md/srUdxWfw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fpMpWZ3a; 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="fpMpWZ3a" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 092E3C4CEC2; Mon, 2 Sep 2024 16:56:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725296167; bh=6+P3G2uD3pU9h/ana8iXMMrjSzmZVYjkyTEYm9ga1t8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fpMpWZ3amZnsYF+/Hq6C7vvIZQcT6puXcP8Z4IH6bOZg+GfiQM0RI/NyhIbaZ0TVm BXP44wKSXyHA02RSHnbkBY8qxHtpK1s9LxkFERwZZXejzv6cY17ZGlqDJYH5xWe5Ly fQMr1rVU349JahUPvZIbUbS7HgyEWysYKtk2Vr7Jf6Pt9FallMDQQD3IN5f4jxuS9L lEdb2eHS5L/mOQyJObzjJtbBwEKEDinc1xAb5Ks8i5scDCTha3j7O/rDkyzXBCsME9 O0mGaEBT1s9f149N0ktdfGv+2gJh4Yr9bbLl6ijHBVTRT4QKw6c9sdUSquNyxzvd+Z XaRVP8nifz6zQ== 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 v2 2/6] kbuild: rust: re-run Kconfig if the version text changes Date: Mon, 2 Sep 2024 18:55:29 +0200 Message-ID: <20240902165535.1101978-3-ojeda@kernel.org> In-Reply-To: <20240902165535.1101978-1-ojeda@kernel.org> References: <20240902165535.1101978-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 --- Makefile | 8 +++++--- init/Kconfig | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 68ebd6d6b444..1883aeb919a4 100644 --- a/Makefile +++ b/Makefile @@ -648,9 +648,11 @@ 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), -# and from include/config/auto.conf.cmd to detect the compiler upgrade. +# 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 $(RUSTC) --version 2>/dev/null)) ifneq ($(findstring clang,$(CC_VERSION_TEXT)),) include $(srctree)/scripts/Makefile.clang @@ -671,7 +673,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 38c1cfcce821..c6b744a48dcc 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1927,7 +1927,9 @@ config RUST config RUSTC_VERSION_TEXT string depends on RUST - default "$(shell,$(RUSTC) --version 2>/dev/null)" + default "$(RUSTC_VERSION_TEXT)" + help + See `CC_VERSION_TEXT`. config BINDGEN_VERSION_TEXT string