From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (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 5C1D426E6F2 for ; Mon, 6 Apr 2026 20:02:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775505734; cv=none; b=lsvut48stFMAgQSijc9Zls8IptLKUL49s/kClCiaiZSy5hM+W+4XlksUWPB/W8XYILaNiwgO8kxENtC1x02Ei88BfnmFhkDznqfa0e7OhRzIZjuq9V8hu0/R9bNGUojwwL7n71aJF6Gupy6IcM7hQ/ihSHAzvWW6K1U/wJzkf3w= 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.182 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-f182.google.com with SMTP id 41be03b00d2f7-c76c067bc51so1467948a12.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=UjLyzOl88x1DI7B38JNqp5Rigs+M5CT9XIqCF+FdZ1BqBespFRQmeQKWErZ7Ff+F6G b5LAm1mgRM9HwvJsd40oMXfXsvkccpztA/lfvzNZ6lgX9rnyWImf3bB7paiRk5uIXvHP FdbLtcu6JFV03CyRrPn6yGDPrEZLQKTvxPScTwmxRm3dbJvkDCmAr0bb0v4ucg6tit8p LtSEoXQq6R+O2/basIEY67NAy0Rr1fha6kEhaOegX6oxiogY38vElJhTiLGybzRzDOFz 1PO8nuVVQ3nV5EMbjSQvuM4RI6zDZcQwjJsQ7h2CoDN/zqmYODM5eQlBW4/HfxuupeBu YA5A== X-Forwarded-Encrypted: i=1; AJvYcCUIEl+HYscYYaDkKaJnP/o/xgxobLKU//oOSkE+M5JgnwflgQs26rWzJnrPXpVR/xah4gE7iggi4u/NbypHNw==@vger.kernel.org X-Gm-Message-State: AOJu0Yy4b+55ZpqRDO0xajIX2VsFgOakR2RtpjyHHaCzNBX3l206YRWs Ir8dhIaNLhzBjw8//W0Gtd71nG/+zO+06mQ4a7beDQzqnJcsmjm74ZTt X-Gm-Gg: AeBDietiIrk/ILPVSSYIxNdduirDOyFi4PRFX+rO/xyupZF9QJ84UfeAha6gFxuzehv 3kE9HqH6yivedq5IrZ9UItFo/DuFWV7HQrR3gsWnsmS3e+gKSMiy6ZibvgqOrSgl5kweg6ijWzN nxYiHMuB7Xl3pefZBiUEzi2VXyHQYuacyWf5dpDAoZnUhhwO5s7Tk1fgrwpoxKywfdAQI26++yX Te7CZmHrFnLqA3lY+jvhGWK59dhIIVUaksT7/B+M8Caxw9uYRobyZkXkhkPAEE/g7aQ+7xmexHp b23NV5/bIBupBOKvceAmXl4cPz/0K5H8qrDkLUul98XssrU3RuI2q6TWXbfVq0Q0PPpPqedIr+4 mim83AWz4OhuAHL+FsOfgDsUkP6iD1sVyN0ylw+BvV0810wvx9a7pw7+SgsMPyV6vjHabnl7k/J 9DKdMBo7wHsuUdkNeLtUM1mkI5TPtkErvwz62lJENesdjXhCxCYNPY1Y7UygahxieFjvGGllHvN +4= 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: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When building Rust code for powerpc64le with LLVM=1 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=link=$@`, 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 := $(objtree)/Documentation/output/rust/rustdoc +# Clean generated host directory +clean-files := host/ + obj-$(CONFIG_RUST) += core.o compiler_builtins.o ffi.o always-$(CONFIG_RUST) += exports_core_generated.h @@ -27,7 +30,7 @@ endif obj-$(CONFIG_RUST) += exports.o -always-$(CONFIG_RUST) += libproc_macro2.rlib libquote.rlib libsyn.rlib +always-$(CONFIG_RUST) += host/libproc_macro2.rlib host/libquote.rlib host/libsyn.rlib always-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated.rs always-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated_kunit.c @@ -49,7 +52,7 @@ libmacros_extension := $(patsubst libmacros.%,%,$(libmacros_name)) libpin_init_internal_name := $(shell MAKEFLAGS= $(RUSTC) --print file-names --crate-name pin_init_internal --crate-type proc-macro -