From nobody Tue Apr 7 13:45:52 2026 Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) (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 7210230CD82 for ; Mon, 6 Apr 2026 20:02:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775505734; cv=none; b=kXtb/+Aaz9HIuqEZB7pnfzPg/dI9DoaFFmaOA8qUgxMbpyvCL59xacC19sAAbKU/clEeHfXFf6+Bw+W5wJWp/2HlJClwjJ7AQjH3258v3enw+0ojwTsNJWoJANDc7ad00AODrso0qxWLwd/0fVHm2cYH8cBcJYAxm+iwEroYmpY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775505734; c=relaxed/simple; bh=aJyqZgEiU7gadN2ONUZgp8589ILXEazRUR3likQHx7Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L8VOoH0zufhdGrnYqbWIWt9kSTNcO3hckLZnbvqAQcStDZpUcRDsWcnNh9K4HDYoad3+CFYH6Rrx42z2nI8Tt4dVB0mmrg4XV6Yqm3sbEMPmxSKpnE0We58HNJehJRzcFnHWWam2sWQpijyrt4CboDkm4vMcGTwpgsPxUXcPtzc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FDqNAnYA; arc=none smtp.client-ip=209.85.215.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FDqNAnYA" Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-c76c067bc51so1467947a12.0 for ; Mon, 06 Apr 2026 13:02:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775505733; x=1776110533; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lPSLhEO/t1n98OrRH4+WlgtQBOSzWDBbT00u5q2kC9Y=; b=FDqNAnYAoWQ443k7yQ20rTxQHfbZAC2SycKr0Xm+b4F9PwqleirZVhX6dgI5rasgAb 9h1kSHdhBtYpstsX08SGZjPgtYiEIrLf31rt5rbv3HGUbRUwr6cmueUZ1lo5HgtNvcai XqsPnB38vo+Mg0qYC2Mj9gItSf7txD1tb3g2gKMDVqCsGAzXHPimJXuoWsX/f0d16vH7 nlVB4AXy5FmZL40Hxu33SY3+lW9NKPIkdPzwL76bz6jhoi5jPeV1lRG2zqgPxCLCXDCG SNn8UyTELDLF6ONwz4G+c+stD96mV59hKr1vDeIwd6Xayea7UAI+i3xqem+/gGz8zUQJ 78bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775505733; x=1776110533; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=lPSLhEO/t1n98OrRH4+WlgtQBOSzWDBbT00u5q2kC9Y=; b=png9Dizg1FEnOf5tcRfU/yjViFv28ldpf0hm6uSVBB5MnHvNmQffYeMt/7A9fwbBZs LcopeDb0UqxAYKUumb24MGBTaRm/8s+6uYYkLlq8YbYchZlUce/IebzWRXOVDowzvdPQ 4dhVfOcrG5ufWeCxGlEBLGok+1V+vZuDH9oxyW6VbZeOETVEZiYEaplXdv2eSQq14H2A PezVyfyajoy7Sntj/mdPQ+eGxTWJMJ7K4qVGEUuv8w+1QJSy3mMyiAhrULQewBwhoLex 0MIewWfWYuvtft3iEbx2ol3oKk3qfIR1nNtJQWlH9Er8NJ+VelPLbrFpE8z48R4BQiaV dWtA== X-Forwarded-Encrypted: i=1; AJvYcCXPRHZRZ5mmNrZO+fX8Wf9xO2gdsgNTSk8l1bCYbi0pT1ofl3wcw9CMrtKy5VXCPcgaOj/euzBWDLM3zjk=@vger.kernel.org X-Gm-Message-State: AOJu0YxPoBJoWUz1b8QdzT/0XI7WuhP0muKQaNqZkzJyCV5DIOX7LCmQ eVr+ZNn0KbDpRReq8Islen6rbxPchZdojl3WfS0uzyq9sdkdINWeq5VQxEdCZQ== X-Gm-Gg: AeBDiet00IM21J1S6/PiQHtbTflnz+xhrCMlidtcnngelWHFJkvHzkVlncbVwR/gl8m oF8n6B9A7+d/e3XyHrorjBzZnkpwG37a9jwnTZCcZBFuB7Di3uveUy8qgKNbiaFukucPMx9oG/f 3FpvshVP4RaN5NkVaNxLe5tpFfgLU7n7SjUAXMfOvvjJQF+g2F/W0rizcLNwUX/9SZUtHfCbcVq yHcjXR8COGdlYmHg2cPsb0xIOhNSIVq511PnF/vHM4roWyRptXxUXN3N3bnLX2YpjdZeq4KTxHu LWCjK2gXNX6iTqPr9CBtqHLxZUoPsLDEF1IFCHHa7L935jIvQ9kTvzwkXfzxdcnJDdr9uVnCy9z LPRyLMZCYWCSuWCV0EtNVwzUhikT7qFY3ucEEpIHEtjxN+kV4aW7/KjSusRaK5qs5nwvz1Uz+xu di5TNhx+xZE8npWan9N1m8rJJqB6oU6hpBPX/EoWDi//gk/nf3GfCAKa+Cn7Kdm6JUXkDudh4e0 Lc= X-Received: by 2002:a17:903:3b8f:b0:2ae:cb0e:fd59 with SMTP id d9443c01a7336-2b28164cfebmr148221295ad.8.1775505732659; Mon, 06 Apr 2026 13:02:12 -0700 (PDT) Received: from li-1a3e774c-28e4-11b2-a85c-acc9f2883e29.ibm.com.com ([106.51.160.44]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b27497af26sm151098205ad.49.2026.04.06.13.02.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2026 13:02:12 -0700 (PDT) From: "Mukesh Kumar Chaurasiya (IBM)" To: maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, chleroy@kernel.org, peterz@infradead.org, jpoimboe@kernel.org, jbaron@akamai.com, aliceryhl@google.com, rostedt@goodmis.org, ardb@kernel.org, ojeda@kernel.org, boqun@kernel.org, gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org, a.hindborg@kernel.org, tmgross@umich.edu, dakr@kernel.org, nathan@kernel.org, nick.desaulniers+lkml@gmail.com, morbo@google.com, justinstitt@google.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, llvm@lists.linux.dev Cc: "Mukesh Kumar Chaurasiya (IBM)" Subject: [PATCH V10 1/4] rust: Separate host libraries to fix rmeta dependency conflict Date: Tue, 7 Apr 2026 01:31:46 +0530 Message-ID: <20260406200149.3727922-2-mkchauras@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260406200149.3727922-1-mkchauras@gmail.com> References: <20260406200149.3727922-1-mkchauras@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When building Rust code for powerpc64le with LLVM=3D1 and -j1, rustc encounters an error: "multiple candidates for `rmeta` dependency `core` found", with two candidates: 1. The host's standard library from the rustup toolchain 2. The kernel's custom libcore.rmeta in the rust/ directory This occurs because the build system uses `-L$(objtree)/rust` for host library builds (proc_macro2, quote, syn), which causes rustc to search the rust/ directory. During this search, rustc finds both the kernel's custom libcore.rmeta and gains access to the host's standard library, creating a conflict. Separate all host-side build artifacts (host libraries and proc macros) into a dedicated rust/host/ subdirectory and use `-L$(objtree)/rust/host` for host builds. This ensures host builds only search rust/host/ and never encounter the kernel's libcore.rmeta. The `--out-dir` flag is removed from cmd_rustc_procmacrolibrary because the output directory is now created explicitly with `mkdir -p $(dir $@)` and the output file path is specified directly with `--emit=3Dlink=3D$@`, making `--out-dir` redundant. Moving the proc macros (libmacros and libpin_init_internal) to rust/host/ eliminates the need for special handling in rustdoc-pin_init, which can now use the pin_init-flags variable directly instead of duplicating the flags with absolute paths. The rust/host/ directory is added to clean-files to ensure it's removed during `make clean`. Link: https://github.com/Rust-for-Linux/linux/issues/105 Link: https://github.com/linuxppc/issues/issues/451 Signed-off-by: Mukesh Kumar Chaurasiya (IBM) --- rust/Makefile | 56 +++++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/rust/Makefile b/rust/Makefile index 9801af2e1e02..d8f34c4858b8 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -3,6 +3,9 @@ # Where to place rustdoc generated documentation rustdoc_output :=3D $(objtree)/Documentation/output/rust/rustdoc =20 +# Clean generated host directory +clean-files :=3D host/ + obj-$(CONFIG_RUST) +=3D core.o compiler_builtins.o ffi.o always-$(CONFIG_RUST) +=3D exports_core_generated.h =20 @@ -27,7 +30,7 @@ endif =20 obj-$(CONFIG_RUST) +=3D exports.o =20 -always-$(CONFIG_RUST) +=3D libproc_macro2.rlib libquote.rlib libsyn.rlib +always-$(CONFIG_RUST) +=3D host/libproc_macro2.rlib host/libquote.rlib hos= t/libsyn.rlib =20 always-$(CONFIG_RUST_KERNEL_DOCTESTS) +=3D doctests_kernel_generated.rs always-$(CONFIG_RUST_KERNEL_DOCTESTS) +=3D doctests_kernel_generated_kunit= .c @@ -49,7 +52,7 @@ libmacros_extension :=3D $(patsubst libmacros.%,%,$(libma= cros_name)) libpin_init_internal_name :=3D $(shell MAKEFLAGS=3D $(RUSTC) --print file-= names --crate-name pin_init_internal --crate-type proc-macro -