On Wed, Dec 02, 2026 at 01:49:15PM +0900, FUJITA Tomonori wrote:
> From: FUJITA Tomonori <[email protected]>
> 
> Commit 73b741adb264 ("rust: Add PowerPC support") allows CONFIG_RUST=y
> on powerpc. But powerpc does not define ARCH_WARN_ASM and
> ARCH_WARN_REACHABLE, which warn_on! needs, so the build fails:
> 
>   error: no rules expected `ARCH_WARN_ASM`
>      --> rust/kernel/generated_arch_warn_asm.rs:1:28
> 
> Until commit 59cf3a5bda61 ("rust: sync: add SRCU abstraction") added
> a user in the kernel crate, only binder used warn_on!, so the default
> build worked. Now every powerpc build with CONFIG_RUST=y fails.
> 
> Use the WARN_ON() helper on powerpc, as LoongArch and ARM already do.
> 
> Fixes: 73b741adb264 ("rust: Add PowerPC support")
> Cc: [email protected]
> Reported-by: Link Mauve <[email protected]>
> Closes: https://lore.kernel.org/all/as08wgiYOGOx5Jzo@desktop/
> Signed-off-by: FUJITA Tomonori <[email protected]>
> ---
> A patch that adds ARCH_WARN_ASM for powerpc was posted [1], but
> it has not been merged yet. This patch makes the build work until then.
> 
> [1] https://lore.kernel.org/all/[email protected]/
> 
This has been picked up for next release. 

Regards,
Mukesh
>  rust/kernel/bug.rs | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/rust/kernel/bug.rs b/rust/kernel/bug.rs
> index 3b40b0bd37b5..4e4e370237f7 100644
> --- a/rust/kernel/bug.rs
> +++ b/rust/kernel/bug.rs
> @@ -9,7 +9,13 @@
>  #[macro_export]
>  #[doc(hidden)]
>  #[cfg(not(testlib))]
> -#[cfg(all(CONFIG_BUG, not(CONFIG_UML), not(CONFIG_LOONGARCH), 
> not(CONFIG_ARM)))]
> +#[cfg(all(
> +    CONFIG_BUG,
> +    not(CONFIG_UML),
> +    not(CONFIG_LOONGARCH),
> +    not(CONFIG_ARM),
> +    not(CONFIG_PPC)
> +))]
>  #[cfg(CONFIG_DEBUG_BUGVERBOSE)]
>  macro_rules! warn_flags {
>      ($file:expr, $flags:expr) => {
> @@ -49,7 +55,13 @@ macro_rules! warn_flags {
>  #[macro_export]
>  #[doc(hidden)]
>  #[cfg(not(testlib))]
> -#[cfg(all(CONFIG_BUG, not(CONFIG_UML), not(CONFIG_LOONGARCH), 
> not(CONFIG_ARM)))]
> +#[cfg(all(
> +    CONFIG_BUG,
> +    not(CONFIG_UML),
> +    not(CONFIG_LOONGARCH),
> +    not(CONFIG_ARM),
> +    not(CONFIG_PPC)
> +))]
>  #[cfg(not(CONFIG_DEBUG_BUGVERBOSE))]
>  macro_rules! warn_flags {
>      ($file:expr, $flags:expr) => {
> @@ -106,7 +118,7 @@ macro_rules! warn_flags {
>  #[macro_export]
>  #[doc(hidden)]
>  #[cfg(not(testlib))]
> -#[cfg(all(CONFIG_BUG, any(CONFIG_LOONGARCH, CONFIG_ARM)))]
> +#[cfg(all(CONFIG_BUG, any(CONFIG_LOONGARCH, CONFIG_ARM, CONFIG_PPC)))]
>  macro_rules! warn_flags {
>      ($file:expr, $flags:expr) => {
>          if false {
> 
> base-commit: 82d8023ec40420ed61d7a96a173ef862741f1753
> -- 
> 2.43.0
> 

Reply via email to