From nobody Fri Jun 19 07:44:07 2026 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 20758346E68 for ; Fri, 24 Apr 2026 05:48:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777009693; cv=none; b=kts4v1lE3A5ITwbIFI6XWerSWMUfmGlJGxrQ8dm/IKTomVmXqVyLe+6a15zwdb61GCuiWZkl106FJjXi3faOjN5kmRq6mBjyVcStutpIF+Ng8f/NIT3m8TSkT98uQKkzlpsTxFkUBnAWsLVS5dyIiDMuqNSlsGKMgDXBxd1PlbQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777009693; c=relaxed/simple; bh=DaJD+iC/4t/zDn6B6rcfGqjo/dCgt4gKeEwY5aGTxec=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fFEGWLs5oKSR2GFYgZ9XeAk4jYkdLWxXA+zZVTppyztxfpE8msk6pzpN+NVzMvxo0YIfxxcnRvCNQLS+vHhNGEWx2JMkKvc4eqvie7ymBnhePn5BYt6KSwLt07DA0sPS+1bB2900Qjo1BEtxi9Oy+3psNqlVNJUrdOagyxUe4js= 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=o0u/wuRZ; arc=none smtp.client-ip=209.85.214.176 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="o0u/wuRZ" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-2ab39b111b9so30966425ad.1 for ; Thu, 23 Apr 2026 22:48:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777009689; x=1777614489; 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=avSEhYLX24df+mZ+6wWnK3u2AMb0siNB32CpS+CSjqU=; b=o0u/wuRZ92IZ8wWL5zRg1nr7JlWIhsicQfdcxALlQNv2ZU0jpbT+m1rYmihLH0vRfX D6GVzp4VsuvdJdCwiavn9bIpO/rK++orrl0xoJ2HaddeVGiTql6ZaH2MJ1+jyE05U0gc WP+qh6HJRHNv+IZLH3VR3Sg4Mz9q0wQvjz4jqcw4NEwi80+Uc3aJEFttfFcWowRtQAml nHVfInZf6sMFczh7XleamcSmTYkCgn9ftxqW1Yl+ecyQM+wBC5ONY2V7IW1HGHRGQDUj meqG5M4denZ68DTiOS7bS7RpnYO2NyHzoLighFshcGoIQsL88RG1M0hlimnhWZM93+wr Qq4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777009689; x=1777614489; 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=avSEhYLX24df+mZ+6wWnK3u2AMb0siNB32CpS+CSjqU=; b=p7QlKjfLdN0ig2s8K56M3INvkE8NLY6HiPP9U9xlcbyyvIJl1GfSYNNwpGcpSZxZjT GWO8TBssuAEguyfyedtAkDj0IWMluN/Yh/LRavg8xx4F0z9QkY0K23B0sFNMF1iproHK hQWpU13J1mz+6rHcKOAM4f8AA3eOEqI+hw6hnaMAo6/DviL6MT/dyy6KsY6gI12/tLwq YLMgNF7NyagNwV1SKy3A4cFlU6v14FVAXVJFyLy9ZvyzTErw+NZ7mHNzd6fLwfg4nTeO 5VYEoOkNDfTJJROpPzn0zuOXYFC5YCLzEnEcUYHPdw4mLLb5kraaEcM5BjyzVgTGhl9c P6cg== X-Forwarded-Encrypted: i=1; AFNElJ8tOlA6l28FNvlS+i7f5cpNQMNf/1cZ+HWuU4MMOJG1YMIelq+e0oodUXJ/NDOjKb4weyjrW0jRDCKcKmI=@vger.kernel.org X-Gm-Message-State: AOJu0YzpU7/OzV54QgoNfmyUlbiEYUhgaHYYN8c8FX2erXfYmM9Hqawl KjQcsbZRZd/wZeF/7qQ82zZcY3UMbPPHYVtgbTj8o4xjfkex3I1vRMWH X-Gm-Gg: AeBDieuoa8WNRSR2x5w8+OxPwzrc14bcbu4W0IGyIuR51OPkVlTsA47OqzVg9YUyi08 HP9xV2mI4Vmd6YMmLJKaFPMCg/wb3To6R3bMR7UneLxZHaJpbx9nB1dbJg7bai5kbc3pYPyiJaV hMvTep/JggI1USoT/CtIL37sMfUfXjZW8U7zFZGk/duuPmV9as+L1mnkeZgkZ8wcfRPOwnIFgAZ fcyKHK1ueaFB/moaOl8eLOcMFNP5JEy2Zt3WK6VQHPAmcIMf7oceQAcIIdN4yZhls7HulLFdGXo k5UfJg0SkHlQTA+Q7j0e2FATZ6V3kRljyaeFfTSEGvCU9woaRSmQdUaNojq9Ceo0hlCoLefNmtq z/u33Dia7szX9vseZPwEen4ZJ9YswGHXasEIRjG7q7XZlegDGIt9yWaszuQ32pBjyt8+2oVA722 IJ9tEyLuTGATv9RCbcpyM/VVQr6CdrGk/bfuSAhgu9KOrRhkxO5faWJfIBxACUX7AyKrlfqzRS+ P964+WUTiCYc3P/w+pbn6/xnQ== X-Received: by 2002:a17:903:3b88:b0:2b2:ec31:25be with SMTP id d9443c01a7336-2b5f9f35acamr294635205ad.24.1777009689388; Thu, 23 Apr 2026 22:48:09 -0700 (PDT) Received: from li-1a3e774c-28e4-11b2-a85c-acc9f2883e29.bl1-in.ibm.com ([129.41.58.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b5faa176e9sm208778245ad.20.2026.04.23.22.47.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2026 22:48: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, sumit.semwal@linaro.org, christian.koenig@amd.com, 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, tamird@kernel.org, arnd@arndb.de, nsc@kernel.org, mkchauras@gmail.com, simona.vetter@ffwll.ch, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, rust-for-linux@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH V13 1/7] rust: Fix "multiple candidates for rmeta dependency core" error Date: Fri, 24 Apr 2026 11:17:36 +0530 Message-ID: <20260424054742.45832-2-mkchauras@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260424054742.45832-1-mkchauras@gmail.com> References: <20260424054742.45832-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 | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/rust/Makefile b/rust/Makefile index b361bfedfdf0..2a5428a5503d 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,6 +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 pin_init_internal=3D$(objtree)/$(obj)/$(libpin_init_internal_= name) \ --extern alloc --cfg feature=3D\"alloc\" rustdoc-pin_init: $(src)/pin-init/src/lib.rs rustdoc-pin_init_internal \ rustdoc-macros FORCE @@ -520,23 +524,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 +549,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:44:07 2026 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (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 772963446C4 for ; Fri, 24 Apr 2026 05:48:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777009701; cv=none; b=VbM1zflc2IKrahuteTCdFPymtpVnfDyeeMjIUhQn3zsmI9l+vn8eshQLbfJqzssNT/FvRSToOJFA+Lhj/KL30kEE2rF0i/u8SedYWyhQC/u4aaH1EfHk+fmrKjH0pmcCgRB3CN3aT+qI0kvj5M7QCozcN40gExzELpGriPdJQIk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777009701; c=relaxed/simple; bh=5AskzqVicAC9flZ1LjZUxvbxlBf3jPZH4cwWbVOrA3s=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QR5bbBKXiF6IwhhDClLloWY02o5GnT5HTTmtSNAAZl1AWrf+ATIhUU7Lkux5jr2ZIHmj4XmHYe+tIvwRX5XCWzG8gK/USzMEtzOTV62gL6m+b9yxEuZX+zCF/oh4CvN/M6dZST9ps0iTUyya5DSN3yRyOnmmI9E6StKXHP58WkM= 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=Br9qK58S; arc=none smtp.client-ip=209.85.214.172 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="Br9qK58S" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2ad21f437eeso48824835ad.0 for ; Thu, 23 Apr 2026 22:48:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777009700; x=1777614500; 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=Ox8HNk2ehgX4u9MIzrQAUilnp/6GJtQsHeC9tfe3Lv8=; b=Br9qK58SWnsBu7BIAJLSRmrjvqPYYW2+OfLYSWVgF99RTfSwF4DoLZ+ApFFJiAJ1Mt nZwQXTHywuXUfqybCOdKlJzKcKENPibUt+5edwXlQq3K+754iw1fjRy1cjXqmVUdSAAh 8t4iRSs2JOPeCMaLG77+KlTUa77ysey9/4O3jJBaaP40pl9HmuGmJ69IK/oytT6ZXulC bg9ygfBlPEjj2owRVXFx83Crwf48TnQao7Ai5XEYtIyJS+M00GdVJI8XjLbcbPgqMIEt n/RcuwQlIoZ17G4TcK/DqV4m5fponGpSDepTt0c9c7DeV/yrfqNjF5SFKR0ltoJlNWYE uPmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777009700; x=1777614500; 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=Ox8HNk2ehgX4u9MIzrQAUilnp/6GJtQsHeC9tfe3Lv8=; b=RCphfwoghVVMcWaXye/E7LT3+OB2dGG3kQS/exI+EO3n8XZ74S/AXquWP3B6GnA4ct JnRzCdbwd2MhACbmBC/MXeTzOamjphKxtzDrnsym5Yd+qVK7HK+XHMyrT+CB4v4fpBPd 243oBqKJ3l3oPQK6xyTi6JAtKFYmVRY3LWygTw75jhYemh4woexx5BQd4dmH94JwibTD DbQikY4PWuBIOKWoo4J7RWhSSJ/BaaCjYmQC7S3aHHpI5UL+gPwp9TOuQN6hLGzJe/+q g3XTST+d92COJUkMqf/LaEQ8f2JIA7BOmW0jn+k0eKAqwJLnf4VnYNXyN2Z/JJhbp4tr WwAw== X-Forwarded-Encrypted: i=1; AFNElJ/eOMNW2RiH7aq2gTaT86gGc6hwygJNNxdOwEvIqjLLS8maG3DBjI4p9Znb/PA6+F3XhGlcy8FzJMEchPE=@vger.kernel.org X-Gm-Message-State: AOJu0YyL5XFoucjEl+bWiGWF1e12JFBZY59mWcxeLkVg3nfyHW9hAMVB iZqMNegEDhCkVisv1sIn2lv/EAD6XYoEgfpZXPtrxEbmGpHx9v9jAVzM X-Gm-Gg: AeBDieuAVmwgSoCpR3ZKuIWT0Cm2OauINixYKLveqVhhKeqNJrnSNuRx7u3CkRsUFVp AAw0ycwolpN0lg5AD0YUxGa+6jXsq9n3xYC4M9BJHWVDDXqZFHjP4E8pKBM42uqVJcPLh8P/g95 6YOeLsrc6vTwABEacZ/N81OCxw9GNqCCjW8p6xUU5PYFEz8U3zuis9EcU6TpHpI3AjDGaf6OtCX kKCMGMzfVl7JaQ6eHjAC9e6unQK4+AL5usmp039+o09VuFtgUTqdQVUwZ78yHRxROBBU6MfvWNk DAj6tFSxsz38uv/7w/Nwo08xbJaGLOGC2n/UIb92RcDp8AONONFi3EgQvZpWzu+8QV9faro8VCG xnmgg9DNDliNyNtqxkfVjyX/3O5wcc3wUw0RFDZg6QGKLGl+seISDkZx2Hr7MUa3L7m1xUTwaFy kq4x7sqY5dS/ZilriQoFsvK4n1gvQuZ/R9hW86Pq5uVTmwGfaHqoFTf4oaO+1P+oMO7vHqJMk3M xYZi63Wi8zrqmM= X-Received: by 2002:a17:902:d591:b0:2b0:badc:c9cf with SMTP id d9443c01a7336-2b5f9e18812mr226513645ad.13.1777009699637; Thu, 23 Apr 2026 22:48:19 -0700 (PDT) Received: from li-1a3e774c-28e4-11b2-a85c-acc9f2883e29.bl1-in.ibm.com ([129.41.58.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b5faa176e9sm208778245ad.20.2026.04.23.22.48.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2026 22:48:19 -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, sumit.semwal@linaro.org, christian.koenig@amd.com, 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, tamird@kernel.org, arnd@arndb.de, nsc@kernel.org, mkchauras@gmail.com, simona.vetter@ffwll.ch, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, rust-for-linux@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH V13 2/7] dma-resv: Fix undefined symbol when CONFIG_DMA_SHARED_BUFFER is disabled Date: Fri, 24 Apr 2026 11:17:37 +0530 Message-ID: <20260424054742.45832-3-mkchauras@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260424054742.45832-1-mkchauras@gmail.com> References: <20260424054742.45832-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 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 making the function declaration conditional on both CONFIG_DEBUG_MUTEXES and CONFIG_DMA_SHARED_BUFFER. When either is disabled, use a static inline stub instead. Fixes: 0c6b522abc2a ("dma-buf: cleanup dma-resv shared fence debugging a bi= t v2") Signed-off-by: Mukesh Kumar Chaurasiya (IBM) --- include/linux/dma-resv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/dma-resv.h b/include/linux/dma-resv.h index c5ab6fd9ebe8..23c8db0b5214 100644 --- a/include/linux/dma-resv.h +++ b/include/linux/dma-resv.h @@ -311,7 +311,7 @@ static inline bool dma_resv_iter_is_restarted(struct dm= a_resv_iter *cursor) #define dma_resv_held(obj) lockdep_is_held(&(obj)->lock.base) #define dma_resv_assert_held(obj) lockdep_assert_held(&(obj)->lock.base) =20 -#ifdef CONFIG_DEBUG_MUTEXES +#if IS_ENABLED(CONFIG_DEBUG_MUTEXES) && IS_ENABLED(CONFIG_DMA_SHARED_BUFFE= R) void dma_resv_reset_max_fences(struct dma_resv *obj); #else static inline void dma_resv_reset_max_fences(struct dma_resv *obj) {} --=20 2.53.0 From nobody Fri Jun 19 07:44:07 2026 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (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 285B133ADAD for ; Fri, 24 Apr 2026 05:48:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777009712; cv=none; b=YZKe+M+hn2p9CU4vtAo/o0gAshVKtVVegUdMVYM0q958ao0DHDe1ZFZD9WhhemgGViNyh/TQkcv7K2utX6oBFTvUUYJTCN1cZRzX0jaGD5ltMAQY9eFyEfsKH0R1kFZZQu9bU3mAqjhnKt/obYf68Dl++yN7IdQMGew6u2Euizo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777009712; c=relaxed/simple; bh=8WQ7jEq8bJBsdnlHGUXrbWXnXrrr5Xxc2+zvN+1cF+Y=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KAwupe1npLMUu2W9vQV6MVv8qRp2kMm8QYSy2wyiu/3wwamGVoe+riai0/wy24PAH+CfJH6o/eF6GaVEJGWa0dTyclsQosyjGzqL+Cj4565QZdM59rCcDDXJ6Fv9oCan0F5p/IBrOhTLxong97vhAQ6TAS93fMMPf5G6C09AdrI= 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=Kgq/AAuJ; arc=none smtp.client-ip=209.85.214.171 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="Kgq/AAuJ" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-2b788a98557so28454415ad.2 for ; Thu, 23 Apr 2026 22:48:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777009710; x=1777614510; 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=Kgq/AAuJfwXlMN6AnV68dG0YgWDXy/sx8PcSL0lMnGSevlqyBG9D1pc4jgzsr3iQMk pX58MCHcEROMSVmWLsUrUOi1e3UOL60X2LgVoKji2jSZtgIimE42NXR8IbucUvDIjANQ uvf4DxTjWhB/i0RVytg3e/oC49XowL60MpYaN/4chh7b1/E9Qp4mL1Z5NvuKibHiDKCW /kRvQfuZxxMmct1N9CtBr8DbfpxhWFbZ+vQLNEppoAlMiLkRdB0tfXyfBLbetr5slSZV IlKWCSqNzYbxApCiIp4PyM/bky3+Ngs1xLqdu7GBJjg3Dby2BL0v109qlwa/K4E6kPRb fpag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777009710; x=1777614510; 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=ejPoujI7yFGXe79Yp0Sq31rw3+Nn76a6ktx/1PgOi0GILQEZ3cLsEdDxh8kFbwZ6pp T40IAkFWHZBt/0SCpOMTE8OHVgIJ1FrYw54/O7b49U1eWl+Y8OSlj3NHX4C8FlwAcjzF 1/+FgmjkZLZ9PRYyVMATKVxOwhzGamzs4yGXd/U/ot8NjlspYMJtClbuj8BmP/ukdvWZ 6nQ9WaR0XcYYYhdVMFTtw2FcOd2GS8XMfJQl9pV2prS6bGbioeDI7wKZh+Dc+qCMBUSc Wjj5aA6kuWQYaY3Wno5bCIF3/11+1Yonz/s+bJuXdJS8JEycFaeDcOuP1WhS7SyEYLMo Thag== X-Forwarded-Encrypted: i=1; AFNElJ8tKB4eo7z9ME/ai2/rAVfp6tzC8tWJHE9fDycovwnep6EqS9Lah2/rN3qqR0ELXCcTod+ZyOoYOk4fmWY=@vger.kernel.org X-Gm-Message-State: AOJu0YzPwGXowzLX2XqEAXJP5f29p4SYZmL9Hs+BD4HorUYNiH5EQo8z Fot6dpatscjsdQXQSKjXCXm38PnPCG+H9KJob2ofSeoEaLJn6dikBU2m X-Gm-Gg: AeBDiesrpf2FKwVYKe9O2g9TK17PFx1FBD5CVxg8zzQFw8pkYjpOSio2gyEnMjoYI1H YGVfBvFQvZlOpN3PR+P2/1h4fiWksPOBf58qveQALu7WwYMkMSF8FgNAb9c7Kalw85lenMMWPjQ 009QC8Jga62iK6016umJYyWGIjP99ZItlxMskOM7nPgDhI0GoaMaOT3+ldzkJqldpeY4R5ZhM2A WwbxrRhezhNt/xvtRBn17XzdJWW6K2nyTlYGv/OdMhjgqs4/q0ZGltLMulsyOSHVqLHqJJRJKWJ Wib3w1YBqvzjUbINimEHirJvy2t9JSNz0Wx7BQhdQAr3UIE1yZbLeAkrmQomtLG4KEkefz4tqQz K1UUVV3oBDIALVJQijafWt//wLykSaNwsLE8n7G4rgBTindtDa+1MGVJm1HMQGh+39aY88o+7fM oC1qTLT7pm4uFY4GkjxjIRXDZbjPhovlWn3kddgKNToaR2dj1SuHVIKcJP5++a4gpNZ3oXtl/S/ qWXKTxxJdpAfHk= X-Received: by 2002:a17:903:1a88:b0:2b2:5ec6:dcf6 with SMTP id d9443c01a7336-2b5f9e85f20mr310774475ad.8.1777009710516; Thu, 23 Apr 2026 22:48:30 -0700 (PDT) Received: from li-1a3e774c-28e4-11b2-a85c-acc9f2883e29.bl1-in.ibm.com ([129.41.58.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b5faa176e9sm208778245ad.20.2026.04.23.22.48.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2026 22:48:30 -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, sumit.semwal@linaro.org, christian.koenig@amd.com, 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, tamird@kernel.org, arnd@arndb.de, nsc@kernel.org, mkchauras@gmail.com, simona.vetter@ffwll.ch, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, rust-for-linux@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH V13 3/7] powerpc/jump_label: adjust inline asm to be consistent Date: Fri, 24 Apr 2026 11:17:38 +0530 Message-ID: <20260424054742.45832-4-mkchauras@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260424054742.45832-1-mkchauras@gmail.com> References: <20260424054742.45832-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:44:07 2026 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 8C408313550 for ; Fri, 24 Apr 2026 05:48:41 +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=1777009722; cv=none; b=AGFVbpdTsSlTI7YqGBLd1+y1nXTn7UE7dpkSUvcT64+65lFfGPkclm1Mli9QNjch52XTLSEEKT7ZK6rtH1W26zN0byb4pMqiwwW4w3kdOXVhP4EM+H185gU12+7fDtXCYyBZ4/6g6A+rC2IijNmmNRMI6yYFDKc/efabyIfMobE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777009722; c=relaxed/simple; bh=g4L7C9uN0rpytwf/MlwodVI8K8mAxgIk4T8HtuH8eBk=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d6ca1G+FtAr3+0A1BSsoCu1hlRj1bwZmoK1ekG5yhbUBPPVh8tGWCaEhwfS3tEIBzfDY2kUZA4nGChaEEYTxuLk3UIyIjx2mvD2vDLCxUAt5ctXIJWqbhqB3aPmayHlfumfM2WVpj637Fta7O4dmvZVjtcodcyk9b2g1NJOuFcE= 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=qr3x8mBC; 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="qr3x8mBC" Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-c795a47186bso3169818a12.0 for ; Thu, 23 Apr 2026 22:48:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777009721; x=1777614521; 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=uUmefGJqV+IRkFPz6sSuv3GYeINth0c7dueYg2gp07o=; b=qr3x8mBChy13xrFs2CI618m0GGybqCQ3y7V2uDKDhW2FCCRvwFLoXceP1AG3dxHjg0 aYhokGCtCuYCWMYFQq8kwi+KBz/Pkl68vQFAGrOFh77BC3Q94wCtMLEunggzxc7DoWtj Jy1up0zPtxiZySk2DzkoDJioXsry/7RjDbcARoRBFQae9HCkkcUKw3LicjvyD/T+iN2u 8vXt4ibmP2Ej9GQg0p77h26T39Rvmlsyw7vsz/b2ywyeIueiq7KXnqjep6HyJPlG24BW 3cozFqVWo0eNSkiSW5DGXjEdI0ooT3eTkYpulHn563zc5lrAKml8wmLWr8eelzj5i+db MlRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777009721; x=1777614521; 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=uUmefGJqV+IRkFPz6sSuv3GYeINth0c7dueYg2gp07o=; b=WNzdlkabya9kPP06jW7eoL9xO9VPA7Ks1BSW5xjgwq5iY0TXuXsVjl1tNa3BkiPC28 qNpX4oS17wy805qnpeHvaPjOErEdlQq3K8Lthao9n5ZMVVKFdvErGfFmIGRIOZ0Ewfku 6GX6LKaHnYsTWom4Z6StXLfMtdFsAXTGtkU7e68BMzCi0TIurevJ006CgfDevMsgV0XJ TO+EhXx8ydP7FkPdt+UtrvA7pMJZpU60rrcHOzmReLcOw7SatbAZHo7TJv4eYBxN6zkG x5R+2dCAF5H/I8MxsAnxZdQPXL4iUX+D4bHa4q3pGqFEpZL2t3vJ9jP98Ix4w3oyJ1e6 MrDA== X-Forwarded-Encrypted: i=1; AFNElJ+5Rh0jb9koh8dDEZdpkYbPAp6goTiAQHzfrjVv9gKiUWBVTM21JPDb3Dn2nvfedELC/aNDsTzX9zrUYVk=@vger.kernel.org X-Gm-Message-State: AOJu0YxhQBHmzn+UtR1qx/z4efXajWih3lGGRtW0/4E/eLOMNGhUHW13 Jc6ZlcOlLfGOYbXtlk5h6Q4LujiTFv3EIOmkL8Cu4L1AY6F97+nmreg2 X-Gm-Gg: AeBDiesq5RkH4ljcZviC+v9FR5HtBILznsIZVtHfFYes0xHJs115IEz4ABZJs9ZBANh YNTXH2SgSKDZNlIz7BcqXKuaI51gNSO7OiMaWW0VvCbfS+u04MaT+3I+8XJLwOGviI+9Qdy2wGG njTR4mk1qXZvbvcTDlRtimuzt/WkkWemUgK6MAHCn3pL+3aaCfjnFBra/YNZj8loJFLnohP5bbR hynIvtmRfpHG8gleBYefuOEuz4+eDaPDrI3GJUhtPpBM6Ax+6v5Jm5/G/8mWy1hv/etU8CIJzTF JvLpCfmJLZ3GaZaabNpUHIHUa88UB1ELecZ1zQ0W2S5+yKV9xXUIXOo86u8z6Bt4fiuyvRO7pbn ODtvYAJ0E2/bmY0Qa9/lKxau3s9d+9O5BBLgM03WZdCWAvEdti45rrTqtQi3TmyO+0p8ICfWRpU aSBXuEIMwILAO5xn1m+E0wwM2ler3/1UigcbVAaL43lElNgfaom2KFCO/5hGFraJ48+pV4MyDl/ Rv393nETScviZ4= X-Received: by 2002:a17:902:b195:b0:2b2:4bbc:14b0 with SMTP id d9443c01a7336-2b5f9eb272fmr183181305ad.20.1777009720961; Thu, 23 Apr 2026 22:48:40 -0700 (PDT) Received: from li-1a3e774c-28e4-11b2-a85c-acc9f2883e29.bl1-in.ibm.com ([129.41.58.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b5faa176e9sm208778245ad.20.2026.04.23.22.48.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2026 22:48:40 -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, sumit.semwal@linaro.org, christian.koenig@amd.com, 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, tamird@kernel.org, arnd@arndb.de, nsc@kernel.org, mkchauras@gmail.com, simona.vetter@ffwll.ch, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, rust-for-linux@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH V13 4/7] rust/powerpc: Set min rustc version for powerpc Date: Fri, 24 Apr 2026 11:17:39 +0530 Message-ID: <20260424054742.45832-5-mkchauras@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260424054742.45832-1-mkchauras@gmail.com> References: <20260424054742.45832-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 is not there. For e.g. 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:44:07 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 C16C0318B9D for ; Fri, 24 Apr 2026 05:48:52 +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=1777009733; cv=none; b=HlqYwteeC/zLAX3TYH2Tsvu5ZJLSq+smUPADtie3ayFd24odQZZ799cyEYVfUr70nFwVNkrcDanX5oF9+IkfxE+iIm9ZN4TW8JEEh7mHL1FtEmpUqf15QXgdiBZKW53YmyZhZRoquXjB2lTbmJH1VaYpZXLITVg0XWJDRgmWlRE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777009733; c=relaxed/simple; bh=8uYxXlCsfJ2qoRnT3JSJJZBu6F4nxjWNt9la1fSIEJQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gjT2ag6eU2qC8fIN4R4/QAFHJeA8duFxZLrOGqzehWFye0ws/MZ2XwK3Mv5kzkCrruQm3scEC0hnHdTGupAEYF2DtxrzX53KBF2B7TbwlK3x8KK4RL2vLrobCio8/jBowT43JC6nVkgGWrS11BK7CgqsaKg6lOCBSaR86Ych0Fs= 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=TJ+d3qB3; 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="TJ+d3qB3" Received: by mail-pj1-f45.google.com with SMTP id 98e67ed59e1d1-3590042fa8eso5954061a91.1 for ; Thu, 23 Apr 2026 22:48:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777009732; x=1777614532; 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=/jOMf9sHPOP+Fk6bUCc/tdd0deN6bifNBcXjhksEyrM=; b=TJ+d3qB39ZfoGP1a8weDZ0sKdmP5QYZPrMXom4t09zQgy4oyTEiWwO0rwCEkA3d6iN 6yX1DokORZ48Pv/ExE9+Fvq2shhd3Jzed9xdMrBAMYErZ0Ebz6dY/vMuP6/kT6uhkVhc Oa0fawmqNyE0/HbZEpbjWCI3lHhYlZ0d3sirDsiTN64cyP4U5QZBOK+IHsH0WjGGFN52 b8a2GXaqKJrDkasG/SLxkmNbqYPs4jqItsQNr/MAGsVvIennvqBJVsYV3CNg0aZpBmwm HnTzG5QfqgI2YSrkPXj3amX9IvNHIBSlEAVq0j+2jFQusannO9ErtVgweqb69eEmyj3G pi7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777009732; x=1777614532; 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=/jOMf9sHPOP+Fk6bUCc/tdd0deN6bifNBcXjhksEyrM=; b=bwutlb2wU1SFRJMao3YUnIoBAmunMkRjDHOmcu2bf9Df2hdL/geIayH+p4QEd0iH/i jZivrUgbwuNo3cLcLbUKzdTRCnvC547y3D0UXsvzrM2eh/KVrlmkbmUmbjEs74+7peLI CePT6HPVCrUUb/4wj2h9q99jvEI2+qSV2rtNUverml8gj9dMzGpAzeyuVwETmZslz8SE OMv46PhXH5si7ZIN2KK7XhZGkdvl6j+50WaFW6MP2PHDv0jcE4qCGeBE0c075JUEY35r BHN3MrdCtVLsyCsrGakU0ibRLk4i9F1Q3KInB9vusP0cUW8qQvQ0gtmbDcv43y6286fA 11Jg== X-Forwarded-Encrypted: i=1; AFNElJ+fTxcMypV1dGUbcwWI/ufinb9X0Am/KihNzg2xW+xTrxl2JQ0TYVPja6BmnaqwbBlkqwoNI+gg3FKl8Lo=@vger.kernel.org X-Gm-Message-State: AOJu0Ywo0IcxggbUTyp/n1DOCjGQw4z/SVmRLZeFkNdnUHIhSlz5Bu/h dIDWqEuYgMjbUUFTpFbAPIFTvJDpbOQZ0FzBryw6rxyotLfIrMT1PnWc X-Gm-Gg: AeBDiesHCkvrGNSYwnpmGDSBcZBCCwpI4+Mke79FqXL0NjFgH5OUeUY3GETNao/a3e4 CTFscDJAJCMG5LpihXiiB4cH9y38V6SfbdprNU5eiK2s7N4ab32nOJZRNAB5hixG7/hLOSGsg2o WOm+0YNgUzc12pST+DUPEaOVQyN/u5hBf7mCVyV9lgzePNZ5IZj1C8k0d6aTO/5mbnOGllpWczl K8Lb6HDuNhyisd7T4ruiOvwqJQ1fC+dZQPsFrv68kn+AzPUyQcHApkLdGd+pyuXBASNYsdf0Vpp 6QrXbY7zU3gOb7oOvI+Y4bvjcYoRNvNTothN2fU1fdd3kqmtkEnHN39Ndt/L6LPOiu/5laz+6DU pOD/PoNioaCFmNQkS6RJVg7Vn4BTXh7tCaQMr3WOcEoM1TksmW12xLM9pv2lfNqMQWwnlWWr1VI RtALLaDeLEEHPQJSsui/RhxfnYTulpbw/SARDNL3QjYTOjF8G1s9G/vgxAJ3TcW+I8Uw+xDElAj WWRMEwyKHZYBHc= X-Received: by 2002:a17:90b:5185:b0:35c:29ba:bf92 with SMTP id 98e67ed59e1d1-361403d5988mr33141482a91.5.1777009732009; Thu, 23 Apr 2026 22:48:52 -0700 (PDT) Received: from li-1a3e774c-28e4-11b2-a85c-acc9f2883e29.bl1-in.ibm.com ([129.41.58.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b5faa176e9sm208778245ad.20.2026.04.23.22.48.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2026 22:48:51 -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, sumit.semwal@linaro.org, christian.koenig@amd.com, 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, tamird@kernel.org, arnd@arndb.de, nsc@kernel.org, mkchauras@gmail.com, simona.vetter@ffwll.ch, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, rust-for-linux@vger.kernel.org, llvm@lists.linux.dev Cc: Link Mauve Subject: [PATCH V13 5/7] rust: Make __udivdi3() and __umoddi3() panic Date: Fri, 24 Apr 2026 11:17:40 +0530 Message-ID: <20260424054742.45832-6-mkchauras@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260424054742.45832-1-mkchauras@gmail.com> References: <20260424054742.45832-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 2a5428a5503d..ee11fba7a03d 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -616,6 +616,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:44:07 2026 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) (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 DFC4F2D8DA8 for ; Fri, 24 Apr 2026 05:49:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777009745; cv=none; b=BDsEbvwqxaYbv+SuWoHRXxYZjem9tajkDYY1Q2f4+zdDwDsE1Pb+o3pZNKLIuds6UaGWLB6Z5TDkGall1JzD1xyDCb2meAaUrID3JG4BQbRnBb8KXXbdyKRSty6R1bEX45yt+w7NlUdNM9vgkwxXZ92F+2CuMlc0VnFT396IqTE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777009745; c=relaxed/simple; bh=QL36iCxJvrAKverR2bsI02V8ii8bfBdNBFY2qQ0lS8I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Z+IHnLh0ew91KyzVoT4XHUyhOCAXetdI7k0O7I+A1zpE4nVUziW7Zs/IhP3h/O5tF4gDh7vf571r3U+5E/nRijeoMmlq9HMvVTSvqMZwuvS5MY2ELFuY7Or4mPjqNlv1Ut7XAIIUEL7gglRVFITXuIDYXwBqwNX8Eltk2Oj5w4I= 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=giwRt2mu; arc=none smtp.client-ip=209.85.215.169 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="giwRt2mu" Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-c76bde70ec9so2958956a12.2 for ; Thu, 23 Apr 2026 22:49:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777009743; x=1777614543; 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=begHw2Fh55YIAbwVuxIcFKYuQNkyXTaAo0Peazo3t08=; b=giwRt2muKV0aWZwVt68C/tVKGzzH9LcT3/8dgzXSZ4YBO+9F9EOsCDsP+Ox2M7+WHQ RqFy5s6Rbcx4M2OwLjb79iRcKyPfNKGYnbaR3tYrEsKfUuRCXsORvkWE476iv9vbwPn/ z38aEDkXIg9+3V+0+pRi4Khg8Nkum2Fl5a92HNDK+R2DaG5J2pAIGLYB4w9sBm1PrpoQ IqbdD3RIHgMNKUjJ3Pt7NMTiDEEIXpQkOZoRjvQn4NcYIVQWoHbNoSvzyxpJefp1CC1x U21iDffRJ4kOuLIch7PgSB3pO85sAJ/GxCuL/gm5ZI8aySbOLxXiofqZKaEMPfco0T1i XaPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777009743; x=1777614543; 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=begHw2Fh55YIAbwVuxIcFKYuQNkyXTaAo0Peazo3t08=; b=js4GnMU9szyCxhCtymXo1HXFNACzkUEHSdGYHbLbEqAm/PKl0ho5wDz/7l/j9610AL ETW5WQBTUyuDvKmvjCDFz/90I8eQUlTe2KywKHT0f25FHJ3yrfOVUyy2L65xOszo5MUt nwPOhT1JGg3EIb2Q2AbG7ZG/ntG3fXxd3YrutCSR22OQsc0ig2QWNhTqAvQg348rJXok mGG+Lze5QtP1+0jn6xzmGSCS5bC6Tab5EVsIvBBvMglDyLyX7jHB8+3gEV00V2qdFqdL ZtKk4doSQAbJ44g2FYx2fBKkpuiLJKA+nkB803CyXHz+vI0RaoBf0sbVopupSjFkWS5F LWFw== X-Forwarded-Encrypted: i=1; AFNElJ/gZIMSiqZuECparnHR9T+kZn5N5Mp1fucsXe7sjJUP3YdzdTVtnX0V2PwQs6vMAOI1MnlDIa0XB3C1bK4=@vger.kernel.org X-Gm-Message-State: AOJu0YwKSgKlbA00c2fdJBh9fysCyu8zsPGGybOMW7XMSnsDlr1I8Pq1 Kns2QiEKm8/pUsPPP8aGdDvfUKuPQW3E6pHcIMXC5T568x6KH5Lmoc7h X-Gm-Gg: AeBDievh5eX33s5JliK4YG7hERAtlqx0x5dz3GFW/YsB/1MdhFYyyMUM7SFoMFPwx74 jQ1kGsxKcOdqfgKy8pL+sSS7ig77NYVD9SaUVV0SeBjBItHVZzafS9ELf4JOI0MlHuiCYVUkFMS 13c94cUStQIRAcRWPbD70K0vCDY3RzlsDxMk2RUM5mdygmCMS5FK5NEGP9gafM1emsE8AusKfYr tuv/QlxX7o6/KFXIRr5OBL/iVmBw18TdhMXAxDv+3NziYK9hpZNALeNi2R/Kp+1o494KJrvNWgH D+AkwPOF+N/sjM0jLpjAc69/DqA0NuzdMl20uvxvxEhvI2ZD4rgiCbtJsVTlOZn76UrUSWatGWm elR6JshsstYAuONPgDgAyh5slAObuXUPgefQ/43T0BaeJ/9HROljydhGDhkCXniSuDnzRh4J4eV LTkMpnlXS0JdJeJ8IKktUftII003HC5gF2K6uhH9HwnVu5kSZWY145oP5+AWq9f+2PFb3Efmqk8 2Nus/5lDXsWlYY= X-Received: by 2002:a17:903:1a45:b0:2b2:65db:8c5f with SMTP id d9443c01a7336-2b5f9f4f562mr323157805ad.27.1777009743184; Thu, 23 Apr 2026 22:49:03 -0700 (PDT) Received: from li-1a3e774c-28e4-11b2-a85c-acc9f2883e29.bl1-in.ibm.com ([129.41.58.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b5faa176e9sm208778245ad.20.2026.04.23.22.48.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2026 22:49:02 -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, sumit.semwal@linaro.org, christian.koenig@amd.com, 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, tamird@kernel.org, arnd@arndb.de, nsc@kernel.org, mkchauras@gmail.com, simona.vetter@ffwll.ch, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, rust-for-linux@vger.kernel.org, llvm@lists.linux.dev Cc: Link Mauve Subject: [PATCH V13 6/7] rust: Add PowerPC support Date: Fri, 24 Apr 2026 11:17:41 +0530 Message-ID: <20260424054742.45832-7-mkchauras@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260424054742.45832-1-mkchauras@gmail.com> References: <20260424054742.45832-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 ee11fba7a03d..fd9c1bf026ca 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -400,13 +400,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:44:07 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 C8D08346774 for ; Fri, 24 Apr 2026 05:49:14 +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=1777009756; cv=none; b=fNbo98EqYLranYvlcFamc42B1cEbCUMrn4hZi4o3BcAgisSM27KpihEVPDB/tyn2wrFISZb1tTCoGeMxz46vl06rF8/kAAzpsGKyv9abWpBrgmlR+/rzBUI267CBJNHGlxG76dKqBVYe0msVg/nfuas6ONyRlJvYJcO8FSi/+sI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777009756; c=relaxed/simple; bh=Ln7XoFFRgbpVTzwb9HPAuoSFU75gRiPCvs2/RLkCEsQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OcEc9gE9dbcRTznhRWrCVkzGO588JkC4jGShcgAifeXcXRTdnFXIcp48w5AJ0DzQjr7mxwEgx9zuSdOEOxoGezcGjYLqgl+rjhpgWBW1raeTAl0/zogLfFsIeqooB3at4+cDVnlgmHZL83ZF9EsDerF8AdpqPe1P9E2lR1+1NyQ= 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=jzSNeVEr; 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="jzSNeVEr" Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-3567e2b4159so5165071a91.0 for ; Thu, 23 Apr 2026 22:49:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777009754; x=1777614554; 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=RoXnYHhu5OJq+pQQ/T7jeG1ntNKoLYxlZRpY7d5kjto=; b=jzSNeVErcDeX2ZGTIQOUdHQdB4Vxrx5ct/o3AX+z7z338ql3tuPM5q1FkkTKL0ohun tHmuMXPPEIxoMjvuraoKiqw5ucgWuZ+wTm+2+LeJ5mTARgAo2p69yeGvUr2qsU3dMGC2 wtpLdQqSsXTeG+0kr+7ILeE+10yvdVzEKApcyUgoZOTTfJt7tAPaknuQcBEZ+b2Nvz0t tWmWog/4ccDiBvWmaUIiEHuN00coTljNQu95YK2KUs+xrq6eACRf06a67RHsMW9vJ6W1 GHqfv8J+WuBrwSq+o3AGe8pJEUBBcSykP1NhAYmyVpVPVYtnlPefZlJb+UG2kBSSbfSJ IBzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777009754; x=1777614554; 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=RoXnYHhu5OJq+pQQ/T7jeG1ntNKoLYxlZRpY7d5kjto=; b=YCM6sQWey7j/kLR9NFQmufY99bo6iFAYwTXPAz40qsqDNT71Sgczoi71nH7wuUW80W 4cUtkcrI4DwbupezZIjYpTjiqN30Jbe+spiMaPz740noQBJdbyGbH0Zw4YjA2fdaoinQ 743+2oBvPmPHVJ7QsAqN2I+tNr262bZlIC3LKcwTpAizb1IXbwndBoOXFQJXqGm1Vnmz Sndyoc3ow4b9l/fUrH9cZ07ZxlvwwyNJjh0Bb/1QqtMrAbqdaLxX8N94Kn+5jPX3XAFL DKazhs1bA85k89fMkbYaiBWWrq3RWBco0Xs2uFvfDaWOugDksf1igZrVYhOW5re9gTZW 9kdg== X-Forwarded-Encrypted: i=1; AFNElJ/NggYmTmNE6p4J0UvnJ+h7MxG6YyrWefs9KvupJKpy1NNsAEkkXdAdWaZwiMj9khpoCsScyilNBHFlZAI=@vger.kernel.org X-Gm-Message-State: AOJu0Yx1Jss6COMnDD4ac3oIGlJZXiKGt5WnzpsVdLGcOFlqxvfEIJXr 4SLqDuEyp1pRV8EQCo2+SCGOzhGW80EcTHYx9jiW9FpVcTe2wBv/bSfh X-Gm-Gg: AeBDievhEF9DOlnzbu54S7zAJKZQS5adS4SQTXy5I2dhrk+7Z2yW0u/Pdj109YQS9Lv hfe9hy0n24ktV0xvpYGayj1iL7c6j9n+YRTzXQyMFh27Kr/Fnmlo3SbJcae4VGWbpBt9rd6Vm4M qV+heVf2ol5Db3V07EbgeAQOBtl/DknLKcllD9lDIEY83Asmvwjf9pZ+tb0WQOtA9QAgJQxTc5C PCAV6DGF6zNr5PzsQKl9VuqwaNksBZU6DCX48GjL7ED0edzgcg6MzYN/44uVW9ZTOc0ee2eMIcr BhotJGXwGxSihDFFU/OcE89lhu/yW213O7tvi60iqd0uyE28rKmc5XS+9DyQSZB54ZpKk+DXKen YPpW+Nfm8ZwTVsdS9PORmXZzaQuY8zPT2GiFnKUD4AbFv5bUIRotIwyPz8MW9j9HsFsdLi3LjAa UtDjDnP+xFO2BpWYqErfCyPomva6eO68wEC8XwBBtKhBwyMJkDxx2apHxkr+TP6/Maa25+NVN0n winQzJMFJIIVVk= X-Received: by 2002:a17:903:1446:b0:2b2:42b1:ad95 with SMTP id d9443c01a7336-2b5f9ee2835mr352292775ad.16.1777009754030; Thu, 23 Apr 2026 22:49:14 -0700 (PDT) Received: from li-1a3e774c-28e4-11b2-a85c-acc9f2883e29.bl1-in.ibm.com ([129.41.58.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b5faa176e9sm208778245ad.20.2026.04.23.22.49.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2026 22:49:13 -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, sumit.semwal@linaro.org, christian.koenig@amd.com, 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, tamird@kernel.org, arnd@arndb.de, nsc@kernel.org, mkchauras@gmail.com, simona.vetter@ffwll.ch, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, rust-for-linux@vger.kernel.org, llvm@lists.linux.dev Cc: Link Mauve , Venkat Rao Bagalkote Subject: [PATCH V13 7/7] powerpc: Enable Rust for ppc64le Date: Fri, 24 Apr 2026 11:17:42 +0530 Message-ID: <20260424054742.45832-8-mkchauras@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260424054742.45832-1-mkchauras@gmail.com> References: <20260424054742.45832-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 fd9c1bf026ca..d7b74b209a33 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -408,7 +408,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