From nobody Sun Feb 8 16:50:21 2026 Received: from mail-ed1-f73.google.com (mail-ed1-f73.google.com [209.85.208.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A10AD3346B9 for ; Tue, 3 Feb 2026 11:34:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770118468; cv=none; b=nPzMJrKDBKX+hTdaPnL24WhwHfTH3ljUtvnStspquMczalzZ3fd4nJrQ0/HP9VNfUBZK/6ntpz3u0Td61A105oWoXjqI106rd7He4LVuIIWHPOPlUqwht+K/LoLLY+R2koPeedpRCSVRg1RArIHZkv5prxLhjlKOx4kCeY6TTpU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770118468; c=relaxed/simple; bh=LTE4AJa8TogtsWMlXBs5xjtqn4b+TaIqmp+N7wyBtJM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=VI1vWVJ3ZwymvggBwAYl8+CImn+9+meMRhgB0KD9pjHu7IZJrVGF90Y8kNmbwARrBm/SbWTT4FcqDbIBqgF/MkziZRAltfiwp9IDoaskDSLGGsaeL4T2sjKPCCnDaV5dXF52rZLUgaKBEY5w+u4VkKHwKE13Q72QJJ3w9/4phSg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=xGq+DbK9; arc=none smtp.client-ip=209.85.208.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="xGq+DbK9" Received: by mail-ed1-f73.google.com with SMTP id 4fb4d7f45d1cf-65821c9e5b7so5461610a12.0 for ; Tue, 03 Feb 2026 03:34:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1770118464; x=1770723264; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=FR/i+eARikPdIZxYew6is+8VLxNQJTGYF2f9lrQ3EtM=; b=xGq+DbK9HZrDPyigyy81KPztLvXQ9tnhx+8J3W7HWY0ID0rS9wRWmfSNknN3lDtE4R ZuziL9KD+C4SjG8TfAcXpppQtVO/IyM6rKrVfhHhMqh3XwdDX3jbnNGw6Ni3yaR+aApv sRnioUQYUXcq/Z/l8LpZ/Vfi4mGjf6dT6T/BDnK52Lo6dwf63+0x47Ogc9YEychjZ0Lu ztQMGSZbdxyaR223DEg2225q/E710iRMwuz3Wcu8R4YHl1R5CXTIQu3AD78frLyHCypk 5vrsyxmBehFT5NSSGncWnvgNxXlYWVZB6Z2Ax9CuvsxtsM6Kq/AH+eE0ALWkwXCnR7KW jxhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770118464; x=1770723264; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FR/i+eARikPdIZxYew6is+8VLxNQJTGYF2f9lrQ3EtM=; b=DTPpQlLM324YBil4KCcz+gtnrj1VHHf15Nat0Jl5mP45gZr3n8eo/D+GtMhUBVAcJX B9m4SNmVRCTsd2wD8L/Y7TSQd+yZibhJVTz/5YGwYwHndM9MNS5SnfzhLO5652gbTYgh ZILI9SzFaf5pp3VjuAyIL33mfD42ArpSPFuU4DUBc2p3xae+VdC/jjJvkqcWPmM+ouii 7giStQHKavThQ2ywnG5QZESBTGuZeDxmNSAlwrUOHQoqe5c9fQ7ZJCHqfBZOEvEVfVYO A9ejKczC43m/DYlpVss4H4OuCzHPj1sZqrL2aVGxa1BvF5W6XBz1PvyE4gDtGTqys1Fo mJww== X-Forwarded-Encrypted: i=1; AJvYcCX0gyoJdnNf+nPoMg+MEvdLsRwR4GAbiNUC4K+zbgPanktNE9ANflmKCMyqB2OstbMxl2rgwQiKZYUGfK8=@vger.kernel.org X-Gm-Message-State: AOJu0YyVIQ+ho00P+rn+8E1w0ZWLEMFLak82cDOl8lJCHWQkCMYk37oB zJcY//waBvzxle1Dte28bUGPKII8Ls1pXa7RuzGMBbH6sCanOWgQcAWcW26tkKxrAGGlbGJ4zw/ RSzALpd5B/XImKX+EDA== X-Received: from edck20.prod.google.com ([2002:a05:6402:3414:b0:659:31dd:52cb]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6402:2695:b0:659:4383:c491 with SMTP id 4fb4d7f45d1cf-6594383c6bfmr200660a12.33.1770118463947; Tue, 03 Feb 2026 03:34:23 -0800 (PST) Date: Tue, 03 Feb 2026 11:34:08 +0000 In-Reply-To: <20260203-inline-helpers-v2-0-beb8547a03c9@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260203-inline-helpers-v2-0-beb8547a03c9@google.com> X-Developer-Key: i=aliceryhl@google.com; a=openpgp; fpr=49F6C1FAA74960F43A5B86A1EE7A392FDE96209F X-Developer-Signature: v=1; a=openpgp-sha256; l=1712; i=aliceryhl@google.com; h=from:subject:message-id; bh=FzzjhSQNQHIbmcapK6yaktEju2IYPpFJD84GeqRslPI=; b=owEBbQKS/ZANAwAKAQRYvu5YxjlGAcsmYgBpgd09+3ffdigiyO2/yaYtXtLiJKV4JefwxHsD6 g8QYpJOBz+JAjMEAAEKAB0WIQSDkqKUTWQHCvFIvbIEWL7uWMY5RgUCaYHdPQAKCRAEWL7uWMY5 Rn3ZEACPLsut+e2SxZtW2kE96JBHj9IsiPLxVorIorli9qVvROiAeojumIiArRAp1voBxa9BiHF LWm7/7tkVv4Pb5qS9HYATKtorNFgunu5fSYL+Ybvytw3bTpze4jLe5qV3lgnOIEGHkjYr35i9b9 se6vm0FtXtYcFLV3cIz+TnswQOEUo9RnwLzPLlY6U3mzKQk+DIQ7J3c8p/9Z5SCvSy6dJUCSJMd TjqQZ780e7J87CiLHFqHLabrjyMgdzBQjumAEdUJtXT1lSjJyky5JjOA8lAH/Fc3zie3LoPMXCy 0OZfvtxwd4uET0cX1OszPfbBV0wMNlL3RejRdb0SZoXDS+2e8nPT9EFeY7wry6jXsEYIj0Ars+o XnYdBzBqXepyP0wVxUX15DwlpGtldajTPlVNcgP+tZotK+vqXYRRN2p9QjrMZiENvc1Q6bLmVyF D+KGm9tuJgKaCdLi887JUpYshggFLO0lrvJGGZb5eCFtIAdAR7T/LrbRGxBomcERILGtXbQHeuR 1EyOuFeN9V2sWEPS35jlR41VCeY3DIU5+G3zg9eoSguH2wzcQ6jYTyVy75DhBv8loGVQYV9f6+M JDN4EOaLwhbxIro5SFcjPzVDMPxxA48Q4QhyWXri+NX4Dm6NHKDX42CavrWJTc/eX59WGZDKuOS 8wKBxTR4AClAIeQ== X-Mailer: b4 0.14.2 Message-ID: <20260203-inline-helpers-v2-1-beb8547a03c9@google.com> Subject: [PATCH v2 1/3] kbuild: rust: add `CONFIG_RUSTC_CLANG_LLVM_COMPATIBLE` From: Alice Ryhl To: Miguel Ojeda Cc: Boqun Feng , Gary Guo , "=?utf-8?q?Bj=C3=B6rn_Roy_Baron?=" , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Alexandre Courbot , Will Deacon , Peter Zijlstra , Mark Rutland , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Nicolas Schier , Andrew Morton , Uladzislau Rezki , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-kbuild@vger.kernel.org, linux-mm@kvack.org, Alice Ryhl , Matthew Maurer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Gary Guo This config detects if Rust and Clang have matching LLVM major version. All IR or bitcode operations (e.g. LTO) rely on LLVM major version to be matching, otherwise it may generate errors, or worse, miscompile silently due to change of IR semantics. It's usually suggested to use the exact same LLVM version, but this can be difficult to guarantee. Rust's suggestion [1] is also major-version only, so I think this check is sufficient for the kernel. Link: https://doc.rust-lang.org/rustc/linker-plugin-lto.html [1] Reviewed-by: Andreas Hindborg Signed-off-by: Gary Guo Signed-off-by: Matthew Maurer Signed-off-by: Alice Ryhl --- init/Kconfig | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/init/Kconfig b/init/Kconfig index e95d43457851862afc8313389777e4dd9348c178..0e900d3d8be7874a33e0f44754a= 8d038e68d7e65 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -82,6 +82,21 @@ config RUSTC_LLVM_VERSION int default $(rustc-llvm-version) =20 +config RUSTC_LLVM_MAJOR_VERSION + int + default $(shell,expr $(rustc-llvm-version) / 10000) + +config RUSTC_CLANG_LLVM_COMPATIBLE + bool + default y if CC_IS_CLANG && RUSTC_LLVM_MAJOR_VERSION =3D $(shell,expr $(c= c-version) / 10000) + help + This indicates whether Rust and Clang use LLVM of the same major + version. + + Operations involving handling LLVM IR or bitcode (e.g. cross-language + LTO) requires the same LLVM major version to work properly. For best + compatibility it is recommended that the exact same LLVM is used. + config ARCH_HAS_CC_CAN_LINK bool =20 --=20 2.53.0.rc1.225.gd81095ad13-goog