From nobody Fri Jun 19 07:45:41 2026 Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) (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 085122DB7B4 for ; Sun, 26 Apr 2026 08:57:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777193876; cv=none; b=eVtUzEzayeB5b4TJPhoYFoQoSqd36tDLy0JNxjkiaYm44mOkfqeuZ3TnOWjGn1wUq/xbo4tUDGrDKw4CHumPYvWxR9qCM0/YVPFVyIC/9dgeuQGC25m2lyFohiaBTq9qQkuvO9Oy6jPth2KUXb1ZBo/Y5eYvq3bmgUb4xHHZP+Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777193876; c=relaxed/simple; bh=+vzswd7gdrbgnmHC32F3/NG0WAcCOlbAxoiXzCgUbDE=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hfABWlSU3JNaCnaHI/m5l83SqOIZrSLT55z7Au1kBDjktr3xvKoN648AmS00Ni1t1kLK0Fuew861aW/o3Ga0WHLKO+vBf3bt24a10hOROR/5Oyiekdhimg6yvDmNYl7iTRw8bW/CIbKhHXwde/T0z7lAJl/d5XvaWrIPnogN1sU= 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=onyfWhWs; arc=none smtp.client-ip=209.85.216.47 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="onyfWhWs" Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-3567e2b4159so6230962a91.0 for ; Sun, 26 Apr 2026 01:57:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777193874; x=1777798674; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=lfZP0MeIzoN1hcZODtTG+ASkU3LzXr/UqOo4EQPgGgw=; b=onyfWhWsDrHso0BGZWYP9ykYgzMriEtd5T/82pZYzhlDzI0QDWDrHJ10o6FIFLDJug Nti8CHFGgnYWEfqhnZcblYUl4EQ32uw6+B0IFppwt36T+BEocvySFdOcOacuSR/nG3jU pH+nxlihxiuLRGhVquTqsqEFw3m19/jG01b+VzdUcYdMBjtyHpbkTcMABNykoT7edxqF X49cvYyF6HE5N9kt7eyLjCngQGHfgf9Z5gXuIqMn/8tz2jj2UhWV+vINL7UUVQ2Z0spK 3ySMJoGtXnPD2Mk3seCSHWlJxRGf7O4d0oyPIj4Tkr2TgCWimxTDnrERWX8Ow9NzUVpL J6Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777193874; x=1777798674; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=lfZP0MeIzoN1hcZODtTG+ASkU3LzXr/UqOo4EQPgGgw=; b=RHi3XTyKGlmGZ1wn7Wa7P8zA5uCCb4DJIIPemI8Kq8/MpKAJwIws7QkRLAxZvxqXA8 Qq+B5M2/IZVmrHtDEseCPsD93KQyRoudjSbkeRMBwGILC123nj8j/qFTQ/cmpIRPZ8DX DK7h8JSLooHMzoXryeybJzNZcWbEb80zZUFxdqKyzOwp3r14Hq3p4WAEwgqI0/5Y9yhm dpSjfRD1b7jcAdGQq8VF1JoJ1s9sh7S0Q+AfBrhf4j85ghYa3OMz8w5agQ0yvsP007e7 SiuEMB+sq2aegaFBWOQUfA4K4wk93iFrFiSQO9Bj5GhqJEVNWv31Zm1A60TBSmQm3++c 8eIA== X-Forwarded-Encrypted: i=1; AFNElJ83m0jWtZzP7en2c3qdYCxidKAjpMcU6guN3zf29fGryedGM/zaWrToqBkfrHesh5jNMEW5eUGLM8NxdMU=@vger.kernel.org X-Gm-Message-State: AOJu0YxekhLIzx3uRShHYeOnKmdC8nloosN7iJ5ILzWeqUwMsUsvTj2z d8iKs33HERCBWnHLlJvXk4ZknHOtHO3jG30IUL/QuVJXY+rROpW1uzo2 X-Gm-Gg: AeBDieugb8+YXnK+IfK5RnjWVEzoaEDkWvkUseJFEmp03T0i9tVqTRMHDSoCiamzTDn Ici+osaMfLNj4CsbM65wam6sPNKNtaPHRx5vKtk9cxhDsZRL3Mf1HYXMW1YF+K54mYuz/AVbjIl j7SppxUWP/rEZlAE60UVUzqVxg7A9TWWNjZOxvcrSXn1dzzHlpMoQGR9/J2T0hlnriwNHAf8RUy avb5d+A6R0zU8qP/gJ/SJTbvWm8IVm2UAQYPaqZOx6c7QBSqOK6ef4vU30GvUjfAbFeGY+rZVF4 ZSNb9ZMVbLcr8JgjbyOnVJE6N41iH7D0UD2KPA6nIxoKQrdFJZ/32xggY2Lv578SklqeffJYBUd FItniTNkylVPiECXt39Ap+xpH06YEYmqEvcCE1OpPOEZCBWX7G+5T7159cLDWRh3tQX5yA7A8kx L/d8a/EYYdjRR5PhSD+gYF1T736G5ZSz7snjoMuhjXUsLvqKZA8JeCmqmrBFn6FObqH2v/S6RtD Th9jGtSlMOh/aY= X-Received: by 2002:a17:90a:fc45:b0:35f:be11:b3e0 with SMTP id 98e67ed59e1d1-361403cd032mr37798355a91.2.1777193874362; Sun, 26 Apr 2026 01:57:54 -0700 (PDT) Received: from li-1a3e774c-28e4-11b2-a85c-acc9f2883e29.ibm.com.com ([106.51.164.157]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-36141868906sm27718937a91.3.2026.04.26.01.57.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Apr 2026 01:57:54 -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, daniel.almeida@collabora.com, fujita.tomonori@gmail.com, viresh.kumar@linaro.org, prafulrai522@gmail.com, gregkh@linuxfoundation.org, arnd@arndb.de, tamird@kernel.org, mkchauras@gmail.com, lyude@redhat.com, airlied@gmail.com, j@jannau.net, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH V14 1/7] rust: Fix "multiple candidates for rmeta dependency core" error Date: Sun, 26 Apr 2026 14:27:19 +0530 Message-ID: <20260426085725.2090827-2-mkchauras@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260426085725.2090827-1-mkchauras@gmail.com> References: <20260426085725.2090827-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. The solution is to separate host libraries into a dedicated rust/host/ subdirectory and use `-L$(objtree)/rust/host` for host builds instead of `-L$(objtree)/rust`. This ensures that: 1. Host library builds (proc_macro2, quote, syn) only search rust/host/ and never encounter the kernel's libcore.rmeta 2. Proc macro builds use `-L$(objtree)/rust/host` to find their dependencies Special handling is added for rustdoc-pin_init, which is a host build (to access the alloc crate) but depends on proc macros from the main rust/ directory. It uses explicit `--extern` paths to reference the proc macros without adding `-L$(objtree)/rust`, which would reintroduce the conflict. 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 | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/rust/Makefile b/rust/Makefile index b361bfedfdf0..f6369d121c50 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 @@ -31,7 +34,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 @@ -146,7 +149,7 @@ quiet_cmd_rustdoc =3D RUSTDOC $(if $(rustdoc_host),H, )= $< cmd_rustdoc =3D \ OBJTREE=3D$(abspath $(objtree)) \ $(RUSTDOC) $(filter-out $(skip_flags) --remap-path-scope=3D%,$(if $(rustd= oc_host),$(rust_common_flags),$(rust_flags))) \ - $(rustc_target_flags) -L$(objtree)/$(obj) \ + $(rustc_target_flags) -L$(objtree)/$(obj)$(if $(rustdoc_host),/host) \ -Zunstable-options --generate-link-to-definition \ --output $(rustdoc_output) \ --crate-name $(subst rustdoc-,,$@) \ @@ -231,7 +234,7 @@ rustdoc-pin_init_internal: $(src)/pin-init/internal/src= /lib.rs \ =20 rustdoc-pin_init: private rustdoc_host =3D yes rustdoc-pin_init: private rustc_target_flags =3D $(pin_init-flags) \ - --extern alloc --cfg feature=3D\"alloc\" + -L$(objtree)/$(obj) --extern alloc --cfg feature=3D\"alloc\" rustdoc-pin_init: $(src)/pin-init/src/lib.rs rustdoc-pin_init_internal \ rustdoc-macros FORCE +$(call if_changed,rustdoc) @@ -520,23 +523,23 @@ quiet_cmd_rustc_procmacrolibrary =3D $(RUSTC_OR_CLIPP= Y_QUIET) PL $@ $(if $(skip_clippy),$(RUSTC),$(RUSTC_OR_CLIPPY)) \ $(filter-out $(skip_flags),$(rust_common_flags) $(rustc_target_flags)) \ --emit=3Ddep-info=3D$(depfile) --emit=3Dlink=3D$@ --crate-type rlib -O \ - --out-dir $(objtree)/$(obj) -L$(objtree)/$(obj) \ + --out-dir $(objtree)/$(obj)/host -L$(objtree)/$(obj)/host \ --crate-name $(patsubst lib%.rlib,%,$(notdir $@)) $< =20 -$(obj)/libproc_macro2.rlib: private skip_clippy =3D 1 -$(obj)/libproc_macro2.rlib: private rustc_target_flags =3D $(proc_macro2-f= lags) -$(obj)/libproc_macro2.rlib: $(src)/proc-macro2/lib.rs FORCE +$(obj)/host/libproc_macro2.rlib: private skip_clippy =3D 1 +$(obj)/host/libproc_macro2.rlib: private rustc_target_flags =3D $(proc_mac= ro2-flags) +$(obj)/host/libproc_macro2.rlib: $(src)/proc-macro2/lib.rs FORCE +$(call if_changed_dep,rustc_procmacrolibrary) =20 -$(obj)/libquote.rlib: private skip_clippy =3D 1 -$(obj)/libquote.rlib: private skip_flags =3D $(quote-skip_flags) -$(obj)/libquote.rlib: private rustc_target_flags =3D $(quote-flags) -$(obj)/libquote.rlib: $(src)/quote/lib.rs $(obj)/libproc_macro2.rlib FORCE +$(obj)/host/libquote.rlib: private skip_clippy =3D 1 +$(obj)/host/libquote.rlib: private skip_flags =3D $(quote-skip_flags) +$(obj)/host/libquote.rlib: private rustc_target_flags =3D $(quote-flags) +$(obj)/host/libquote.rlib: $(src)/quote/lib.rs $(obj)/host/libproc_macro2.= rlib FORCE +$(call if_changed_dep,rustc_procmacrolibrary) =20 -$(obj)/libsyn.rlib: private skip_clippy =3D 1 -$(obj)/libsyn.rlib: private rustc_target_flags =3D $(syn-flags) -$(obj)/libsyn.rlib: $(src)/syn/lib.rs $(obj)/libquote.rlib FORCE +$(obj)/host/libsyn.rlib: private skip_clippy =3D 1 +$(obj)/host/libsyn.rlib: private rustc_target_flags =3D $(syn-flags) +$(obj)/host/libsyn.rlib: $(src)/syn/lib.rs $(obj)/host/libquote.rlib FORCE +$(call if_changed_dep,rustc_procmacrolibrary) =20 quiet_cmd_rustc_procmacro =3D $(RUSTC_OR_CLIPPY_QUIET) P $@ @@ -545,20 +548,20 @@ quiet_cmd_rustc_procmacro =3D $(RUSTC_OR_CLIPPY_QUIET= ) P $@ -Clinker-flavor=3Dgcc -Clinker=3D$(HOSTCC) \ -Clink-args=3D'$(call escsq,$(KBUILD_PROCMACROLDFLAGS))' \ --emit=3Ddep-info=3D$(depfile) --emit=3Dlink=3D$@ --extern proc_macro \ - --crate-type proc-macro -L$(objtree)/$(obj) \ + --crate-type proc-macro -L$(objtree)/$(obj)/host \ --crate-name $(patsubst lib%.$(libmacros_extension),%,$(notdir $@)) \ @$(objtree)/include/generated/rustc_cfg $< =20 # Procedural macros can only be used with the `rustc` that compiled it. $(obj)/$(libmacros_name): private rustc_target_flags =3D \ --extern proc_macro2 --extern quote --extern syn -$(obj)/$(libmacros_name): $(src)/macros/lib.rs $(obj)/libproc_macro2.rlib \ - $(obj)/libquote.rlib $(obj)/libsyn.rlib FORCE +$(obj)/$(libmacros_name): $(src)/macros/lib.rs $(obj)/host/libproc_macro2.= rlib \ + $(obj)/host/libquote.rlib $(obj)/host/libsyn.rlib FORCE +$(call if_changed_dep,rustc_procmacro) =20 $(obj)/$(libpin_init_internal_name): private rustc_target_flags =3D $(pin_= init_internal-flags) $(obj)/$(libpin_init_internal_name): $(src)/pin-init/internal/src/lib.rs \ - $(obj)/libproc_macro2.rlib $(obj)/libquote.rlib $(obj)/libsyn.rlib FOR= CE + $(obj)/host/libproc_macro2.rlib $(obj)/host/libquote.rlib $(obj)/host/= libsyn.rlib FORCE +$(call if_changed_dep,rustc_procmacro) =20 # `rustc` requires `-Zunstable-options` to use custom target specifications --=20 2.53.0 From nobody Fri Jun 19 07:45:41 2026 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (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 C3F432DB7B4 for ; Sun, 26 Apr 2026 08:58:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777193888; cv=none; b=m0I5wHfdmZwCgjgW+vB8XfZ7GvGpZTZ5DGXpxNclG3v8Y5TTtz+5vnBZWtexWJ4Ns1AaQeI4HwThmM0ablzehKlPwhwvJTfiINKEfyU1Updj4cqk+ZY+cESp0wogyijcXZy45P0V8BXsnr2kqJTyn6b3Y7dPgF9AckYfN1h0POI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777193888; c=relaxed/simple; bh=btkQtdgQ0/faA3G8fQ7vJ2dLzybospS9rvLC2N23AHs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EBKsOUWfB05ZLC325dylLIwbzq6X1rAdMiZkU2ts7kc1tcAJd81bh5y1C8ju/+xi4Eh6+dQJmx1ZmDQNPjkyC+chfPLz8o6cUkIVcmyWcbb3NfbSfjDcOkgNIE4G10dDmiJdIIWh0rX4sasTnqEt9dOmnemxqMWibTgFvgdWpFg= 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=lvUCcEk6; arc=none smtp.client-ip=209.85.216.46 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="lvUCcEk6" Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-35d95017a68so6093525a91.3 for ; Sun, 26 Apr 2026 01:58:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777193887; x=1777798687; 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=3XNHcqPiS87Phn06IpxO8T5jrJVeHx6CGab+nQaKnDs=; b=lvUCcEk609rQbH73Fpd88AkVvk5DSEu3bTyGphCzbdCl8d4cJ9m4MbiZbzBlTsdcyi GrnGyMqdVCaoicGqZL3YUTziqV1XNHJD10BDE+v/zn9Oc774qyOxO6/VfCtlbggE7cNe JvhPRdabyz2M4qkIou54kGo4guPiIam9yNTf5Ud8UhXvuhqmO8D4YMxpjCdKmbBuYBct vnoKeP747AhsghKi9Mux6GpOxNhmhs2slz76wjfA24LjYe/7TBbEkP+OSFWatRiIQ0kK ueL3grXuFhtulV+y1rxJ4/eH9R1qNnbpsjAcMt+z/SqbhGLJ/ADZ7A9WxM+jNUF96Fdb LmrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777193887; x=1777798687; 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=3XNHcqPiS87Phn06IpxO8T5jrJVeHx6CGab+nQaKnDs=; b=X3wyzZFpBvjl40OLwiYczfOCQkCefSNSzLlRq1tuItPmD5v+7kpXkv+MB28Ap8zzUT hmN4ezrdKz0PIVgjFanxU4e/RXpw6UJgrhZPenPrKqUU2d9EKVmOLg74hRP2sO2F+hdD jv78Luf0Slnf0CvOVMQL4ooD7fO3DWqHvlqPSjSE8Cyb2wX7NBWcb5x0gbpg+tevCKwT sMTDf4BTlw18UXKwW3KrHuOtnDh8lHH9jTvaBFU8ey35gIwkSdKV7W+gcC6YzaGh7NoF dOCuIlBXuuEV8q3i3iKOu2D/a0EoPrDudAwov+y7zp8aHqoIR4AgMjBJue1qMS70P1Vc xoAQ== X-Forwarded-Encrypted: i=1; AFNElJ/izcZ5XjR9XJ3/MuOsm+CqoF/p3pPDkyoeo+aJw34l7uieLT5wCRZUv0AKPkx1ZWBN4BfZOEE+XcsZlT8=@vger.kernel.org X-Gm-Message-State: AOJu0YwT1bN++Gw1UYXBMZwpbtuLyklhbkPypec9YLdUAMMXHg391EBF V7XQhGBb12p5G6f5EJyhcfM9Ubuw84/FDdN3GN4m9gA7vZrKmS1G7n5P X-Gm-Gg: AeBDietgsMJNoRWQg0pCk7fnQPlXgXUBRALvanBOWnbPFUDvsDfLfAF6sEhyBJwnKwx k1sNyr6BWjjvq0XsMzykF9cbj/rpAsA1l2HQAH+HwIhAhWMB6Vdf7sFthCr1+Eq0LPJdCnlSuSQ ZmCLhC2J2YcQVZxwuqJOewgI8gsZMS2pGnB8kI1sl5rZrnxMTr/9QLh0hgCxFes5Diu1mGyXFDs lTyV7Uqhpw1XSOYLZPWbnKgdO7Z98ZEm0p3g4ukBrJr+5i2xCDfZofLFZzjvW05gCS4aTCB2YQa hZpVIMeVrh+JJLzaLMmLENI9ZTWfkAKwqEZSjhCopDr8tIN7dGG1dDyQ130sWQxv/75rh662KD5 NDV1+GMrOdQ3h/vAjFQMmR03oyUl50E+APjviAdWcEomvzeO8mMD0Wq8oMfBp1ynXsyQk9RQOOL UH9KgCpjwXX4f06iA7JtdsDPXI6kE1pMhjBHJYX5nyyGCvCaBt+CLFJqposnpD/vr1K7h3XFM4d h75cOU/hze+4Is= X-Received: by 2002:a17:90b:4ccf:b0:35f:b647:d973 with SMTP id 98e67ed59e1d1-36140229b13mr38654992a91.0.1777193887102; Sun, 26 Apr 2026 01:58:07 -0700 (PDT) Received: from li-1a3e774c-28e4-11b2-a85c-acc9f2883e29.ibm.com.com ([106.51.164.157]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-36141868906sm27718937a91.3.2026.04.26.01.57.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Apr 2026 01:58:06 -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, daniel.almeida@collabora.com, fujita.tomonori@gmail.com, viresh.kumar@linaro.org, prafulrai522@gmail.com, gregkh@linuxfoundation.org, arnd@arndb.de, tamird@kernel.org, mkchauras@gmail.com, lyude@redhat.com, airlied@gmail.com, j@jannau.net, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, llvm@lists.linux.dev Cc: =?UTF-8?q?Christian=20K=C3=B6nig?= Subject: [PATCH V14 2/7] dma-resv: Fix undefined symbol when CONFIG_DMA_SHARED_BUFFER is disabled Date: Sun, 26 Apr 2026 14:27:20 +0530 Message-ID: <20260426085725.2090827-3-mkchauras@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260426085725.2090827-1-mkchauras@gmail.com> References: <20260426085725.2090827-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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable When building with LLVM=3D1 for architectures like powerpc where CONFIG_DMA_SHARED_BUFFER is not enabled, the build fails with: ld.lld: error: undefined symbol: dma_resv_reset_max_fences >>> referenced by helpers.c >>> rust/helpers/helpers.o:(rust_helper_dma_resv_unlock) The issue occurs because: 1. CONFIG_DEBUG_MUTEXES=3Dy is enabled 2. CONFIG_DMA_SHARED_BUFFER is not enabled 3. dma_resv_reset_max_fences() is declared in the header when CONFIG_DEBUG_MUTEXES is set 4. But the function is only compiled in drivers/dma-buf/dma-resv.c, which is only built when CONFIG_DMA_SHARED_BUFFER is enabled 5. Rust helpers call dma_resv_unlock() which calls dma_resv_reset_max_fences(), causing an undefined symbol Fix this by compiling `dma-resv.c` file only when CONFIG_DMA_SHARED_BUFFER is enabled. Fixes: 9b836641d3bf ("rust: helpers: Add bindings/wrappers for dma_resv_loc= k") Reviewed-by: Christian K=C3=B6nig Signed-off-by: Mukesh Kumar Chaurasiya (IBM) --- rust/helpers/helpers.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c index 625921e27dfb..09ee5cac600d 100644 --- a/rust/helpers/helpers.c +++ b/rust/helpers/helpers.c @@ -57,7 +57,9 @@ #include "cred.c" #include "device.c" #include "dma.c" +#ifdef CONFIG_DMA_SHARED_BUFFER #include "dma-resv.c" +#endif #include "drm.c" #include "err.c" #include "irq.c" --=20 2.53.0 From nobody Fri Jun 19 07:45:41 2026 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (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 18F232FFF99 for ; Sun, 26 Apr 2026 08:58:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777193901; cv=none; b=W1rX2I/1YBz830oSIpOLDidgh/HJOhIpDBtrbyxwIrYAk5O37BopfkQAwGW2XGwJfGSZg448LpOvHzNjg4EHvGAT8lXd7QMDaWSUUrtlLjpmrvRgV/gJCsQBNUdMVb6uV4z4Umq7TVT9v9D7IH+JdFaJU53s0E5EhJbE19naGCA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777193901; c=relaxed/simple; bh=8WQ7jEq8bJBsdnlHGUXrbWXnXrrr5Xxc2+zvN+1cF+Y=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FmIMbjbtQ732dohIaaVjGrwWY6S7Irujj4jsl8goUjyKb86ZKoJWt3ZvbhqpCB6bNboNthIarDvCA1Id6ZXeps+Rg/iPV5uXis6Z0/1hdbS1vCX03Yz+4/uMonTUqdZlYacMOYRi0aQodIuzckWVWbiPD2UBXSWs9GghPhdXoaM= 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=m+96q5zw; arc=none smtp.client-ip=209.85.216.44 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="m+96q5zw" Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-3567e2b4159so6231089a91.0 for ; Sun, 26 Apr 2026 01:58:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777193899; x=1777798699; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=SIf376OZyXcpY0mdrIrP1nTWV/VE0v5g8114Fjjgl84=; b=m+96q5zwnMQd+kcmnGOY0Ns9ZcThDEqrSTHZ7kIct2RuuFNoFhYsw9CxElJ7/XAszL aa9w33ZvMnKFwy08jsbPejuC6TIBSyKjjGc/QuRjue3PubOfnEgto0tMFOHQhjSvpH+i 2eGE+KSYu0+j4G4RN+jvCsOp5uSWXpcdpXVOopXpTLK2dSB/oNLP9LYiH6xcS/yMoFYs IvQb1BORHqHf1WutQGSjA5WSq8k1aIVGVfxAc5eI6dd40AVlBKq8RkSCVgASz9reyjN3 wghS6ikwiHJnTGGqAnLDQXOEDlyBIzPp9fXna1d0cXkiwLSY3Qj94M5NDqoM8MEl7aNK kKsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777193899; x=1777798699; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=SIf376OZyXcpY0mdrIrP1nTWV/VE0v5g8114Fjjgl84=; b=HE7OTVWrcbyyMhSEi8KcYxhNKotmzHFvbyBFQDdczD8kcdYodBXHwqF7wF0vM+wnJy qJr3lLG0xSciA2KyknHCvhYJfpKqZdsnwKVdja/03GtcXwOL4VKh/4JaSc28Aa5n/SQY cO+vYgucRrmDJ9vVtAz0pk3RblqyO5v8hLuvkp3zB9s4ZbUP9hl8flVcHvkpehkaVayq NA1oSYhDVRwShbfYwalhOHnMlOoB/bPnNoOmoh2xooENpZ7bouu0dLPWs849zL4lBO4I GVkZgKlPaWo0O2sbcQaL1X4o+eTxdmZ/8ZGDE0aJ+4uprdi/3BsPUrsGgzm0vw25OZiW wz1Q== X-Forwarded-Encrypted: i=1; AFNElJ+Z6WIRZKy75WQrjiuTlBNvnit1IBDT/aq6x7ibrBey+74BKUOFYdAldpyNRStXj3GUDBj0k2xu7JtHRjU=@vger.kernel.org X-Gm-Message-State: AOJu0YzjoaVBc+e0t34HHfWZj3DBkc5YPeylWbl7S0O3zNY2r9YxY4XP 3EKzMsregZGrgqx5fBMSvH9PhVeBqrZ+rvjd/WIQXYSp+Df1vNKsHeaM X-Gm-Gg: AeBDiesR1TX9ik5ZrYTRktQ0mk+wNqNqWK79sRl30Ia29l/QOqmnUD6JXq8KeL7xC9C ETJ060w4nHTHJsQJkrYabncNW6TyP82YwXrM+ljvp8tXatvaSnDpclxK9NSr0W0YPwIEqoz7HX1 bKz+PZ7tIpa+IJPqUUN5l0CD8Z3V8l0WAowhna6AFPkJ+0mluRewWnc7pKO/Zd9W7COkEdAOHM9 gV896qnqFFu5768WsLQOf/dqH583ykLTzgh20cJWNSVYaPOH2LR/YeQKy1ESbtWlV6oNg2m5yuF Za1fqiYGq43kPaJCMFXlpnIDt4JwrdpYMbG8o7yPGycGhUXxahXm7o192pFDqTMvIBRquF70jrV 0Pa5h1c2cTcFB9wN/kpxJRiyAuJu2INiWg3VyrEEDYveR1aOTDL3Eywpybr6WkgGBIlfng0mYHf kM99nvybFOL3IVVi2U+I0Y1Y7TQejJHPW5ZbbFnl5PIrziEEkgK0rtyvoDUoP3CtXa8DYZ4wjP1 jiZhb14Z1YdSUg= X-Received: by 2002:a17:90b:3f47:b0:35f:b1ad:fded with SMTP id 98e67ed59e1d1-36140474686mr40098125a91.18.1777193899315; Sun, 26 Apr 2026 01:58:19 -0700 (PDT) Received: from li-1a3e774c-28e4-11b2-a85c-acc9f2883e29.ibm.com.com ([106.51.164.157]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-36141868906sm27718937a91.3.2026.04.26.01.58.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Apr 2026 01:58:18 -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, daniel.almeida@collabora.com, fujita.tomonori@gmail.com, viresh.kumar@linaro.org, prafulrai522@gmail.com, gregkh@linuxfoundation.org, arnd@arndb.de, tamird@kernel.org, mkchauras@gmail.com, lyude@redhat.com, airlied@gmail.com, j@jannau.net, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH V14 3/7] powerpc/jump_label: adjust inline asm to be consistent Date: Sun, 26 Apr 2026 14:27:21 +0530 Message-ID: <20260426085725.2090827-4-mkchauras@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260426085725.2090827-1-mkchauras@gmail.com> References: <20260426085725.2090827-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" Added support for a new macro ARCH_STATIC_BRANCH_ASM in powerpc to avoid duplication of inline asm between C and Rust. This is inline with 'commit aecaf181651c ("jump_label: adjust inline asm to be cons= istent")' Co-developed-by: Madhavan Srinivasan Signed-off-by: Madhavan Srinivasan Reviewed-by: Alice Ryhl Reviewed-by: Christophe Leroy (CS GROUP) Reviewed-by: Gary Guo 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) --- arch/powerpc/include/asm/jump_label.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/include/asm/jump_label.h b/arch/powerpc/include/a= sm/jump_label.h index d4eaba459a0e..3016e9c8d6bc 100644 --- a/arch/powerpc/include/asm/jump_label.h +++ b/arch/powerpc/include/asm/jump_label.h @@ -15,14 +15,20 @@ #define JUMP_ENTRY_TYPE stringify_in_c(FTR_ENTRY_LONG) #define JUMP_LABEL_NOP_SIZE 4 =20 +#define JUMP_TABLE_ENTRY(key, label) \ + ".pushsection __jump_table, \"aw\" \n\t" \ + ".long 1b - ., " label " - . \n\t" \ + JUMP_ENTRY_TYPE key " - . \n\t" \ + ".popsection \n\t" + +#define ARCH_STATIC_BRANCH_ASM(key, label) \ + "1: nop \n\t" \ + JUMP_TABLE_ENTRY(key, label) + static __always_inline bool arch_static_branch(struct static_key *key, boo= l branch) { - asm goto("1:\n\t" - "nop # arch_static_branch\n\t" - ".pushsection __jump_table, \"aw\"\n\t" - ".long 1b - ., %l[l_yes] - .\n\t" - JUMP_ENTRY_TYPE "%c0 - .\n\t" - ".popsection \n\t" + asm goto( + ARCH_STATIC_BRANCH_ASM("%c0", "%l[l_yes]") : : "i" (&((char *)key)[branch]) : : l_yes); =20 return false; @@ -34,10 +40,7 @@ static __always_inline bool arch_static_branch_jump(stru= ct static_key *key, bool { asm goto("1:\n\t" "b %l[l_yes] # arch_static_branch_jump\n\t" - ".pushsection __jump_table, \"aw\"\n\t" - ".long 1b - ., %l[l_yes] - .\n\t" - JUMP_ENTRY_TYPE "%c0 - .\n\t" - ".popsection \n\t" + JUMP_TABLE_ENTRY("%c0", "%l[l_yes]") : : "i" (&((char *)key)[branch]) : : l_yes); =20 return false; --=20 2.53.0 From nobody Fri Jun 19 07:45:41 2026 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (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 62E832DB7B4 for ; Sun, 26 Apr 2026 08:58:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777193913; cv=none; b=Tblpch1X7puCRkVKyVssTq2lVdm8W9M8lBdBTAOXUb7W/VwxUXEBau5RB4t6z4qUj00nYj1lrO6AyScbP5Yrml0+odW5IU2FSyOCW4VrkPweGmBaU/i607SYX1lgGV1bFY5sN4Ix5ANOyZOBd3TC7EW/ClTUZMWQC5+Wjb4ialk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777193913; c=relaxed/simple; bh=r1aKh5I901VyW1MTDbYbzZkzaliwYbiMtV4wPKGZXxM=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qW7wasL2jwVNvX9tukcKm+5eUbPG9Si5Paii+hl7d3e/OCTHXeDV2iaX6lJFaWR1rCVnStlcHX5ZgDBWYRGFkKf+fsmWpWwdhr9HPeEeRuWKrNBxDa1RUh6L6JXyxoxxCkkIAttpZwxYoep/oheD+3zilge849O7ESqvDa2b3jo= 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=chLkiS8u; arc=none smtp.client-ip=209.85.216.49 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="chLkiS8u" Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-35d94f4ee36so5607074a91.3 for ; Sun, 26 Apr 2026 01:58:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777193912; x=1777798712; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=xKjAi9HbHD3A8vBvpsVmPpMZEiOAHaxheYu3agjVGmU=; b=chLkiS8u3pQGdO3LWSrDojAaAL3ASk50TuefBsHDoQZ5HNQCRvIUSxEgfGw0/kXjr3 VZGzOCLhHyU/xlNYoPRvpD5RfHWxbsQBuM0iw6fYyNW0WRerNLjThsiTNGctNkDcw5LP upw0ZE8y+p3rdOCUxJXKsVpLvRl3j+ejGYkvm+2TlxUxw+3UOjCCxNUSVB4AvdbYpAWM Je1RIRMky7cimJqRupPOhO1BeHy0NB/qrVYCx/rl16WUT4rvKkhHWKkZKjMkGODEWBid aXXYFdwHAuUsPQrOhtnfNVtczKFz5UQFezUsR4xaiuBx116cS1d3azlsyw4QkxXHFD5P 15RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777193912; x=1777798712; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=xKjAi9HbHD3A8vBvpsVmPpMZEiOAHaxheYu3agjVGmU=; b=SjYtSPgm+tidY4qNH1NK32lIRA89xBlV9DQdjqN62ZpYKz8xargzdYida4dkTP2LD8 BiSJ5GPe7pB2SVwKVo0lfz8sS9/+o19N2J4znfEf3tjFPwFeUhm32HtK+nwQfxReEW9S 1JHCWM+sUmr9d3W59JzNjAyDaPhGPR2o6nuZphsYd0lahA1w2GaaU+BEf5V+/WYl0tK3 W7YIWfb3WWetdwEN3P3qD9RonulZSbS+dEojwrK7zFQCmTuFU0wuddEKqGlNRIPOCjkD jR3Ytd0Lwk01np2QK2xo0a5CYWV9JIUFhH6aT2dYIan9mKzJ8OvUseEvW4D9GoGtog4c eEyQ== X-Forwarded-Encrypted: i=1; AFNElJ/kxSXwnUxj/TIHfq9Ez4HiLzmD0yJBms9DffN8OBPo0iVvVREX3MdMk8mHMbNQti0j/WqKoK0ggcSEpsI=@vger.kernel.org X-Gm-Message-State: AOJu0Yxn5n2GgRCLCMbQmegoHg0vKVfXV9rTVHWVfmrs91JISoNWZmUK AxkKRgYpTHW3TKKpkemTKrJ0rcx9Z8N8ume6y1W1YtOZqafcriKnOzIS X-Gm-Gg: AeBDieu10Sa3W6D+hbAc3/AlHHsRn2whb7eBKrUHj3vx261aMezfjBW7/GyonXFTEnm +H0/S8GIVBEqui+/KC5CakcJgyFGqqWxUZE1UiCT2k4lX6bWKRs/BAYEnxlASWAr3iFh9nsobbI LqJFx59p62+yzAaLYZriuTF8Vr7Zqox52qZHsq8bAFG30qlTREDKSsZSdO6E8IQtv7a4TS5N/TC cWDQlJfu+RIbEwHRvzB+wRU+tLN9/hpVgGe3R1xvY1dTpaYvGaRSSLKLeGMXqZrVFQV6YTMQKH+ 1NH04U3evLNDByARMwC8Xhai8P+Y77r2wsPNmyXdllplN0q6du9QhSchZLUnISQ+dPKhfVtVcPr 3O+HAlDgEpp5Bb9UEIucqpH9ek8p9rSaifSsMD6GFHvCO0wIcq0WfQf2T6F4YdWAcYTFqZq/I5M 3OBpn9B0T/jvLpxjiAVotUHquUDZyK3fGuXv2JXeiqii3geCFqXpn+a/5Hs9KuR9/iBEAKq4+3V LprglTw/uQvYwI= X-Received: by 2002:a17:90b:4a0a:b0:35e:58d3:3284 with SMTP id 98e67ed59e1d1-361403e083bmr38831908a91.9.1777193911700; Sun, 26 Apr 2026 01:58:31 -0700 (PDT) Received: from li-1a3e774c-28e4-11b2-a85c-acc9f2883e29.ibm.com.com ([106.51.164.157]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-36141868906sm27718937a91.3.2026.04.26.01.58.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Apr 2026 01:58:31 -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, daniel.almeida@collabora.com, fujita.tomonori@gmail.com, viresh.kumar@linaro.org, prafulrai522@gmail.com, gregkh@linuxfoundation.org, arnd@arndb.de, tamird@kernel.org, mkchauras@gmail.com, lyude@redhat.com, airlied@gmail.com, j@jannau.net, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH V14 4/7] rust/powerpc: Set min rustc version for powerpc Date: Sun, 26 Apr 2026 14:27:22 +0530 Message-ID: <20260426085725.2090827-5-mkchauras@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260426085725.2090827-1-mkchauras@gmail.com> References: <20260426085725.2090827-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" Minimum `rustc` version required for powerpc is 1.95 as some critical features required for compiling rust code for kernel are not there. For example Stable inline asm support which got merged in 1.95. Link: https://github.com/rust-lang/rust/pull/147996 Signed-off-by: Mukesh Kumar Chaurasiya (IBM) --- scripts/min-tool-version.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/min-tool-version.sh b/scripts/min-tool-version.sh index b96ec2d379b6..406895621511 100755 --- a/scripts/min-tool-version.sh +++ b/scripts/min-tool-version.sh @@ -31,7 +31,11 @@ llvm) fi ;; rustc) - echo 1.85.0 + if [ "$ARCH" =3D powerpc ]; then + echo 1.95.0 + else + echo 1.85.0 + fi ;; bindgen) echo 0.71.1 --=20 2.53.0 From nobody Fri Jun 19 07:45:41 2026 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (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 C7E262DB7B4 for ; Sun, 26 Apr 2026 08:58:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777193927; cv=none; b=DgoFBgOMakrpqz/XjXCRhlJt1ig+HFcOttCAFEcDwh/a1NB/70DrP3AgQ05pVrIh9judBMYjc14EWGwnc5O9MZBLiZKqreV+ICFOiL7X9qUNShSYvZ6zFxErBlg84HgFa9yx+RdzroHX/sqphOorr+YC32lT/p7A5M3YgFK8z54= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777193927; c=relaxed/simple; bh=skp6a1+i24vr3ZUetqOg5WmKTF0iU/JeJP6zzFcRmSg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=X00VPekGcyqCoIA/d/xQVFHXsLs0KmSsiibjgYkD00AeeaWRbkIk8Gc6AwurGHFCFwPSntdCfFlLXroUF7OYaZhZJc5LkBqXp1GqZBvovXfOoEPdqmIN9itCsM00gqLvQrlOm0EdDahEVs5kZSO25JzSmiS0Z58uPrPxrMrrLcc= 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=SKFJMBl7; arc=none smtp.client-ip=209.85.216.52 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="SKFJMBl7" Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-3585ec417f6so4799398a91.1 for ; Sun, 26 Apr 2026 01:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777193924; x=1777798724; 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=9SYhnvPVAJd1oaQ7E3w3ymi0iyxJM6QAUXA089o3vB8=; b=SKFJMBl7vC1PjQa3y6+uUar3RwHNVMrMY2iKubZT5vixfqAmtYrvgJ26Jaqt1X60M6 64WQpsf7Lk86vNA4bBg7xbh0sMfeUClrc0csIoJcd4Ew7Wu1kiOHqycvR+tG2EfXiqCb tKO86JuxSKqYTChqIEWWyeIrna9NVE5dOm2DIp/G4HAOAkl35OtFlWYxpbYPsw1BevUK xOdwxg8xfNC3tx84onJzeMHbhnqQwL15GSUez+zN04Uu59U2wglNYjp4UmKoQ/W4XAzy 8IQR1PXtetONlYRIxEYly/7pBMIwG7L5xV4ySLj0jI/4uwnqIuPvA7Pm4CEEylCK71sn CTrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777193924; x=1777798724; 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=9SYhnvPVAJd1oaQ7E3w3ymi0iyxJM6QAUXA089o3vB8=; b=GOTaMDyYIcolQKdrdeTwtbxm6bLGnUErXClZfbeRDYm9+tsTFLxCemTUmrLO864X8m xXBfdRZcEcAGOBIhEKWOpBdrOlZ4GXR42Es3XKxdyyxtkl/hK4kzQx+PIWb579eG76AD 7Dy1TzcHL093mrhXyEESUDjXTHfDbver/qgkz147Xb0ZCuEQHIPwJc0ZGdROGjBRrKnj rI5HIx8VJ0xCZreMKcubGRNSDDQ6rKBvo67oBT127VnqS8H0V/NFw6iTQ7XAvrhziR2w poDi4K+HK6jge7NulPQs81jD+mMtS/btGgryz5RH0bR/0FXnjNIzKfbm7TtOXKMX/koa 7ybQ== X-Forwarded-Encrypted: i=1; AFNElJ87kw94bjbq2RV6sHr9+WviP+5RuqhZYw7EgzYd4YfddBMn//ffygbHzqMMXWr54B9trKBXzKOxqIJuwx4=@vger.kernel.org X-Gm-Message-State: AOJu0YzJqkJLpbkrJwvclFD9+tp+cAhj1cc29tYymWNhLtGAAIrekqWn 1zWYgLD+SLlUSC/uuR/F2D/zhiGJ7yag9Y8dxLwXpFBr8dp4Cq+Nfbhi X-Gm-Gg: AeBDietdW3dq4OzzZkOS0ZL2zGc9XoQG69l5Piwrwyq0WtrR05yJPRSrtwq76E2/gEF 6q36awuchgze+IpNqCcz1LzPZstbknbLYMuue/SlXqGrhcWMQaSYMppxzpfqolv1e2qvXDR+92I WBGsSLIpaCRHYch658P9zym74+0qTtyx3iM5paXNZaOW17MWp96Q8KolVie89eonL2zpGLfRuLK namj59NqphWiXZXoTHq9ZPM/+1wGcHNZCmLi85yRb2Y5W44c+rt/ZgqS4ZA/fHe/caW/Sonj79i U0GQmlqIo6CcbRmwSq7SyvDH1E13CiyzD3X7tyFv//BSRqEe6oWujf2Qf/duacaRWb8hzoiEyv/ AAyn3X1rd3AUeessSshNI0Xz8crEzWDc7MIItuWNmGlD6awvjTPBhjnwhWYoQ8y5mbUEQ84TJ9V k0RnKrFTArvydLj2P0hGBKQwILfprO5/49dIVuBAET20NfUgnpk3u55nkruai7ONJbr/EHxRXrs nBLKqHhDAH+em4= X-Received: by 2002:a17:90b:52cf:b0:35f:b9f1:fded with SMTP id 98e67ed59e1d1-361402edcc2mr27986180a91.12.1777193924145; Sun, 26 Apr 2026 01:58:44 -0700 (PDT) Received: from li-1a3e774c-28e4-11b2-a85c-acc9f2883e29.ibm.com.com ([106.51.164.157]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-36141868906sm27718937a91.3.2026.04.26.01.58.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Apr 2026 01:58:43 -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, daniel.almeida@collabora.com, fujita.tomonori@gmail.com, viresh.kumar@linaro.org, prafulrai522@gmail.com, gregkh@linuxfoundation.org, arnd@arndb.de, tamird@kernel.org, mkchauras@gmail.com, lyude@redhat.com, airlied@gmail.com, j@jannau.net, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, llvm@lists.linux.dev Cc: Link Mauve Subject: [PATCH V14 5/7] rust: Make __udivdi3() and __umoddi3() panic Date: Sun, 26 Apr 2026 14:27:23 +0530 Message-ID: <20260426085725.2090827-6-mkchauras@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260426085725.2090827-1-mkchauras@gmail.com> References: <20260426085725.2090827-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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Link Mauve The core crate currently depends on these two functions for i64/u64/ i128/u128/core::time::Duration formatting, but we shouldn=E2=80=99t use tha= t in the kernel so let=E2=80=99s panic if they are ever called. This doesn=E2=80=99t yet fix drm_panic_qr.rs, which also uses __udivdi3 when CONFIG_CC_OPTIMIZE_FOR_SIZE=3Dy, but at least makes the rest of the kernel build on PPC32. Signed-off-by: Link Mauve Signed-off-by: Mukesh Kumar Chaurasiya (IBM) --- rust/Makefile | 4 ++++ rust/compiler_builtins.rs | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/rust/Makefile b/rust/Makefile index f6369d121c50..9aa18cff2fae 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -615,6 +615,10 @@ ifneq ($(or $(CONFIG_ARM64),$(and $(CONFIG_RISCV),$(CO= NFIG_64BIT))),) __ashrti3 \ __ashlti3 __lshrti3 endif +ifdef CONFIG_PPC32 + redirect-intrinsics +=3D \ + __udivdi3 __umoddi3 +endif =20 ifdef CONFIG_MODVERSIONS cmd_gendwarfksyms =3D $(if $(skip_gendwarfksyms),, \ diff --git a/rust/compiler_builtins.rs b/rust/compiler_builtins.rs index dd16c1dc899c..fc6b54636dd5 100644 --- a/rust/compiler_builtins.rs +++ b/rust/compiler_builtins.rs @@ -97,5 +97,11 @@ pub extern "C" fn $ident() { __aeabi_uldivmod, }); =20 +#[cfg(target_arch =3D "powerpc")] +define_panicking_intrinsics!("`u64` division/modulo should not be used", { + __udivdi3, + __umoddi3, +}); + // NOTE: if you are adding a new intrinsic here, you should also add it to // `redirect-intrinsics` in `rust/Makefile`. --=20 2.53.0 From nobody Fri Jun 19 07:45:41 2026 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (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 53D312DB7B4 for ; Sun, 26 Apr 2026 08:58:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777193938; cv=none; b=rByCD91WcWECcdhOX7vX/M4A/mLLxl38agUtTa3S1QEqdl0+dRLu0GgsmZ4MaqxAebSkrVfYLswVGI3YOwQzTCxTDJsD9/58HuN58mEsCGNia1VSCQdhx4iOlYal4HgJqJLrMOoEapXvmnJHkr4AqbcOrKBJWhDU7bTR3T8PWNQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777193938; c=relaxed/simple; bh=WhlwkXNuyZCQ6C5N8eUhev/OuBv5UthRFAKgfmLfnq0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ppwYHyCZ1k0Koi7ukUNZPJRIXeqLCHtbHaxVCNJLyVe8wNtfL7C58exgpB6VX2QutWZwtDfelu7pQTubJBFX1lERpTULIJKSSkR7sADnaBObR6G5BLHQGBGpTc0kdSDlt3LQPEfp/AKIP2LcYH3CtI73QgsPkTpmiva1DTtrOdA= 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=G4JcW8nk; arc=none smtp.client-ip=209.85.216.43 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="G4JcW8nk" Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-35f9ab079bdso6115842a91.2 for ; Sun, 26 Apr 2026 01:58:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777193937; x=1777798737; 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=AMHiysWjfyDRuRD5lpg8f9BCP2bUjUGrNK0xtp2jPK8=; b=G4JcW8nka/IIe6TLkx8SZgKpDb4hObHrq4l71i4ZY5vBKqlAinmeJefOjLPI9TlfvC U56Dnih9fuwvFN9RvmEhAvRflGT9Y4zN38Klyrei7sHwF1aAKgL/ALgGAw0rHBChUPHG bjQ9s8nvC5HKwEnodSAxwVam9fWQzJHzln0Fz0X7QVplDQXxgkz+eR96vmOYivqhL82K 4MMUgQRIF4qJcnokES6l5F1xYNKuBJyvOwxHEsMhElbRivsewQbEub/gv+Di7FItiyFX TvuzCMfhq37odOpVZNbXIXxqaMVzzr8cwy/rmD4Bw71KI+NkgvAw0bpCEhiPIx1PYVir oI7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777193937; x=1777798737; 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=AMHiysWjfyDRuRD5lpg8f9BCP2bUjUGrNK0xtp2jPK8=; b=SOGF2Gj/pPQah+nUBY4YNqO62+mE5TsnIYbusiv1rkOqENBVYVn2zqxf3g+/8n+rVK aAqPsyd7hTzc2F+386y4bBwqgvCiPGxP9nR+9LZaBDEOZEQGLpoYKpF++hb/Eg9f0vwJ BScTt/Sfs9s7kjEIndr4hGOr+PeAzbkp35NPIRz/Yy0w2iS4IZfu3KSN65/8qAZLxdtq rRU0eg65zyOtNvyjHSLJHuG0IKy40TMY+cksIqqRjDp9jdxEJnyjKJETyR/3sfvaY4sX Rd5+OJwnL+3+hDcN+UnEosdEFPAdKNcUgVFNEmnEOVhfAZzT21h7Pp+ACgyV9jcyHEdK h9uw== X-Forwarded-Encrypted: i=1; AFNElJ9/tyj2/6VycTqOvO1feCvUmcPMPqtbZmhtzC+ewbvTVX6Ws8SNi7N0DrQhH/4EDD6MfwSr7+Z6Xmy4tno=@vger.kernel.org X-Gm-Message-State: AOJu0Yxh1ULywJYr5YRn555CDMOG12QVdGcbMGUTZK3P/xNTId87iYYD w/yFSIy/Th9Mb6cv4A0pfRP5/rEvuUVul7TMDCFvRRYJEzC+AFEzDCzl X-Gm-Gg: AeBDievy6QKFD2qSD+OrZ9Y2sqviScuR/lDz/q5v3v4e01xfoFTI4wiLZJPwL674j9h a8DhEX4LdhhMipmrC25VlgR7kZV6uqC9FxAA2kIM5IiNceyld8aSgkigT1UNZO+8nPNPuajcyg5 N/ikEe/AdqseLU83H+DzITnETozzbW9nfozVnRzjPT0lWewn+qzTYwHOMGn72oTshu/aGaLV6xX oSdFAvdaj9kAxYZNfow5kYc/xFAfrC2NiOAOyEp6C0cWnEoJEi1bNIsOU/uqvAdU3zNY5jDp3gz Rq+vBSbCnHfWLDgY7/0s5N8OLsGDYBT0jHq2bZ5aV6nwSe9EV5gdYNGg5eqICqBx9BJVK6co44x ihGyEg+FDsMfPhI7ujhTfwa3pH30Z+UQNxwpuPLtG0qpSs3L/XOfvtd8BQLmgMzzIFUGoMvRshq 90Nz8uxm30CQJJikpozYs2QXVVYo7Ew12UqtTYsyXRTLzjGg8Afe8E/9CACiF7q3MgbfQqqpX2m alih9ZDxnSY+Uo= X-Received: by 2002:a17:90b:1809:b0:359:15c8:e8e1 with SMTP id 98e67ed59e1d1-361404a8241mr39217733a91.25.1777193936535; Sun, 26 Apr 2026 01:58:56 -0700 (PDT) Received: from li-1a3e774c-28e4-11b2-a85c-acc9f2883e29.ibm.com.com ([106.51.164.157]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-36141868906sm27718937a91.3.2026.04.26.01.58.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Apr 2026 01:58:56 -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, daniel.almeida@collabora.com, fujita.tomonori@gmail.com, viresh.kumar@linaro.org, prafulrai522@gmail.com, gregkh@linuxfoundation.org, arnd@arndb.de, tamird@kernel.org, mkchauras@gmail.com, lyude@redhat.com, airlied@gmail.com, j@jannau.net, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, llvm@lists.linux.dev Cc: Link Mauve Subject: [PATCH V14 6/7] rust: Add PowerPC support Date: Sun, 26 Apr 2026 14:27:24 +0530 Message-ID: <20260426085725.2090827-7-mkchauras@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260426085725.2090827-1-mkchauras@gmail.com> References: <20260426085725.2090827-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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Link Mauve For now only Big Endian 32-bit PowerPC is supported, as that is the only hardware I have. This has been tested on the Nintendo Wii so far, but I plan on also using it on the GameCube, Wii U and Apple G4. These changes aren=E2=80=99t the only ones required to get the kernel to co= mpile and link on PowerPC, libcore will also have to be changed to not use integer division to format u64, u128 and core::time::Duration, otherwise __udivdi3() and __umoddi3() will have to be added. I have tested this change by replacing the three implementations with unimplemented!() and it linked just fine. Signed-off-by: Link Mauve Link: https://github.com/Rust-for-Linux/linux/issues/105 Link: https://github.com/linuxppc/issues/issues/451 Acked-by: Gary Guo Signed-off-by: Mukesh Kumar Chaurasiya (IBM) --- arch/powerpc/Kconfig | 1 + arch/powerpc/Makefile | 2 ++ rust/Makefile | 4 +++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index e93df95b79e7..4ac897b650d4 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -285,6 +285,7 @@ config PPC select HAVE_REGS_AND_STACK_ACCESS_API select HAVE_RELIABLE_STACKTRACE select HAVE_RSEQ + select HAVE_RUST if PPC32 select HAVE_SAMPLE_FTRACE_DIRECT if HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS select HAVE_SAMPLE_FTRACE_DIRECT_MULTI if HAVE_DYNAMIC_FTRACE_WITH_DIRECT= _CALLS select HAVE_SETUP_PER_CPU_AREA if PPC64 diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index a58b1029592c..589613eaa5dc 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -61,6 +61,8 @@ else KBUILD_LDFLAGS_MODULE +=3D $(objtree)/arch/powerpc/lib/crtsavres.o endif =20 +KBUILD_RUSTFLAGS +=3D --target=3Dpowerpc-unknown-linux-gnu + ifdef CONFIG_CPU_LITTLE_ENDIAN KBUILD_CPPFLAGS +=3D -mlittle-endian KBUILD_LDFLAGS +=3D -EL diff --git a/rust/Makefile b/rust/Makefile index 9aa18cff2fae..03926a451bac 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -399,13 +399,15 @@ bindgen_skip_c_flags :=3D -mno-fp-ret-in-387 -mprefer= red-stack-boundary=3D% \ -fstrict-flex-arrays=3D% -fmin-function-alignment=3D% \ -fzero-init-padding-bits=3D% -mno-fdpic \ -fdiagnostics-show-context -fdiagnostics-show-context=3D% \ - --param=3D% --param asan-% -fno-isolate-erroneous-paths-dereference + --param=3D% --param asan-% -fno-isolate-erroneous-paths-dereference \ + -ffixed-r2 -mmultiple -mno-readonly-in-sdata =20 # Derived from `scripts/Makefile.clang`. BINDGEN_TARGET_x86 :=3D x86_64-linux-gnu BINDGEN_TARGET_arm64 :=3D aarch64-linux-gnu BINDGEN_TARGET_arm :=3D arm-linux-gnueabi BINDGEN_TARGET_loongarch :=3D loongarch64-linux-gnusf +BINDGEN_TARGET_powerpc :=3D powerpc-linux-gnu BINDGEN_TARGET_um :=3D $(BINDGEN_TARGET_$(SUBARCH)) BINDGEN_TARGET :=3D $(BINDGEN_TARGET_$(SRCARCH)) =20 --=20 2.53.0 From nobody Fri Jun 19 07:45:41 2026 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (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 B3B322E06E4 for ; Sun, 26 Apr 2026 08:59:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777193952; cv=none; b=sLW4ke/p7kPtKqAkwI5b/Su1DXU1CxyN6xW5jJc+ANdvStu+EBXiJbWzPITJboRQSdup8pT6YUy6Rz70gO8judC7FxTdcKVKtk4ryikLeSYBbUZMDOa/dTRsU/fmFm434j9XqqnjRoaZhxP0gNzyHLzGqwpQOiqJ/12qRC+cToo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777193952; c=relaxed/simple; bh=Tc8sOod0krNItOJV2MA2sQK3bhEDWu/YmKLDcz4nh/c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VMOXYJA0BG2Ryiia21laUMujYG3jKcC/vPbZeK5UAxFGHfi28wxpFiJ0BZU4HPdWA9ginqKBTvujCPILor62RC5GT9Ir1i4B9KivtxAnH4R6XE4bIhbV7UAdwLFAl+nB+ohXcmXMYQ95nqt3bJGNAxek5yvQNzHf4oc/TisheG4= 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=Mhd/NIHO; arc=none smtp.client-ip=209.85.216.45 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="Mhd/NIHO" Received: by mail-pj1-f45.google.com with SMTP id 98e67ed59e1d1-35da1af3e10so8579695a91.3 for ; Sun, 26 Apr 2026 01:59:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777193950; x=1777798750; 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=55+b7l5F3zlZQ0yMZrz5rEYbg5vrZhPlJC+KY+nm9CU=; b=Mhd/NIHO5WcLtT7pxleLaeYNaNoqNJ27bnm5uQkCC+RUdn0OSUKtOHbtfJndmu03Pl AGH0PXiadDDNWYVFJ9rv4kPhG8UOKW2WMqSfcyQLrakyyvjvOTcrbHAvyHXmPzCuMj1V uaGAB94Ey4TTOT0N66e0gKv+3yk+qdsIuQVHI2wunkodZYo+ScPB24PDXqyJKqnLIDqp 6Vvqs6xATLTSaEdYuE9l6ZC+N0wgdTfh5KpCTjLqN/vLGzpmy1V6Pwiw5RGgEOZwlAW4 aubFLLyh1Ll7kl5pVnwgXeaJ0i6gWMIk2zgbn6bj39m+qfNYY+/HS9EZB2+Yx9da650D Ia/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777193950; x=1777798750; 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=55+b7l5F3zlZQ0yMZrz5rEYbg5vrZhPlJC+KY+nm9CU=; b=hJmwB/4aI1ZAZmJPWt8u92/+LXKt1WBd84uzS2C6j75xaqhJ3gcN7R5/w+L/Mdv9Q8 iZmCoPjyqawATfATha43kCt/O2Sq/vtLrmzVVVIoo76ale1nUJffbvy5aT/1z+03Akvh k7hTIihMT63t0iZIsyysRaFJsXxGrhztAahEL8ZSxC1G6+esiAIDS60YrbprRQc2swOL 418cnDTB6LhwCeXNYOLOA2YZ7PkBuc7zWnwglHv/0U/jSR+/XMFVfYzWH9iBFiICUxSe M5dv5W/RAQSDu+1q9oiXEaDLia89iQ4Ewtqt3Mmjgsu+VtOnsQ3YIllkgM/ccYoakTrQ BuIA== X-Forwarded-Encrypted: i=1; AFNElJ8YMBPMNRI+5BWJkXdDVIptjXG5eydE1pOj7jdRQOZSsARslSAetPKSYwzn+1N/yNU9yc8rOScwzQlZOj0=@vger.kernel.org X-Gm-Message-State: AOJu0YxNc4mGWVbqmVQlA4BBuNI5TvvHbz4SP0Ouz+D7MUlPRiEu/vtq d8XnevEHP0OVBnFof+fXrGiw2RtOmglmPeR7kUjnA9qCzJ8SYOUureRS X-Gm-Gg: AeBDieucL0EePakIx8FO3Z3qLDjQdUlc8XC5Z4Gb6ufV7PQsd47N8PkhVancK+RbTSb /ia+4D3kzObs7rrCIQaMrZJ7lHyXcbqUh2gB3cri4VkJHYvwQ6mM6QzVGQVc8NAdAN/EaYtxgC6 hoOiVSggL3YdMoG2yO7GmKFWiUBv9+NVDfYCnxtZ1Njj8ODbdIbWy6mjKqrRw8BYcdDkeQt9d6V Z9uGmxSqhopza5k6Pue4DuN3vvJFRIdYMn0nw4WUaWJxbhrCFuNGzjIRgDDsToQg7G8ogPNKIUA O/6/RLHg4QQwwFb0g7FXVs3FikUai2oMLpSzfzVTOXpDWwD6hHVKtR7crCwwPx0eMne0+PEWqYd uI2vQ0US2Q8ABEuG0NN7KSV5QcjeHZ8WYZPl3jUWbfEQvRVOmjUIXAiDnvjdmGh7+yLMpNqElyZ v2YHxjb7myCQaT1yLuAk3QULzjmGvmUwoPIro+I7PnfhHIuVqzyebMZ86XlLn6VWBHjjXmPMd1v QL9FUJKprXYnqE= X-Received: by 2002:a17:90a:e704:b0:35f:ccf6:69a5 with SMTP id 98e67ed59e1d1-36140478a16mr39086684a91.20.1777193950059; Sun, 26 Apr 2026 01:59:10 -0700 (PDT) Received: from li-1a3e774c-28e4-11b2-a85c-acc9f2883e29.ibm.com.com ([106.51.164.157]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-36141868906sm27718937a91.3.2026.04.26.01.58.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Apr 2026 01:59:09 -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, daniel.almeida@collabora.com, fujita.tomonori@gmail.com, viresh.kumar@linaro.org, prafulrai522@gmail.com, gregkh@linuxfoundation.org, arnd@arndb.de, tamird@kernel.org, mkchauras@gmail.com, lyude@redhat.com, airlied@gmail.com, j@jannau.net, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, llvm@lists.linux.dev Cc: Link Mauve , Venkat Rao Bagalkote Subject: [PATCH V14 7/7] powerpc: Enable Rust for ppc64le Date: Sun, 26 Apr 2026 14:27:25 +0530 Message-ID: <20260426085725.2090827-8-mkchauras@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260426085725.2090827-1-mkchauras@gmail.com> References: <20260426085725.2090827-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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Enabling rust support for ppc64le. Tested on pseries Power11: =E2=95=B0=E2=94=80=E2=9D=AF dmesg | grep rust [ 0.225728] Initialise system trusted keyrings [ 0.270961] rust_minimal: Rust minimal sample (init) [ 0.270968] rust_minimal: Am I built-in? true [ 0.270974] rust_minimal: test_parameter: 1 [ 0.270983] rust_misc_device: Initialising Rust Misc Device Sample [ 0.271012] rust_print: Rust printing macros sample (init) [ 0.271019] rust_print: Emergency message (level 0) without args [ 0.271023] rust_print: Alert message (level 1) without args [ 0.271026] rust_print: Critical message (level 2) without args [ 0.271030] rust_print: Error message (level 3) without args [ 0.271033] rust_print: Warning message (level 4) without args [ 0.271037] rust_print: Notice message (level 5) without args [ 0.271040] rust_print: Info message (level 6) without args [ 0.271043] rust_print: A line that is continued without args [ 0.271054] rust_print: Emergency message (level 0) with args [ 0.271064] rust_print: Alert message (level 1) with args [ 0.271072] rust_print: Critical message (level 2) with args [ 0.271077] rust_print: Error message (level 3) with args [ 0.271083] rust_print: Warning message (level 4) with args [ 0.271091] rust_print: Notice message (level 5) with args [ 0.271097] rust_print: Info message (level 6) with args [ 0.271102] rust_print: A line that is continued with args [ 0.271110] rust_print: 1 [ 0.271113] rust_print: "hello, world" [ 0.271121] rust_print: [samples/rust/rust_print_main.rs:35:5] c =3D "he= llo, world" [ 0.271129] rust_print: Arc says 42 [ 0.271130] rust_print: Arc says hello, world [ 0.271136] rust_print: "hello, world" [ 0.271198] usbcore: registered new interface driver rust_driver_usb [ 0.271207] rust_faux_driver: Initialising Rust Faux Device Sample [ 0.271227] faux_driver rust-faux-sample-device: Hello from faux device! [ 0.271297] rust_configfs: Rust configfs sample (init) Reviewed-by: Link Mauve Tested-by: Link Mauve Reviewed-by: Christophe Leroy (CS GROUP) Tested-by: Venkat Rao Bagalkote Link: https://github.com/Rust-for-Linux/linux/issues/105 Link: https://github.com/linuxppc/issues/issues/451 Acked-by: Gary Guo Signed-off-by: Mukesh Kumar Chaurasiya (IBM) --- arch/powerpc/Kconfig | 1 + arch/powerpc/Makefile | 7 ++++++- rust/Makefile | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 4ac897b650d4..2e3065bce9cd 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -286,6 +286,7 @@ config PPC select HAVE_RELIABLE_STACKTRACE select HAVE_RSEQ select HAVE_RUST if PPC32 + select HAVE_RUST if PPC64 && CPU_LITTLE_ENDIAN select HAVE_SAMPLE_FTRACE_DIRECT if HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS select HAVE_SAMPLE_FTRACE_DIRECT_MULTI if HAVE_DYNAMIC_FTRACE_WITH_DIRECT= _CALLS select HAVE_SETUP_PER_CPU_AREA if PPC64 diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 589613eaa5dc..9385db478c59 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -61,7 +61,12 @@ else KBUILD_LDFLAGS_MODULE +=3D $(objtree)/arch/powerpc/lib/crtsavres.o endif =20 -KBUILD_RUSTFLAGS +=3D --target=3Dpowerpc-unknown-linux-gnu +ifdef CONFIG_PPC64 +KBUILD_RUSTFLAGS +=3D --target=3Dpowerpc64le-unknown-linux-gnu +KBUILD_RUSTFLAGS +=3D -Ctarget-feature=3D-mma,-vsx,-hard-float,-altivec +else +KBUILD_RUSTFLAGS +=3D --target=3Dpowerpc-unknown-linux-gnu +endif =20 ifdef CONFIG_CPU_LITTLE_ENDIAN KBUILD_CPPFLAGS +=3D -mlittle-endian diff --git a/rust/Makefile b/rust/Makefile index 03926a451bac..8e5891563777 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -407,7 +407,13 @@ BINDGEN_TARGET_x86 :=3D x86_64-linux-gnu BINDGEN_TARGET_arm64 :=3D aarch64-linux-gnu BINDGEN_TARGET_arm :=3D arm-linux-gnueabi BINDGEN_TARGET_loongarch :=3D loongarch64-linux-gnusf + +ifdef CONFIG_PPC64 +BINDGEN_TARGET_powerpc :=3D powerpc64le-linux-gnu +else BINDGEN_TARGET_powerpc :=3D powerpc-linux-gnu +endif + BINDGEN_TARGET_um :=3D $(BINDGEN_TARGET_$(SUBARCH)) BINDGEN_TARGET :=3D $(BINDGEN_TARGET_$(SRCARCH)) =20 --=20 2.53.0