From mboxrd@z Thu Jan 1 00:00:00 1970 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: 8bit From: Link Mauve The core crate currently depends on these two functions for i64/u64/ i128/u128/core::time::Duration formatting, but we shouldn’t use that in the kernel so let’s panic if they are ever called. This doesn’t yet fix drm_panic_qr.rs, which also uses __udivdi3 when CONFIG_CC_OPTIMIZE_FOR_SIZE=y, 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),$(CONFIG_64BIT))),) __ashrti3 \ __ashlti3 __lshrti3 endif +ifdef CONFIG_PPC32 + redirect-intrinsics += \ + __udivdi3 __umoddi3 +endif ifdef CONFIG_MODVERSIONS cmd_gendwarfksyms = $(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, }); +#[cfg(target_arch = "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`. -- 2.53.0