From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.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 B7B1A337B8F for ; Tue, 3 Feb 2026 12:02:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770120150; cv=none; b=lbm4RVHJw70eADTCvjWsSABSXhaojtXrORuSjP+KDTguIMH/oq278koIhjqZA1G/V1SHGK/6REI18Ug3eL8m9++b17iB8Di/0i6pm/ZYPUisQYTUv8HcBPqOJX+myHVBnbcTJ7yfOPITHfT2O/vfQWHatmcuyjTZ7oosfW5fqgA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770120150; c=relaxed/simple; bh=dpKUZIU7z1aYhC8w8Rm05OCOoTYlD9hUxat984VBQ+M=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=lQGvQyNvqNjPJnjbX/Ni5MSLe+Ig8pCt0SWvr/1fz8O6PUjHwvV9eVNHpVuBZXhXrAwsxkBDc5Joo5lHPJhnlzEYRj1eKSXgMCA8+leXK7IoS+dvtxhD0HohHcvJi69weFrP7zGGhuikWMo0LE87aVxV/ADQZ1cfOEshs1L39l8= 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=XUlIt+j5; arc=none smtp.client-ip=209.85.128.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="XUlIt+j5" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-4806fce5ab1so35800885e9.2 for ; Tue, 03 Feb 2026 04:02:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1770120146; x=1770724946; 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=HcL6kf6GDnL4z3aaa3ZQiFzxve6GNyY/d0R1gVrt74Y=; b=XUlIt+j5wS57/fN2F8WzgEYOc5b+JnqhRZkjgyaHDKzi0TWoExV04khjb939Q8xq5w wZrJAP6WsEkEY8DgZnphgkkG7h0/UVka1kFpqxRN8+it+6j+XivD3uhJu43D4H0Z/jW5 akffhaJsnIAiB3wT3kbrkGxtyaOyh82YGsA7cLAAFSkeib2BncTMWcLhBx79S7KOqgiq 1JYcWA8HwMyEROgV7TCuzj7zlGSl3YO9Glymg5i4xf1nWlLaVua5zyZtkYRAcpNdAHES V9ugjADyUTBrIcEVx3PivyEf5u6/8TvkjRgrYotLcvMB2RxUYv75zf0C+LKQ+vAWF9dL 861A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770120146; x=1770724946; 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=HcL6kf6GDnL4z3aaa3ZQiFzxve6GNyY/d0R1gVrt74Y=; b=GAynTHmPEPbgW7AxFKW8nd8qzsAlm+aKOqV9dfP/Vzi1NxjW03LFIgy2UhEtx3i5/y xUCG44V7cpKxRiaimgdE0aGRIEeBLG74brI87wo2oGPFMyVVys8KAfbM46xs/+hcuOU1 2rzoVVYxESBy8S1SnkVYdndAfe1kfjf2lKWmyPn2wB3lS52FFofX2JNgBcgpShi73rHT Ti3htQD8ZeeZ8e2hpOyI8TSpgQ0IFLC5YOWmcd2kmoQ6CjIVBLxl3hBhvoNq51HKleH6 lhC29bzcvv5LUyVXHFdmGTdNOobjKqUnSpt9rrizoTn33erUNrO6rkqONjbz4sJ4FoX4 9Nmw== X-Forwarded-Encrypted: i=1; AJvYcCVot1CIXdV5GicGqahUKw8qQmzW5q3mAyNNqwhOflN0S08k11ASYBLB2mn+Vj9gKFYxDKQWtFftPLj9bgU=@vger.kernel.org X-Gm-Message-State: AOJu0YxaTkYOjEf5XY+57LOMDdVQaq+MjWVwwqKSLV+Mt517TWXZmx19 Aj9X5LuCe4GSDiT6y5ecfc3WPj8bcmf0MEFFziNf1CZ908qZYLeu1hySV4RLl8DBxqxCKVGdsN3 4ATRU0Twoaign4/e4Gg== X-Received: from wmber11.prod.google.com ([2002:a05:600c:84cb:b0:47a:8fa6:6a57]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:34ce:b0:47d:25ac:3a94 with SMTP id 5b1f17b1804b1-482db491e61mr218064275e9.17.1770120146251; Tue, 03 Feb 2026 04:02:26 -0800 (PST) Date: Tue, 3 Feb 2026 12:02:24 +0000 In-Reply-To: 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> <20260203-inline-helpers-v2-1-beb8547a03c9@google.com> Message-ID: Subject: Re: [PATCH v2 1/3] kbuild: rust: add `CONFIG_RUSTC_CLANG_LLVM_COMPATIBLE` From: Alice Ryhl To: Will Deacon Cc: Miguel Ojeda , Boqun Feng , Gary Guo , "=?utf-8?B?QmrDtnJu?= Roy Baron" , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Alexandre Courbot , 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, Matthew Maurer , elver@google.com Content-Type: text/plain; charset="utf-8" On Tue, Feb 03, 2026 at 11:49:08AM +0000, Will Deacon wrote: > On Tue, Feb 03, 2026 at 11:34:08AM +0000, Alice Ryhl wrote: > > 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..0e900d3d8be7874a33e0f44754a8d038e68d7e65 100644 > > --- a/init/Kconfig > > +++ b/init/Kconfig > > @@ -82,6 +82,21 @@ config RUSTC_LLVM_VERSION > > int > > default $(rustc-llvm-version) > > > > +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 = $(shell,expr $(cc-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. > > Is cross-language LTO something we're actually looking at doing for the > kernel, or is this just stale help text given what you're using it for > in this series? I would like to see CONFIG_LTO actually perform cross-language inlining, but it'd require doing something about both: 1. The issues mentioned in patch 2 of this series. 2. The issues mentioned in commit 5daa0c35a1f0 ("rust: Disallow BTF generation with Rust + LTO"). As for whether it's stale help text ... CONFIG_RUST_INLINE_HELPERS works by performing cross-language LTO too. But I can see your point that it would make sense to improve this wording given that we're not making CONFIG_LTO work now. Alice