public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V10 0/4] Rust support for powerpc
@ 2026-04-06 20:01 Mukesh Kumar Chaurasiya (IBM)
  2026-04-06 20:01 ` [PATCH V10 1/4] rust: Separate host libraries to fix rmeta dependency conflict Mukesh Kumar Chaurasiya (IBM)
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Mukesh Kumar Chaurasiya (IBM) @ 2026-04-06 20:01 UTC (permalink / raw)
  To: maddy, mpe, npiggin, chleroy, peterz, jpoimboe, jbaron, aliceryhl,
	rostedt, ardb, ojeda, boqun, gary, bjorn3_gh, lossin, a.hindborg,
	tmgross, dakr, nathan, nick.desaulniers+lkml, morbo, justinstitt,
	linuxppc-dev, linux-kernel, rust-for-linux, llvm
  Cc: Mukesh Kumar Chaurasiya (IBM)

Enable experimental rust support for ppc64le and ppc32be. The patch for
ppc32 has been provided by Link Mauve[1] and ppc64le support[2] has been
merged over it. ppc32 needs some toolchain fixes mentioned in the patch
`rust: Add PowerPC support` and the discussion for that is done here[1].

This has been tested on
- powernv9 hardware
- pseries P11 hardware
- pseries(9, 10) qemu
- powernv(9, 10) qemu
- rustdoc on x86 and powerpc64le
- rusttest on x86 and powerpc64le

We are actively working with our LLVM team to get the target for ppc,
ppc64 and ppc64le in the rust compiler.


[1] https://lore.kernel.org/all/20260204030507.8203-1-linkmauve@linkmauve.fr
[2] https://lore.kernel.org/all/20260204042417.83903-1-mkchauras@gmail.com

Changelog:
V9 -> V10:
- rust/Makefile updated with review comments from Miguel
- Patch 1/4 updated with commit message and subject
V9: https://lore.kernel.org/all/20260404121610.1956528-1-mkchauras@gmail.com/

V8 -> V9:
- rust/Makefile updated with a directory instead of abspath
V8: https://lore.kernel.org/all/20260403145308.1042622-1-mkchauras@gmail.com/

V7 -> V8:
- rust/Makefile updated to separate host libraries from target
V7: https://lore.kernel.org/all/20260329160254.2592207-1-mkchauras@gmail.com/

Changelog:
V6 -> V7:
- Documentation removed as powerpc is still under development
- Added a fix for race condition in rust/Makefile
V6: https://lore.kernel.org/all/20260210090023.2587534-1-mkchauras@gmail.com

V5 -> V6:
- Added a missing Tested by from Venkat which got missed since V3
- Support is marked as Maintained instead of experimental
V5: https://lore.kernel.org/all/20260210053756.2088302-1-mkchauras@gmail.com

V4 -> V5:
- Removed a nested ifdef from PPC64 for Little endian toolchain
V4: https://lore.kernel.org/all/20260209105456.1551677-1-mkchauras@gmail.com

V3 -> V4:
- Co-developed-by header added in patch 1
V3: https://lore.kernel.org/all/20260205180429.3280657-1-mkchauras@gmail.com

V2 -> V3:
- Splited HAVE_RUST in 2 lines
- BINDGEN_TARGET_powerpc initialized before assigning the same to
  BINDGEN_TARGET
V2: https://lore.kernel.org/all/20260204210125.613350-1-mkchauras@gmail.com

V1 -> V2:
- jump label fix for rust has been moved to a separate patch
- PPC32 support has been taken
- rust support has been marked experimental
- target.json dependency has been removed
- HAVE_RUST now depends on CPU_LITTLE_ENDIAN for PPC64

Link Mauve (1):
  rust: Add PowerPC support

Mukesh Kumar Chaurasiya (IBM) (3):
  rust: Fix "multiple candidates for rmeta dependency core" error
  powerpc/jump_label: adjust inline asm to be consistent
  powerpc: Enable Rust for ppc64le

 arch/powerpc/Kconfig                  |  2 +
 arch/powerpc/Makefile                 |  7 +++
 arch/powerpc/include/asm/jump_label.h | 23 ++++++----
 rust/Makefile                         | 66 ++++++++++++++++-----------
 4 files changed, 61 insertions(+), 37 deletions(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH V10 1/4] rust: Separate host libraries to fix rmeta dependency conflict
  2026-04-06 20:01 [PATCH V10 0/4] Rust support for powerpc Mukesh Kumar Chaurasiya (IBM)
@ 2026-04-06 20:01 ` Mukesh Kumar Chaurasiya (IBM)
  2026-04-06 20:01 ` [PATCH V10 2/4] powerpc/jump_label: adjust inline asm to be consistent Mukesh Kumar Chaurasiya (IBM)
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Mukesh Kumar Chaurasiya (IBM) @ 2026-04-06 20:01 UTC (permalink / raw)
  To: maddy, mpe, npiggin, chleroy, peterz, jpoimboe, jbaron, aliceryhl,
	rostedt, ardb, ojeda, boqun, gary, bjorn3_gh, lossin, a.hindborg,
	tmgross, dakr, nathan, nick.desaulniers+lkml, morbo, justinstitt,
	linuxppc-dev, linux-kernel, rust-for-linux, llvm
  Cc: Mukesh Kumar Chaurasiya (IBM)

When building Rust code for powerpc64le with LLVM=1 and -j1, rustc
encounters an error: "multiple candidates for `rmeta` dependency `core`
found", with two candidates:
1. The host's standard library from the rustup toolchain
2. The kernel's custom libcore.rmeta in the rust/ directory

This occurs because the build system uses `-L$(objtree)/rust` for host
library builds (proc_macro2, quote, syn), which causes rustc to search
the rust/ directory. During this search, rustc finds both the kernel's
custom libcore.rmeta and gains access to the host's standard library,
creating a conflict.

Separate all host-side build artifacts (host libraries and proc macros)
into a dedicated rust/host/ subdirectory and use `-L$(objtree)/rust/host`
for host builds. This ensures host builds only search rust/host/ and
never encounter the kernel's libcore.rmeta.

The `--out-dir` flag is removed from cmd_rustc_procmacrolibrary because
the output directory is now created explicitly with `mkdir -p $(dir $@)`
and the output file path is specified directly with `--emit=link=$@`,
making `--out-dir` redundant.

Moving the proc macros (libmacros and libpin_init_internal) to rust/host/
eliminates the need for special handling in rustdoc-pin_init, which can
now use the pin_init-flags variable directly instead of duplicating the
flags with absolute paths.

The rust/host/ directory is added to clean-files to ensure it's removed
during `make clean`.

Link: https://github.com/Rust-for-Linux/linux/issues/105
Link: https://github.com/linuxppc/issues/issues/451
Signed-off-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com>
---
 rust/Makefile | 56 +++++++++++++++++++++++++++------------------------
 1 file changed, 30 insertions(+), 26 deletions(-)

diff --git a/rust/Makefile b/rust/Makefile
index 9801af2e1e02..d8f34c4858b8 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -3,6 +3,9 @@
 # Where to place rustdoc generated documentation
 rustdoc_output := $(objtree)/Documentation/output/rust/rustdoc
 
+# Clean generated host directory
+clean-files := host/
+
 obj-$(CONFIG_RUST) += core.o compiler_builtins.o ffi.o
 always-$(CONFIG_RUST) += exports_core_generated.h
 
@@ -27,7 +30,7 @@ endif
 
 obj-$(CONFIG_RUST) += exports.o
 
-always-$(CONFIG_RUST) += libproc_macro2.rlib libquote.rlib libsyn.rlib
+always-$(CONFIG_RUST) += host/libproc_macro2.rlib host/libquote.rlib host/libsyn.rlib
 
 always-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated.rs
 always-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated_kunit.c
@@ -49,7 +52,7 @@ libmacros_extension := $(patsubst libmacros.%,%,$(libmacros_name))
 libpin_init_internal_name := $(shell MAKEFLAGS= $(RUSTC) --print file-names --crate-name pin_init_internal --crate-type proc-macro - </dev/null)
 libpin_init_internal_extension := $(patsubst libpin_init_internal.%,%,$(libpin_init_internal_name))
 
-always-$(CONFIG_RUST) += $(libmacros_name) $(libpin_init_internal_name)
+always-$(CONFIG_RUST) += host/$(libmacros_name) host/$(libpin_init_internal_name)
 
 # `$(rust_flags)` is passed in case the user added `--sysroot`.
 rustc_sysroot := $(shell MAKEFLAGS= $(RUSTC) $(rust_flags) --print sysroot)
@@ -150,7 +153,7 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $<
 	OBJTREE=$(abspath $(objtree)) \
 	$(RUSTDOC) $(filter-out $(skip_flags) --remap-path-prefix=% --remap-path-scope=%, \
 			$(if $(rustdoc_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-,,$@) \
@@ -247,7 +250,7 @@ rustdoc-kernel: private rustc_target_flags = --extern ffi --extern pin_init \
     --extern build_error --extern macros \
     --extern bindings --extern uapi
 rustdoc-kernel: $(src)/kernel/lib.rs rustdoc-core rustdoc-ffi rustdoc-macros \
-    rustdoc-pin_init rustdoc-compiler_builtins $(obj)/$(libmacros_name) \
+    rustdoc-pin_init rustdoc-compiler_builtins $(obj)/host/$(libmacros_name) \
     $(obj)/bindings.o FORCE
 	+$(call if_changed,rustdoc)
 
@@ -299,14 +302,14 @@ rusttestlib-pin_init_internal: $(src)/pin-init/internal/src/lib.rs \
 
 rusttestlib-pin_init: private rustc_target_flags = $(pin_init-flags)
 rusttestlib-pin_init: $(src)/pin-init/src/lib.rs rusttestlib-macros \
-    rusttestlib-pin_init_internal $(obj)/$(libpin_init_internal_name) FORCE
+    rusttestlib-pin_init_internal $(obj)/host/$(libpin_init_internal_name) FORCE
 	+$(call if_changed,rustc_test_library)
 
 rusttestlib-kernel: private rustc_target_flags = --extern ffi \
     --extern build_error --extern macros --extern pin_init \
     --extern bindings --extern uapi
 rusttestlib-kernel: $(src)/kernel/lib.rs rusttestlib-bindings rusttestlib-uapi \
-    rusttestlib-build_error rusttestlib-pin_init $(obj)/$(libmacros_name) \
+    rusttestlib-build_error rusttestlib-pin_init $(obj)/host/$(libmacros_name) \
     $(obj)/bindings.o FORCE
 	+$(call if_changed,rustc_test_library)
 
@@ -525,26 +528,27 @@ $(obj)/exports_kernel_generated.h: $(obj)/kernel.o FORCE
 
 quiet_cmd_rustc_procmacrolibrary = $(RUSTC_OR_CLIPPY_QUIET) PL $@
       cmd_rustc_procmacrolibrary = \
+	mkdir -p $(dir $@); \
 	$(if $(skip_clippy),$(RUSTC),$(RUSTC_OR_CLIPPY)) \
 		$(filter-out $(skip_flags),$(rust_common_flags) $(rustc_target_flags)) \
 		--emit=dep-info=$(depfile) --emit=link=$@ --crate-type rlib -O \
-		--out-dir $(objtree)/$(obj) -L$(objtree)/$(obj) \
+		-L$(objtree)/$(obj)/host \
 		--crate-name $(patsubst lib%.rlib,%,$(notdir $@)) $<
 
-$(obj)/libproc_macro2.rlib: private skip_clippy = 1
-$(obj)/libproc_macro2.rlib: private rustc_target_flags = $(proc_macro2-flags)
-$(obj)/libproc_macro2.rlib: $(src)/proc-macro2/lib.rs FORCE
+$(obj)/host/libproc_macro2.rlib: private skip_clippy = 1
+$(obj)/host/libproc_macro2.rlib: private rustc_target_flags = $(proc_macro2-flags)
+$(obj)/host/libproc_macro2.rlib: $(src)/proc-macro2/lib.rs FORCE
 	+$(call if_changed_dep,rustc_procmacrolibrary)
 
-$(obj)/libquote.rlib: private skip_clippy = 1
-$(obj)/libquote.rlib: private skip_flags = $(quote-skip_flags)
-$(obj)/libquote.rlib: private rustc_target_flags = $(quote-flags)
-$(obj)/libquote.rlib: $(src)/quote/lib.rs $(obj)/libproc_macro2.rlib FORCE
+$(obj)/host/libquote.rlib: private skip_clippy = 1
+$(obj)/host/libquote.rlib: private skip_flags = $(quote-skip_flags)
+$(obj)/host/libquote.rlib: private rustc_target_flags = $(quote-flags)
+$(obj)/host/libquote.rlib: $(src)/quote/lib.rs $(obj)/host/libproc_macro2.rlib FORCE
 	+$(call if_changed_dep,rustc_procmacrolibrary)
 
-$(obj)/libsyn.rlib: private skip_clippy = 1
-$(obj)/libsyn.rlib: private rustc_target_flags = $(syn-flags)
-$(obj)/libsyn.rlib: $(src)/syn/lib.rs $(obj)/libquote.rlib FORCE
+$(obj)/host/libsyn.rlib: private skip_clippy = 1
+$(obj)/host/libsyn.rlib: private rustc_target_flags = $(syn-flags)
+$(obj)/host/libsyn.rlib: $(src)/syn/lib.rs $(obj)/host/libquote.rlib FORCE
 	+$(call if_changed_dep,rustc_procmacrolibrary)
 
 quiet_cmd_rustc_procmacro = $(RUSTC_OR_CLIPPY_QUIET) P $@
@@ -553,20 +557,20 @@ quiet_cmd_rustc_procmacro = $(RUSTC_OR_CLIPPY_QUIET) P $@
 		-Clinker-flavor=gcc -Clinker=$(HOSTCC) \
 		-Clink-args='$(call escsq,$(KBUILD_PROCMACROLDFLAGS))' \
 		--emit=dep-info=$(depfile) --emit=link=$@ --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 $<
 
 # Procedural macros can only be used with the `rustc` that compiled it.
-$(obj)/$(libmacros_name): private rustc_target_flags = \
+$(obj)/host/$(libmacros_name): private rustc_target_flags = \
     --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)/host/$(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)
 
-$(obj)/$(libpin_init_internal_name): private rustc_target_flags = $(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 FORCE
+$(obj)/host/$(libpin_init_internal_name): private rustc_target_flags = $(pin_init_internal-flags)
+$(obj)/host/$(libpin_init_internal_name): $(src)/pin-init/internal/src/lib.rs \
+    $(obj)/host/libproc_macro2.rlib $(obj)/host/libquote.rlib $(obj)/host/libsyn.rlib FORCE
 	+$(call if_changed_dep,rustc_procmacro)
 
 # `rustc` requires `-Zunstable-options` to use custom target specifications
@@ -665,7 +669,7 @@ $(obj)/compiler_builtins.o: $(src)/compiler_builtins.rs $(obj)/core.o FORCE
 $(obj)/pin_init.o: private skip_gendwarfksyms = 1
 $(obj)/pin_init.o: private rustc_target_flags = $(pin_init-flags)
 $(obj)/pin_init.o: $(src)/pin-init/src/lib.rs $(obj)/compiler_builtins.o \
-    $(obj)/$(libpin_init_internal_name) $(obj)/$(libmacros_name) FORCE
+    $(obj)/host/$(libpin_init_internal_name) $(obj)/host/$(libmacros_name) FORCE
 	+$(call if_changed_rule,rustc_library)
 
 # Even if normally `build_error` is not a kernel object, it should still be
@@ -699,7 +703,7 @@ $(obj)/uapi.o: $(src)/uapi/lib.rs \
 $(obj)/kernel.o: private rustc_target_flags = --extern ffi --extern pin_init \
     --extern build_error --extern macros --extern bindings --extern uapi
 $(obj)/kernel.o: $(src)/kernel/lib.rs $(obj)/build_error.o $(obj)/pin_init.o \
-    $(obj)/$(libmacros_name) $(obj)/bindings.o $(obj)/uapi.o FORCE
+    $(obj)/host/$(libmacros_name) $(obj)/bindings.o $(obj)/uapi.o FORCE
 	+$(call if_changed_rule,rustc_library)
 
 ifdef CONFIG_JUMP_LABEL
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH V10 2/4] powerpc/jump_label: adjust inline asm to be consistent
  2026-04-06 20:01 [PATCH V10 0/4] Rust support for powerpc Mukesh Kumar Chaurasiya (IBM)
  2026-04-06 20:01 ` [PATCH V10 1/4] rust: Separate host libraries to fix rmeta dependency conflict Mukesh Kumar Chaurasiya (IBM)
@ 2026-04-06 20:01 ` Mukesh Kumar Chaurasiya (IBM)
  2026-04-06 20:01 ` [PATCH V10 3/4] rust: Add PowerPC support Mukesh Kumar Chaurasiya (IBM)
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Mukesh Kumar Chaurasiya (IBM) @ 2026-04-06 20:01 UTC (permalink / raw)
  To: maddy, mpe, npiggin, chleroy, peterz, jpoimboe, jbaron, aliceryhl,
	rostedt, ardb, ojeda, boqun, gary, bjorn3_gh, lossin, a.hindborg,
	tmgross, dakr, nathan, nick.desaulniers+lkml, morbo, justinstitt,
	linuxppc-dev, linux-kernel, rust-for-linux, llvm
  Cc: Mukesh Kumar Chaurasiya (IBM)

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 consistent")'

Co-developed-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Reviewed-by: Gary Guo <gary@garyguo.net>
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) <mkchauras@gmail.com>
---
 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/asm/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
 
+#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, bool 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);
 
 	return false;
@@ -34,10 +40,7 @@ static __always_inline bool arch_static_branch_jump(struct 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);
 
 	return false;
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH V10 3/4] rust: Add PowerPC support
  2026-04-06 20:01 [PATCH V10 0/4] Rust support for powerpc Mukesh Kumar Chaurasiya (IBM)
  2026-04-06 20:01 ` [PATCH V10 1/4] rust: Separate host libraries to fix rmeta dependency conflict Mukesh Kumar Chaurasiya (IBM)
  2026-04-06 20:01 ` [PATCH V10 2/4] powerpc/jump_label: adjust inline asm to be consistent Mukesh Kumar Chaurasiya (IBM)
@ 2026-04-06 20:01 ` Mukesh Kumar Chaurasiya (IBM)
  2026-04-06 20:01 ` [PATCH V10 4/4] powerpc: Enable Rust for ppc64le Mukesh Kumar Chaurasiya (IBM)
       [not found] ` <adYlLLfRgSyxus3n@luna>
  4 siblings, 0 replies; 9+ messages in thread
From: Mukesh Kumar Chaurasiya (IBM) @ 2026-04-06 20:01 UTC (permalink / raw)
  To: maddy, mpe, npiggin, chleroy, peterz, jpoimboe, jbaron, aliceryhl,
	rostedt, ardb, ojeda, boqun, gary, bjorn3_gh, lossin, a.hindborg,
	tmgross, dakr, nathan, nick.desaulniers+lkml, morbo, justinstitt,
	linuxppc-dev, linux-kernel, rust-for-linux, llvm
  Cc: Link Mauve, Mukesh Kumar Chaurasiya (IBM)

From: Link Mauve <linkmauve@linkmauve.fr>

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’t the only ones required to get the kernel to compile
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 <linkmauve@linkmauve.fr>
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) <mkchauras@gmail.com>
---
 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 10240cb80904..1246b3add8ff 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -284,6 +284,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 += $(objtree)/arch/powerpc/lib/crtsavres.o
 endif
 
+KBUILD_RUSTFLAGS 	+= --target=powerpc-unknown-linux-gnu
+
 ifdef CONFIG_CPU_LITTLE_ENDIAN
 KBUILD_CPPFLAGS	+= -mlittle-endian
 KBUILD_LDFLAGS	+= -EL
diff --git a/rust/Makefile b/rust/Makefile
index d8f34c4858b8..e53cb16c06c1 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -405,13 +405,15 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
 	-fstrict-flex-arrays=% -fmin-function-alignment=% \
 	-fzero-init-padding-bits=% -mno-fdpic \
 	-fdiagnostics-show-context -fdiagnostics-show-context=% \
-	--param=% --param asan-% -fno-isolate-erroneous-paths-dereference
+	--param=% --param asan-% -fno-isolate-erroneous-paths-dereference \
+	-ffixed-r2 -mmultiple -mno-readonly-in-sdata
 
 # Derived from `scripts/Makefile.clang`.
 BINDGEN_TARGET_x86	:= x86_64-linux-gnu
 BINDGEN_TARGET_arm64	:= aarch64-linux-gnu
 BINDGEN_TARGET_arm	:= arm-linux-gnueabi
 BINDGEN_TARGET_loongarch	:= loongarch64-linux-gnusf
+BINDGEN_TARGET_powerpc	:= powerpc-linux-gnu
 BINDGEN_TARGET_um	:= $(BINDGEN_TARGET_$(SUBARCH))
 BINDGEN_TARGET		:= $(BINDGEN_TARGET_$(SRCARCH))
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH V10 4/4] powerpc: Enable Rust for ppc64le
  2026-04-06 20:01 [PATCH V10 0/4] Rust support for powerpc Mukesh Kumar Chaurasiya (IBM)
                   ` (2 preceding siblings ...)
  2026-04-06 20:01 ` [PATCH V10 3/4] rust: Add PowerPC support Mukesh Kumar Chaurasiya (IBM)
@ 2026-04-06 20:01 ` Mukesh Kumar Chaurasiya (IBM)
       [not found] ` <adYlLLfRgSyxus3n@luna>
  4 siblings, 0 replies; 9+ messages in thread
From: Mukesh Kumar Chaurasiya (IBM) @ 2026-04-06 20:01 UTC (permalink / raw)
  To: maddy, mpe, npiggin, chleroy, peterz, jpoimboe, jbaron, aliceryhl,
	rostedt, ardb, ojeda, boqun, gary, bjorn3_gh, lossin, a.hindborg,
	tmgross, dakr, nathan, nick.desaulniers+lkml, morbo, justinstitt,
	linuxppc-dev, linux-kernel, rust-for-linux, llvm
  Cc: Mukesh Kumar Chaurasiya (IBM), Link Mauve, Venkat Rao Bagalkote

Enabling rust support for ppc64le.

Tested on pseries Power11:
╰─❯ 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 = "hello, world"
[    0.271129] rust_print: Arc<dyn Display> says 42
[    0.271130] rust_print: Arc<dyn Display> 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 <linkmauve@linkmauve.fr>
Tested-by: Link Mauve <linkmauve@linkmauve.fr>
Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
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) <mkchauras@gmail.com>
---
 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 1246b3add8ff..a5f50434daf3 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -285,6 +285,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 += $(objtree)/arch/powerpc/lib/crtsavres.o
 endif
 
-KBUILD_RUSTFLAGS 	+= --target=powerpc-unknown-linux-gnu
+ifdef CONFIG_PPC64
+KBUILD_RUSTFLAGS	+= --target=powerpc64le-unknown-linux-gnu
+KBUILD_RUSTFLAGS	+= -Ctarget-feature=-mma,-vsx,-hard-float,-altivec
+else
+KBUILD_RUSTFLAGS	+= --target=powerpc-unknown-linux-gnu
+endif
 
 ifdef CONFIG_CPU_LITTLE_ENDIAN
 KBUILD_CPPFLAGS	+= -mlittle-endian
diff --git a/rust/Makefile b/rust/Makefile
index e53cb16c06c1..e106d6feb8da 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -413,7 +413,13 @@ BINDGEN_TARGET_x86	:= x86_64-linux-gnu
 BINDGEN_TARGET_arm64	:= aarch64-linux-gnu
 BINDGEN_TARGET_arm	:= arm-linux-gnueabi
 BINDGEN_TARGET_loongarch	:= loongarch64-linux-gnusf
+
+ifdef CONFIG_PPC64
+BINDGEN_TARGET_powerpc	:= powerpc64le-linux-gnu
+else
 BINDGEN_TARGET_powerpc	:= powerpc-linux-gnu
+endif
+
 BINDGEN_TARGET_um	:= $(BINDGEN_TARGET_$(SUBARCH))
 BINDGEN_TARGET		:= $(BINDGEN_TARGET_$(SRCARCH))
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH V10 0/4] Rust support for powerpc [RESEND]
       [not found] ` <adYlLLfRgSyxus3n@luna>
@ 2026-04-08 11:53   ` Mukesh Kumar Chaurasiya
  2026-04-08 13:19     ` Link Mauve
  0 siblings, 1 reply; 9+ messages in thread
From: Mukesh Kumar Chaurasiya @ 2026-04-08 11:53 UTC (permalink / raw)
  To: Link Mauve
  Cc: maddy, mpe, npiggin, chleroy, peterz, jpoimboe, jbaron, aliceryhl,
	rostedt, ardb, ojeda, boqun, gary, bjorn3_gh, lossin, a.hindborg,
	tmgross, dakr, nathan, nick.desaulniers+lkml, morbo, justinstitt,
	linuxppc-dev, linux-kernel, rust-for-linux, llvm

On Wed, Apr 08, 2026 at 11:51:40AM +0200, Link Mauve wrote:
> Hi,
> 
> (This email is a resent, my IP address got flagged by spamhaus again
> because I’m on a residential range, hopefully this incident is
> resolved…)
> 
> On Tue, Apr 07, 2026 at 01:31:45AM +0530, Mukesh Kumar Chaurasiya (IBM) wrote:
> > Enable experimental rust support for ppc64le and ppc32be. The patch for
> > ppc32 has been provided by Link Mauve[1] and ppc64le support[2] has been
> > merged over it. ppc32 needs some toolchain fixes mentioned in the patch
> > `rust: Add PowerPC support` and the discussion for that is done here[1].
> > 
> > This has been tested on
> > - powernv9 hardware
> > - pseries P11 hardware
> > - pseries(9, 10) qemu
> > - powernv(9, 10) qemu
> > - rustdoc on x86 and powerpc64le
> > - rusttest on x86 and powerpc64le
> 
> I just tested your series for the Wii, so targeting powerpc (32, be),
> and got this error:
> ```
> error[E0463]: can't find crate for `pin_init_internal`
>    --> ../rust/pin-init/src/lib.rs:365:11
>     |
> 365 | pub use ::pin_init_internal::pin_data;
>     |           ^^^^^^^^^^^^^^^^^ can't find crate
> 
> error: aborting due to 1 previous error
> 
> For more information about this error, try `rustc --explain E0463`.
> ```
> 
> I didn’t get this error in a previous version of your series, would you
> want me to bisect them?
> 
> Thanks for your continuous work on it anyway!
> 

Hey Link,

Thanks for testing this.

Can you give me the command generated via make with V=1
e.g. `make LLVM=1 V=1`

Regards,
Mukesh

> > 
> > We are actively working with our LLVM team to get the target for ppc,
> > ppc64 and ppc64le in the rust compiler.
> > 
> > 
> > [1] https://lore.kernel.org/all/20260204030507.8203-1-linkmauve@linkmauve.fr
> > [2] https://lore.kernel.org/all/20260204042417.83903-1-mkchauras@gmail.com
> > 
> > Changelog:
> > V9 -> V10:
> > - rust/Makefile updated with review comments from Miguel
> > - Patch 1/4 updated with commit message and subject
> > V9: https://lore.kernel.org/all/20260404121610.1956528-1-mkchauras@gmail.com/
> > 
> > V8 -> V9:
> > - rust/Makefile updated with a directory instead of abspath
> > V8: https://lore.kernel.org/all/20260403145308.1042622-1-mkchauras@gmail.com/
> > 
> > V7 -> V8:
> > - rust/Makefile updated to separate host libraries from target
> > V7: https://lore.kernel.org/all/20260329160254.2592207-1-mkchauras@gmail.com/
> > 
> > Changelog:
> > V6 -> V7:
> > - Documentation removed as powerpc is still under development
> > - Added a fix for race condition in rust/Makefile
> > V6: https://lore.kernel.org/all/20260210090023.2587534-1-mkchauras@gmail.com
> > 
> > V5 -> V6:
> > - Added a missing Tested by from Venkat which got missed since V3
> > - Support is marked as Maintained instead of experimental
> > V5: https://lore.kernel.org/all/20260210053756.2088302-1-mkchauras@gmail.com
> > 
> > V4 -> V5:
> > - Removed a nested ifdef from PPC64 for Little endian toolchain
> > V4: https://lore.kernel.org/all/20260209105456.1551677-1-mkchauras@gmail.com
> > 
> > V3 -> V4:
> > - Co-developed-by header added in patch 1
> > V3: https://lore.kernel.org/all/20260205180429.3280657-1-mkchauras@gmail.com
> > 
> > V2 -> V3:
> > - Splited HAVE_RUST in 2 lines
> > - BINDGEN_TARGET_powerpc initialized before assigning the same to
> >   BINDGEN_TARGET
> > V2: https://lore.kernel.org/all/20260204210125.613350-1-mkchauras@gmail.com
> > 
> > V1 -> V2:
> > - jump label fix for rust has been moved to a separate patch
> > - PPC32 support has been taken
> > - rust support has been marked experimental
> > - target.json dependency has been removed
> > - HAVE_RUST now depends on CPU_LITTLE_ENDIAN for PPC64
> > 
> > Link Mauve (1):
> >   rust: Add PowerPC support
> > 
> > Mukesh Kumar Chaurasiya (IBM) (3):
> >   rust: Fix "multiple candidates for rmeta dependency core" error
> >   powerpc/jump_label: adjust inline asm to be consistent
> >   powerpc: Enable Rust for ppc64le
> > 
> >  arch/powerpc/Kconfig                  |  2 +
> >  arch/powerpc/Makefile                 |  7 +++
> >  arch/powerpc/include/asm/jump_label.h | 23 ++++++----
> >  rust/Makefile                         | 66 ++++++++++++++++-----------
> >  4 files changed, 61 insertions(+), 37 deletions(-)
> > 
> > -- 
> > 2.53.0
> > 
> > 
> 
> -- 
> Link Mauve
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH V10 0/4] Rust support for powerpc [RESEND]
  2026-04-08 11:53   ` [PATCH V10 0/4] Rust support for powerpc [RESEND] Mukesh Kumar Chaurasiya
@ 2026-04-08 13:19     ` Link Mauve
  2026-04-08 14:00       ` Gary Guo
  0 siblings, 1 reply; 9+ messages in thread
From: Link Mauve @ 2026-04-08 13:19 UTC (permalink / raw)
  To: Mukesh Kumar Chaurasiya
  Cc: Link Mauve, maddy, mpe, npiggin, chleroy, peterz, jpoimboe,
	jbaron, aliceryhl, rostedt, ardb, ojeda, boqun, gary, bjorn3_gh,
	lossin, a.hindborg, tmgross, dakr, nathan, nick.desaulniers+lkml,
	morbo, justinstitt, linuxppc-dev, linux-kernel, rust-for-linux,
	llvm

On Wed, Apr 08, 2026 at 05:23:39PM +0530, Mukesh Kumar Chaurasiya wrote:
> On Wed, Apr 08, 2026 at 11:51:40AM +0200, Link Mauve wrote:
> > Hi,
> > 
> > (This email is a resent, my IP address got flagged by spamhaus again
> > because I’m on a residential range, hopefully this incident is
> > resolved…)
> > 
> > On Tue, Apr 07, 2026 at 01:31:45AM +0530, Mukesh Kumar Chaurasiya (IBM) wrote:
> > > Enable experimental rust support for ppc64le and ppc32be. The patch for
> > > ppc32 has been provided by Link Mauve[1] and ppc64le support[2] has been
> > > merged over it. ppc32 needs some toolchain fixes mentioned in the patch
> > > `rust: Add PowerPC support` and the discussion for that is done here[1].
> > > 
> > > This has been tested on
> > > - powernv9 hardware
> > > - pseries P11 hardware
> > > - pseries(9, 10) qemu
> > > - powernv(9, 10) qemu
> > > - rustdoc on x86 and powerpc64le
> > > - rusttest on x86 and powerpc64le
> > 
> > I just tested your series for the Wii, so targeting powerpc (32, be),
> > and got this error:
> > ```
> > error[E0463]: can't find crate for `pin_init_internal`
> >    --> ../rust/pin-init/src/lib.rs:365:11
> >     |
> > 365 | pub use ::pin_init_internal::pin_data;
> >     |           ^^^^^^^^^^^^^^^^^ can't find crate
> > 
> > error: aborting due to 1 previous error
> > 
> > For more information about this error, try `rustc --explain E0463`.
> > ```
> > 
> > I didn’t get this error in a previous version of your series, would you
> > want me to bisect them?
> > 
> > Thanks for your continuous work on it anyway!
> > 
> 
> Hey Link,
> 
> Thanks for testing this.
> 
> Can you give me the command generated via make with V=1
> e.g. `make LLVM=1 V=1`

Here it is:
```
% make ARCH=powerpc CROSS_COMPILE=powerpc-linux-musl- O=wii W=1 V=1 -j1
make  -C /home/linkmauve/dev/linux/wii \
-f /home/linkmauve/dev/linux/Makefile
make[1]: Entering directory '/home/linkmauve/dev/linux/wii'
make --no-print-directory -C /home/linkmauve/dev/linux/wii \
-f /home/linkmauve/dev/linux/Makefile
ln -fsn .. source
# GEN     Makefile
  { echo "# Automatically generated by /home/linkmauve/dev/linux/Makefile: don't edit"; echo "export KBUILD_OUTPUT = /home/linkmauve/dev/linux/wii"; echo "include /home/linkmauve/dev/linux/Makefile"; } > Makefile
test -e .gitignore || \
{ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
make -f ../scripts/Makefile.build obj=arch/powerpc/kernel/syscalls all
make -f ../scripts/Makefile.build obj=scripts/basic
make -f ../scripts/Makefile.build obj=scripts/dtc
make -f ../scripts/Makefile.build obj=scripts
make -f ../scripts/Makefile.build obj=scripts/gcc-plugins \
need-builtin= \
need-modorder= \

set -e; mkdir -p include/config/; trap "rm -f include/config/.tmp_kernel.release" EXIT; { ../scripts/setlocalversion ..; } > include/config/.tmp_kernel.release; if [ ! -r include/config/kernel.release ] || ! cmp -s include/config/kernel.release include/config/.tmp_kernel.release; then : '  UPD     include/config/kernel.release'; mv -f include/config/.tmp_kernel.release include/config/kernel.release; fi
make -f ../scripts/Makefile.asm-headers obj=arch/powerpc/include/generated/uapi/asm \
generic=include/uapi/asm-generic
make -f ../scripts/Makefile.asm-headers obj=arch/powerpc/include/generated/asm \
generic=include/asm-generic
set -e; mkdir -p include/generated/uapi/linux/; trap "rm -f include/generated/uapi/linux/.tmp_version.h" EXIT; { 	if [ 0 -gt 255 ]; then echo \#define LINUX_VERSION_CODE 459007; else echo \#define LINUX_VERSION_CODE 458752; fi; echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))'; echo \#define LINUX_VERSION_MAJOR 7; echo \#define LINUX_VERSION_PATCHLEVEL 0; echo \#define LINUX_VERSION_SUBLEVEL 0; } > include/generated/uapi/linux/.tmp_version.h; if [ ! -r include/generated/uapi/linux/version.h ] || ! cmp -s include/generated/uapi/linux/version.h include/generated/uapi/linux/.tmp_version.h; then : '  UPD     include/generated/uapi/linux/version.h'; mv -f include/generated/uapi/linux/.tmp_version.h include/generated/uapi/linux/version.h; fi
set -e; mkdir -p include/generated/; trap "rm -f include/generated/.tmp_utsrelease.h" EXIT; { 	if [ `echo -n "7.0.0-rc7-wii+" | wc -c ` -gt 64 ]; then echo '"7.0.0-rc7-wii+" exceeds 64 characters' >&2; exit 1; fi; echo \#define UTS_RELEASE \"7.0.0-rc7-wii+\"; } > include/generated/.tmp_utsrelease.h; if [ ! -r include/generated/utsrelease.h ] || ! cmp -s include/generated/utsrelease.h include/generated/.tmp_utsrelease.h; then : '  UPD     include/generated/utsrelease.h'; mv -f include/generated/.tmp_utsrelease.h include/generated/utsrelease.h; fi
set -e; mkdir -p include/generated/; trap "rm -f include/generated/.tmp_compile.h" EXIT; { ../scripts/mkcompile_h "ppc" "powerpc-linux-musl-gcc (GCC) 14.2.1 20250405" "powerpc-linux-musl-ld"; } > include/generated/.tmp_compile.h; if [ ! -r include/generated/compile.h ] || ! cmp -s include/generated/compile.h include/generated/.tmp_compile.h; then : '  UPD     include/generated/compile.h'; mv -f include/generated/.tmp_compile.h include/generated/compile.h; fi
../scripts/remove-stale-files
make -f ../scripts/Makefile.build obj=scripts/mod
set -e; mkdir -p scripts/mod/; trap "rm -f scripts/mod/.tmp_devicetable-offsets.h" EXIT; { 	 echo "#ifndef __DEVICETABLE_OFFSETS_H__"; echo "#define __DEVICETABLE_OFFSETS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " */"; echo ""; sed -ne 	's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; /^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}' < scripts/mod/devicetable-offsets.s; echo ""; echo "#endif"; } > scripts/mod/.tmp_devicetable-offsets.h; if [ ! -r scripts/mod/devicetable-offsets.h ] || ! cmp -s scripts/mod/devicetable-offsets.h scripts/mod/.tmp_devicetable-offsets.h; then : '  UPD     scripts/mod/devicetable-offsets.h'; mv -f scripts/mod/.tmp_devicetable-offsets.h scripts/mod/devicetable-offsets.h; fi
make -f ../scripts/Makefile.build obj=. prepare
set -e; mkdir -p include/generated/; trap "rm -f include/generated/.tmp_timeconst.h" EXIT; { echo 1000 | bc -q ../kernel/time/timeconst.bc; } > include/generated/.tmp_timeconst.h; if [ ! -r include/generated/timeconst.h ] || ! cmp -s include/generated/timeconst.h include/generated/.tmp_timeconst.h; then : '  UPD     include/generated/timeconst.h'; mv -f include/generated/.tmp_timeconst.h include/generated/timeconst.h; fi
set -e; mkdir -p include/generated/; trap "rm -f include/generated/.tmp_bounds.h" EXIT; { 	 echo "#ifndef __LINUX_BOUNDS_H__"; echo "#define __LINUX_BOUNDS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " */"; echo ""; sed -ne 	's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; /^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}' < kernel/bounds.s; echo ""; echo "#endif"; } > include/generated/.tmp_bounds.h; if [ ! -r include/generated/bounds.h ] || ! cmp -s include/generated/bounds.h include/generated/.tmp_bounds.h; then : '  UPD     include/generated/bounds.h'; mv -f include/generated/.tmp_bounds.h include/generated/bounds.h; fi
set -e; mkdir -p include/generated/; trap "rm -f include/generated/.tmp_asm-offsets.h" EXIT; { 	 echo "#ifndef __ASM_OFFSETS_H__"; echo "#define __ASM_OFFSETS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " */"; echo ""; sed -ne 	's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; /^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}' < arch/powerpc/kernel/asm-offsets.s; echo ""; echo "#endif"; } > include/generated/.tmp_asm-offsets.h; if [ ! -r include/generated/asm-offsets.h ] || ! cmp -s include/generated/asm-offsets.h include/generated/.tmp_asm-offsets.h; then : '  UPD     include/generated/asm-offsets.h'; mv -f include/generated/.tmp_asm-offsets.h include/generated/asm-offsets.h; fi
set -e; mkdir -p include/generated/; trap "rm -f include/generated/.tmp_rq-offsets.h" EXIT; { 	 echo "#ifndef __RQ_OFFSETS_H__"; echo "#define __RQ_OFFSETS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " */"; echo ""; sed -ne 	's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; /^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}' < kernel/sched/rq-offsets.s; echo ""; echo "#endif"; } > include/generated/.tmp_rq-offsets.h; if [ ! -r include/generated/rq-offsets.h ] || ! cmp -s include/generated/rq-offsets.h include/generated/.tmp_rq-offsets.h; then : '  UPD     include/generated/rq-offsets.h'; mv -f include/generated/.tmp_rq-offsets.h include/generated/rq-offsets.h; fi
# CALL    ../scripts/checksyscalls.sh
  sh ../scripts/checksyscalls.sh powerpc-linux-musl-gcc -Wp,-MMD,./.missing-syscalls.d -nostdinc -I../arch/powerpc/include -I./arch/powerpc/include/generated -I../include -I./include -I../arch/powerpc/include/uapi -I./arch/powerpc/include/generated/uapi -I../include/uapi -I./include/generated/uapi -include ../include/linux/compiler-version.h -include ../include/linux/kconfig.h -include ../include/linux/compiler_types.h -D__KERNEL__ -mbig-endian -m32 -I ../arch/powerpc -fmacro-prefix-map=../= -Wundef -DKBUILD_EXTRA_WARN1 -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -msoft-float -ffixed-r2 -mmultiple -mno-readonly-in-sdata -mcpu=powerpc -mno-prefixed -mno-pcrel -mno-altivec -mno-vsx -mno-mma -fno-asynchronous-unwind-tables -mno-string -mbig-endian -fno-delete-null-pointer-checks -Os -fno-allow-store-data-races -fno-stack-protector -fomit-frame-pointer -ftrivial-auto-var-init=zero -fno-stack-clash-protection -fmin-function-alignment=4 -fstrict-flex-arrays=3 -fms-extensions -fno-strict-overflow -fno-stack-check -fconserve-stack -fno-builtin-wcslen -Wall -Wextra -Wundef -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Werror=strict-prototypes -Wno-format-security -Wno-trigraphs -Wno-frame-address -Wno-address-of-packed-member -Wmissing-declarations -Wmissing-prototypes -Wframe-larger-than=1280 -Wno-main -Wno-type-limits -Wno-dangling-pointer -Wvla-larger-than=1 -Wno-pointer-sign -Wcast-function-type -Wno-array-bounds -Wno-stringop-overflow -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wenum-conversion -Wunused -Wmissing-format-attribute -Wmissing-include-dirs -Wunused-const-variable -Wno-missing-field-initializers -Wno-shift-negative-value -Wno-maybe-uninitialized -Wno-sign-compare -Wno-unused-parameter -DGCC_PLUGINS -I../. -I.    -DKBUILD_MODFILE='"./missing-syscalls"' -DKBUILD_BASENAME='"missing_syscalls"' -DKBUILD_MODNAME='"missing_syscalls"' -D__KBUILD_MODNAME=missing_syscalls
make -f ../scripts/Makefile.build obj=arch/powerpc/kernel/vdso include/generated/vdso32-offsets.h
mkdir -p ./tools
make O=/home/linkmauve/dev/linux/wii subdir=tools -C ../tools/ objtool
mkdir -p /home/linkmauve/dev/linux/wii/tools/objtool && make O=/home/linkmauve/dev/linux/wii subdir=tools/objtool --no-print-directory -C objtool
make -C /home/linkmauve/dev/linux/tools/build CFLAGS= LDFLAGS= /home/linkmauve/dev/linux/wii/tools/objtool/fixdep
if [ ! -f /home/linkmauve/dev/linux/wii/tools/objtool/fixdep ]; then						\
	make -f /home/linkmauve/dev/linux/tools/build/Makefile.build dir=. obj=fixdep HOSTCFLAGS="-Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu11   -I ../scripts/include";	\
	rm -f /home/linkmauve/dev/linux/wii/tools/objtool/fixdep.o;						\
fi
make -f /home/linkmauve/dev/linux/tools/build/Makefile.build dir=. obj=fixdep HOSTCFLAGS="-Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu11   -I ../scripts/include"
make -C /home/linkmauve/dev/linux/tools/lib/subcmd/ O=/home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd \
	DESTDIR=/home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd prefix= subdir= \
	CC="gcc" LD="ld" AR="ar" EXTRA_CFLAGS="-std=gnu11 -fomit-frame-pointer -O2 -g -Werror -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations -Wwrite-strings -Wno-implicit-fallthrough -Wno-sign-compare -Wno-unused-parameter -I/home/linkmauve/dev/linux/tools/include -I/home/linkmauve/dev/linux/tools/include/uapi -I/home/linkmauve/dev/linux/tools/arch/x86/include/uapi -I/home/linkmauve/dev/linux/tools/arch/powerpc/include -I/home/linkmauve/dev/linux/tools/objtool/include -I/home/linkmauve/dev/linux/tools/objtool/arch/powerpc/include -I/home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd/include   " \
	/home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd/libsubcmd.a install_headers
make -C /home/linkmauve/dev/linux/tools/build CFLAGS= LDFLAGS= /home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd/fixdep
if [ ! -f /home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd/fixdep ]; then						\
	make -f /home/linkmauve/dev/linux/tools/build/Makefile.build dir=. obj=fixdep HOSTCFLAGS="-Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu11   -I ../scripts/include";	\
	rm -f /home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd/fixdep.o;						\
fi
make -f /home/linkmauve/dev/linux/tools/build/Makefile.build dir=. obj=fixdep HOSTCFLAGS="-Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu11   -I ../scripts/include"
make[5]: 'install_headers' is up to date.
sh ./sync-check.sh
make -f /home/linkmauve/dev/linux/tools/build/Makefile.build dir=. obj=objtool CC="gcc" LD="ld" AR="ar" CFLAGS="-std=gnu11 -fomit-frame-pointer -O2 -g -Werror -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations -Wwrite-strings -Wno-implicit-fallthrough -Wno-sign-compare -Wno-unused-parameter -I/home/linkmauve/dev/linux/tools/include -I/home/linkmauve/dev/linux/tools/include/uapi -I/home/linkmauve/dev/linux/tools/arch/x86/include/uapi -I/home/linkmauve/dev/linux/tools/arch/powerpc/include -I/home/linkmauve/dev/linux/tools/objtool/include -I/home/linkmauve/dev/linux/tools/objtool/arch/powerpc/include -I/home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd/include   " \
	LDFLAGS="/home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd/libsubcmd.a -lelf  "
make -f /home/linkmauve/dev/linux/tools/build/Makefile.build dir=./arch/powerpc obj=objtool
sh ../scripts/rust_is_available.sh
make -f ../scripts/Makefile.build obj=rust
# RUSTC L rust/pin_init.o
  OBJTREE=/home/linkmauve/dev/linux/wii rustc --edition=2021 -Zbinary_dep_depinfo=y -Astable_features -Aunused_features -Dnon_ascii_idents -Dunsafe_op_in_unsafe_fn -Wmissing_docs -Wrust_2018_idioms -Wunreachable_pub -Wclippy::all -Wclippy::as_ptr_cast_mut -Wclippy::as_underscore -Wclippy::cast_lossless -Wclippy::ignored_unit_patterns -Wclippy::mut_mut -Wclippy::needless_bitwise_bool -Aclippy::needless_lifetimes -Wclippy::no_mangle_with_rust_abi -Wclippy::ptr_as_ptr -Wclippy::ptr_cast_constness -Wclippy::ref_as_ptr -Wclippy::undocumented_unsafe_blocks -Wclippy::unnecessary_safety_comment -Wclippy::unnecessary_safety_doc -Wrustdoc::missing_crate_level_docs -Wrustdoc::unescaped_backticks -Cpanic=abort -Cembed-bitcode=n -Clto=n -Cforce-unwind-tables=n -Ccodegen-units=1 -Csymbol-mangling-version=v0 -Crelocation-model=static -Zfunction-sections=n -Wclippy::float_arithmetic --target=powerpc-unknown-linux-gnu -Copt-level=s -Cdebug-assertions=n -Coverflow-checks=y @./include/generated/rustc_cfg --extern pin_init_internal --extern macros --cfg='kernel' --emit=dep-info=rust/.pin_init.o.d --emit=obj=rust/pin_init.o --emit=metadata=rust/libpin_init.rmeta --crate-type rlib -L./rust --crate-name pin_init ../rust/pin-init/src/lib.rs --sysroot=/dev/null -Zunstable-options   ; ./tools/objtool/objtool --static-call   rust/pin_init.o
error[E0463]: can't find crate for `pin_init_internal`
   --> ../rust/pin-init/src/lib.rs:365:11
    |
365 | pub use ::pin_init_internal::pin_data;
    |           ^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0463`.
make[3]: *** [../rust/Makefile:681: rust/pin_init.o] Error 1
make[2]: *** [/home/linkmauve/dev/linux/Makefile:1343: prepare] Error 2
make[1]: *** [/home/linkmauve/dev/linux/Makefile:248: __sub-make] Error 2
make[1]: Leaving directory '/home/linkmauve/dev/linux/wii'
make: *** [Makefile:248: __sub-make] Error 2
make ARCH=powerpc CROSS_COMPILE=powerpc-linux-musl- O=wii W=1 V=1 -j1  1.15s user 0.56s system 100% cpu 1.695 total
```

> 
> Regards,
> Mukesh
> 
> > > 
> > > We are actively working with our LLVM team to get the target for ppc,
> > > ppc64 and ppc64le in the rust compiler.
> > > 
> > > 
> > > [1] https://lore.kernel.org/all/20260204030507.8203-1-linkmauve@linkmauve.fr
> > > [2] https://lore.kernel.org/all/20260204042417.83903-1-mkchauras@gmail.com
> > > 
> > > Changelog:
> > > V9 -> V10:
> > > - rust/Makefile updated with review comments from Miguel
> > > - Patch 1/4 updated with commit message and subject
> > > V9: https://lore.kernel.org/all/20260404121610.1956528-1-mkchauras@gmail.com/
> > > 
> > > V8 -> V9:
> > > - rust/Makefile updated with a directory instead of abspath
> > > V8: https://lore.kernel.org/all/20260403145308.1042622-1-mkchauras@gmail.com/
> > > 
> > > V7 -> V8:
> > > - rust/Makefile updated to separate host libraries from target
> > > V7: https://lore.kernel.org/all/20260329160254.2592207-1-mkchauras@gmail.com/
> > > 
> > > Changelog:
> > > V6 -> V7:
> > > - Documentation removed as powerpc is still under development
> > > - Added a fix for race condition in rust/Makefile
> > > V6: https://lore.kernel.org/all/20260210090023.2587534-1-mkchauras@gmail.com
> > > 
> > > V5 -> V6:
> > > - Added a missing Tested by from Venkat which got missed since V3
> > > - Support is marked as Maintained instead of experimental
> > > V5: https://lore.kernel.org/all/20260210053756.2088302-1-mkchauras@gmail.com
> > > 
> > > V4 -> V5:
> > > - Removed a nested ifdef from PPC64 for Little endian toolchain
> > > V4: https://lore.kernel.org/all/20260209105456.1551677-1-mkchauras@gmail.com
> > > 
> > > V3 -> V4:
> > > - Co-developed-by header added in patch 1
> > > V3: https://lore.kernel.org/all/20260205180429.3280657-1-mkchauras@gmail.com
> > > 
> > > V2 -> V3:
> > > - Splited HAVE_RUST in 2 lines
> > > - BINDGEN_TARGET_powerpc initialized before assigning the same to
> > >   BINDGEN_TARGET
> > > V2: https://lore.kernel.org/all/20260204210125.613350-1-mkchauras@gmail.com
> > > 
> > > V1 -> V2:
> > > - jump label fix for rust has been moved to a separate patch
> > > - PPC32 support has been taken
> > > - rust support has been marked experimental
> > > - target.json dependency has been removed
> > > - HAVE_RUST now depends on CPU_LITTLE_ENDIAN for PPC64
> > > 
> > > Link Mauve (1):
> > >   rust: Add PowerPC support
> > > 
> > > Mukesh Kumar Chaurasiya (IBM) (3):
> > >   rust: Fix "multiple candidates for rmeta dependency core" error
> > >   powerpc/jump_label: adjust inline asm to be consistent
> > >   powerpc: Enable Rust for ppc64le
> > > 
> > >  arch/powerpc/Kconfig                  |  2 +
> > >  arch/powerpc/Makefile                 |  7 +++
> > >  arch/powerpc/include/asm/jump_label.h | 23 ++++++----
> > >  rust/Makefile                         | 66 ++++++++++++++++-----------
> > >  4 files changed, 61 insertions(+), 37 deletions(-)
> > > 
> > > -- 
> > > 2.53.0
> > > 
> > > 
> > 
> > -- 
> > Link Mauve
> > 

-- 
Link Mauve

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH V10 0/4] Rust support for powerpc [RESEND]
  2026-04-08 13:19     ` Link Mauve
@ 2026-04-08 14:00       ` Gary Guo
  2026-04-08 14:15         ` Mukesh Kumar Chaurasiya
  0 siblings, 1 reply; 9+ messages in thread
From: Gary Guo @ 2026-04-08 14:00 UTC (permalink / raw)
  To: Link Mauve, Mukesh Kumar Chaurasiya
  Cc: maddy, mpe, npiggin, chleroy, peterz, jpoimboe, jbaron, aliceryhl,
	rostedt, ardb, ojeda, boqun, gary, bjorn3_gh, lossin, a.hindborg,
	tmgross, dakr, nathan, nick.desaulniers+lkml, morbo, justinstitt,
	linuxppc-dev, linux-kernel, rust-for-linux, llvm

On Wed Apr 8, 2026 at 2:19 PM BST, Link Mauve wrote:
> On Wed, Apr 08, 2026 at 05:23:39PM +0530, Mukesh Kumar Chaurasiya wrote:
>> On Wed, Apr 08, 2026 at 11:51:40AM +0200, Link Mauve wrote:
>> > Hi,
>> > 
>> > (This email is a resent, my IP address got flagged by spamhaus again
>> > because I’m on a residential range, hopefully this incident is
>> > resolved…)
>> > 
>> > On Tue, Apr 07, 2026 at 01:31:45AM +0530, Mukesh Kumar Chaurasiya (IBM) wrote:
>> > > Enable experimental rust support for ppc64le and ppc32be. The patch for
>> > > ppc32 has been provided by Link Mauve[1] and ppc64le support[2] has been
>> > > merged over it. ppc32 needs some toolchain fixes mentioned in the patch
>> > > `rust: Add PowerPC support` and the discussion for that is done here[1].
>> > > 
>> > > This has been tested on
>> > > - powernv9 hardware
>> > > - pseries P11 hardware
>> > > - pseries(9, 10) qemu
>> > > - powernv(9, 10) qemu
>> > > - rustdoc on x86 and powerpc64le
>> > > - rusttest on x86 and powerpc64le
>> > 
>> > I just tested your series for the Wii, so targeting powerpc (32, be),
>> > and got this error:
>> > ```
>> > error[E0463]: can't find crate for `pin_init_internal`
>> >    --> ../rust/pin-init/src/lib.rs:365:11
>> >     |
>> > 365 | pub use ::pin_init_internal::pin_data;
>> >     |           ^^^^^^^^^^^^^^^^^ can't find crate
>> > 
>> > error: aborting due to 1 previous error
>> > 
>> > For more information about this error, try `rustc --explain E0463`.
>> > ```
>> > 
>> > I didn’t get this error in a previous version of your series, would you
>> > want me to bisect them?
>> > 
>> > Thanks for your continuous work on it anyway!
>> > 
>> 
>> Hey Link,
>> 
>> Thanks for testing this.
>> 
>> Can you give me the command generated via make with V=1
>> e.g. `make LLVM=1 V=1`
>
> Here it is:
> ```
> % make ARCH=powerpc CROSS_COMPILE=powerpc-linux-musl- O=wii W=1 V=1 -j1
> make  -C /home/linkmauve/dev/linux/wii \
> -f /home/linkmauve/dev/linux/Makefile
> make[1]: Entering directory '/home/linkmauve/dev/linux/wii'
> make --no-print-directory -C /home/linkmauve/dev/linux/wii \
> -f /home/linkmauve/dev/linux/Makefile
> ln -fsn .. source
> # GEN     Makefile
>   { echo "# Automatically generated by /home/linkmauve/dev/linux/Makefile: don't edit"; echo "export KBUILD_OUTPUT = /home/linkmauve/dev/linux/wii"; echo "include /home/linkmauve/dev/linux/Makefile"; } > Makefile
> test -e .gitignore || \
> { echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
> make -f ../scripts/Makefile.build obj=arch/powerpc/kernel/syscalls all
> make -f ../scripts/Makefile.build obj=scripts/basic
> make -f ../scripts/Makefile.build obj=scripts/dtc
> make -f ../scripts/Makefile.build obj=scripts
> make -f ../scripts/Makefile.build obj=scripts/gcc-plugins \
> need-builtin= \
> need-modorder= \
>
> set -e; mkdir -p include/config/; trap "rm -f include/config/.tmp_kernel.release" EXIT; { ../scripts/setlocalversion ..; } > include/config/.tmp_kernel.release; if [ ! -r include/config/kernel.release ] || ! cmp -s include/config/kernel.release include/config/.tmp_kernel.release; then : '  UPD     include/config/kernel.release'; mv -f include/config/.tmp_kernel.release include/config/kernel.release; fi
> make -f ../scripts/Makefile.asm-headers obj=arch/powerpc/include/generated/uapi/asm \
> generic=include/uapi/asm-generic
> make -f ../scripts/Makefile.asm-headers obj=arch/powerpc/include/generated/asm \
> generic=include/asm-generic
> set -e; mkdir -p include/generated/uapi/linux/; trap "rm -f include/generated/uapi/linux/.tmp_version.h" EXIT; { 	if [ 0 -gt 255 ]; then echo \#define LINUX_VERSION_CODE 459007; else echo \#define LINUX_VERSION_CODE 458752; fi; echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))'; echo \#define LINUX_VERSION_MAJOR 7; echo \#define LINUX_VERSION_PATCHLEVEL 0; echo \#define LINUX_VERSION_SUBLEVEL 0; } > include/generated/uapi/linux/.tmp_version.h; if [ ! -r include/generated/uapi/linux/version.h ] || ! cmp -s include/generated/uapi/linux/version.h include/generated/uapi/linux/.tmp_version.h; then : '  UPD     include/generated/uapi/linux/version.h'; mv -f include/generated/uapi/linux/.tmp_version.h include/generated/uapi/linux/version.h; fi
> set -e; mkdir -p include/generated/; trap "rm -f include/generated/.tmp_utsrelease.h" EXIT; { 	if [ `echo -n "7.0.0-rc7-wii+" | wc -c ` -gt 64 ]; then echo '"7.0.0-rc7-wii+" exceeds 64 characters' >&2; exit 1; fi; echo \#define UTS_RELEASE \"7.0.0-rc7-wii+\"; } > include/generated/.tmp_utsrelease.h; if [ ! -r include/generated/utsrelease.h ] || ! cmp -s include/generated/utsrelease.h include/generated/.tmp_utsrelease.h; then : '  UPD     include/generated/utsrelease.h'; mv -f include/generated/.tmp_utsrelease.h include/generated/utsrelease.h; fi
> set -e; mkdir -p include/generated/; trap "rm -f include/generated/.tmp_compile.h" EXIT; { ../scripts/mkcompile_h "ppc" "powerpc-linux-musl-gcc (GCC) 14.2.1 20250405" "powerpc-linux-musl-ld"; } > include/generated/.tmp_compile.h; if [ ! -r include/generated/compile.h ] || ! cmp -s include/generated/compile.h include/generated/.tmp_compile.h; then : '  UPD     include/generated/compile.h'; mv -f include/generated/.tmp_compile.h include/generated/compile.h; fi
> ../scripts/remove-stale-files
> make -f ../scripts/Makefile.build obj=scripts/mod
> set -e; mkdir -p scripts/mod/; trap "rm -f scripts/mod/.tmp_devicetable-offsets.h" EXIT; { 	 echo "#ifndef __DEVICETABLE_OFFSETS_H__"; echo "#define __DEVICETABLE_OFFSETS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " */"; echo ""; sed -ne 	's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; /^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}' < scripts/mod/devicetable-offsets.s; echo ""; echo "#endif"; } > scripts/mod/.tmp_devicetable-offsets.h; if [ ! -r scripts/mod/devicetable-offsets.h ] || ! cmp -s scripts/mod/devicetable-offsets.h scripts/mod/.tmp_devicetable-offsets.h; then : '  UPD     scripts/mod/devicetable-offsets.h'; mv -f scripts/mod/.tmp_devicetable-offsets.h scripts/mod/devicetable-offsets.h; fi
> make -f ../scripts/Makefile.build obj=. prepare
> set -e; mkdir -p include/generated/; trap "rm -f include/generated/.tmp_timeconst.h" EXIT; { echo 1000 | bc -q ../kernel/time/timeconst.bc; } > include/generated/.tmp_timeconst.h; if [ ! -r include/generated/timeconst.h ] || ! cmp -s include/generated/timeconst.h include/generated/.tmp_timeconst.h; then : '  UPD     include/generated/timeconst.h'; mv -f include/generated/.tmp_timeconst.h include/generated/timeconst.h; fi
> set -e; mkdir -p include/generated/; trap "rm -f include/generated/.tmp_bounds.h" EXIT; { 	 echo "#ifndef __LINUX_BOUNDS_H__"; echo "#define __LINUX_BOUNDS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " */"; echo ""; sed -ne 	's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; /^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}' < kernel/bounds.s; echo ""; echo "#endif"; } > include/generated/.tmp_bounds.h; if [ ! -r include/generated/bounds.h ] || ! cmp -s include/generated/bounds.h include/generated/.tmp_bounds.h; then : '  UPD     include/generated/bounds.h'; mv -f include/generated/.tmp_bounds.h include/generated/bounds.h; fi
> set -e; mkdir -p include/generated/; trap "rm -f include/generated/.tmp_asm-offsets.h" EXIT; { 	 echo "#ifndef __ASM_OFFSETS_H__"; echo "#define __ASM_OFFSETS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " */"; echo ""; sed -ne 	's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; /^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}' < arch/powerpc/kernel/asm-offsets.s; echo ""; echo "#endif"; } > include/generated/.tmp_asm-offsets.h; if [ ! -r include/generated/asm-offsets.h ] || ! cmp -s include/generated/asm-offsets.h include/generated/.tmp_asm-offsets.h; then : '  UPD     include/generated/asm-offsets.h'; mv -f include/generated/.tmp_asm-offsets.h include/generated/asm-offsets.h; fi
> set -e; mkdir -p include/generated/; trap "rm -f include/generated/.tmp_rq-offsets.h" EXIT; { 	 echo "#ifndef __RQ_OFFSETS_H__"; echo "#define __RQ_OFFSETS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " */"; echo ""; sed -ne 	's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; /^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}' < kernel/sched/rq-offsets.s; echo ""; echo "#endif"; } > include/generated/.tmp_rq-offsets.h; if [ ! -r include/generated/rq-offsets.h ] || ! cmp -s include/generated/rq-offsets.h include/generated/.tmp_rq-offsets.h; then : '  UPD     include/generated/rq-offsets.h'; mv -f include/generated/.tmp_rq-offsets.h include/generated/rq-offsets.h; fi
> # CALL    ../scripts/checksyscalls.sh
>   sh ../scripts/checksyscalls.sh powerpc-linux-musl-gcc -Wp,-MMD,./.missing-syscalls.d -nostdinc -I../arch/powerpc/include -I./arch/powerpc/include/generated -I../include -I./include -I../arch/powerpc/include/uapi -I./arch/powerpc/include/generated/uapi -I../include/uapi -I./include/generated/uapi -include ../include/linux/compiler-version.h -include ../include/linux/kconfig.h -include ../include/linux/compiler_types.h -D__KERNEL__ -mbig-endian -m32 -I ../arch/powerpc -fmacro-prefix-map=../= -Wundef -DKBUILD_EXTRA_WARN1 -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -msoft-float -ffixed-r2 -mmultiple -mno-readonly-in-sdata -mcpu=powerpc -mno-prefixed -mno-pcrel -mno-altivec -mno-vsx -mno-mma -fno-asynchronous-unwind-tables -mno-string -mbig-endian -fno-delete-null-pointer-checks -Os -fno-allow-store-data-races -fno-stack-protector -fomit-frame-pointer -ftrivial-auto-var-init=zero -fno-stack-clash-protection -fmin-function-alignment=4 -fstrict-flex-arrays=3 -fms-extensions -fno-strict-overflow -fno-stack-check -fconserve-stack -fno-builtin-wcslen -Wall -Wextra -Wundef -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Werror=strict-prototypes -Wno-format-security -Wno-trigraphs -Wno-frame-address -Wno-address-of-packed-member -Wmissing-declarations -Wmissing-prototypes -Wframe-larger-than=1280 -Wno-main -Wno-type-limits -Wno-dangling-pointer -Wvla-larger-than=1 -Wno-pointer-sign -Wcast-function-type -Wno-array-bounds -Wno-stringop-overflow -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wenum-conversion -Wunused -Wmissing-format-attribute -Wmissing-include-dirs -Wunused-const-variable -Wno-missing-field-initializers -Wno-shift-negative-value -Wno-maybe-uninitialized -Wno-sign-compare -Wno-unused-parameter -DGCC_PLUGINS -I../. -I.    -DKBUILD_MODFILE='"./missing-syscalls"' -DKBUILD_BASENAME='"missing_syscalls"' -DKBUILD_MODNAME='"missing_syscalls"' -D__KBUILD_MODNAME=missing_syscalls
> make -f ../scripts/Makefile.build obj=arch/powerpc/kernel/vdso include/generated/vdso32-offsets.h
> mkdir -p ./tools
> make O=/home/linkmauve/dev/linux/wii subdir=tools -C ../tools/ objtool
> mkdir -p /home/linkmauve/dev/linux/wii/tools/objtool && make O=/home/linkmauve/dev/linux/wii subdir=tools/objtool --no-print-directory -C objtool
> make -C /home/linkmauve/dev/linux/tools/build CFLAGS= LDFLAGS= /home/linkmauve/dev/linux/wii/tools/objtool/fixdep
> if [ ! -f /home/linkmauve/dev/linux/wii/tools/objtool/fixdep ]; then						\
> 	make -f /home/linkmauve/dev/linux/tools/build/Makefile.build dir=. obj=fixdep HOSTCFLAGS="-Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu11   -I ../scripts/include";	\
> 	rm -f /home/linkmauve/dev/linux/wii/tools/objtool/fixdep.o;						\
> fi
> make -f /home/linkmauve/dev/linux/tools/build/Makefile.build dir=. obj=fixdep HOSTCFLAGS="-Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu11   -I ../scripts/include"
> make -C /home/linkmauve/dev/linux/tools/lib/subcmd/ O=/home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd \
> 	DESTDIR=/home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd prefix= subdir= \
> 	CC="gcc" LD="ld" AR="ar" EXTRA_CFLAGS="-std=gnu11 -fomit-frame-pointer -O2 -g -Werror -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations -Wwrite-strings -Wno-implicit-fallthrough -Wno-sign-compare -Wno-unused-parameter -I/home/linkmauve/dev/linux/tools/include -I/home/linkmauve/dev/linux/tools/include/uapi -I/home/linkmauve/dev/linux/tools/arch/x86/include/uapi -I/home/linkmauve/dev/linux/tools/arch/powerpc/include -I/home/linkmauve/dev/linux/tools/objtool/include -I/home/linkmauve/dev/linux/tools/objtool/arch/powerpc/include -I/home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd/include   " \
> 	/home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd/libsubcmd.a install_headers
> make -C /home/linkmauve/dev/linux/tools/build CFLAGS= LDFLAGS= /home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd/fixdep
> if [ ! -f /home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd/fixdep ]; then						\
> 	make -f /home/linkmauve/dev/linux/tools/build/Makefile.build dir=. obj=fixdep HOSTCFLAGS="-Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu11   -I ../scripts/include";	\
> 	rm -f /home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd/fixdep.o;						\
> fi
> make -f /home/linkmauve/dev/linux/tools/build/Makefile.build dir=. obj=fixdep HOSTCFLAGS="-Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu11   -I ../scripts/include"
> make[5]: 'install_headers' is up to date.
> sh ./sync-check.sh
> make -f /home/linkmauve/dev/linux/tools/build/Makefile.build dir=. obj=objtool CC="gcc" LD="ld" AR="ar" CFLAGS="-std=gnu11 -fomit-frame-pointer -O2 -g -Werror -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations -Wwrite-strings -Wno-implicit-fallthrough -Wno-sign-compare -Wno-unused-parameter -I/home/linkmauve/dev/linux/tools/include -I/home/linkmauve/dev/linux/tools/include/uapi -I/home/linkmauve/dev/linux/tools/arch/x86/include/uapi -I/home/linkmauve/dev/linux/tools/arch/powerpc/include -I/home/linkmauve/dev/linux/tools/objtool/include -I/home/linkmauve/dev/linux/tools/objtool/arch/powerpc/include -I/home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd/include   " \
> 	LDFLAGS="/home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd/libsubcmd.a -lelf  "
> make -f /home/linkmauve/dev/linux/tools/build/Makefile.build dir=./arch/powerpc obj=objtool
> sh ../scripts/rust_is_available.sh
> make -f ../scripts/Makefile.build obj=rust
> # RUSTC L rust/pin_init.o
>   OBJTREE=/home/linkmauve/dev/linux/wii rustc --edition=2021 -Zbinary_dep_depinfo=y -Astable_features -Aunused_features -Dnon_ascii_idents -Dunsafe_op_in_unsafe_fn -Wmissing_docs -Wrust_2018_idioms -Wunreachable_pub -Wclippy::all -Wclippy::as_ptr_cast_mut -Wclippy::as_underscore -Wclippy::cast_lossless -Wclippy::ignored_unit_patterns -Wclippy::mut_mut -Wclippy::needless_bitwise_bool -Aclippy::needless_lifetimes -Wclippy::no_mangle_with_rust_abi -Wclippy::ptr_as_ptr -Wclippy::ptr_cast_constness -Wclippy::ref_as_ptr -Wclippy::undocumented_unsafe_blocks -Wclippy::unnecessary_safety_comment -Wclippy::unnecessary_safety_doc -Wrustdoc::missing_crate_level_docs -Wrustdoc::unescaped_backticks -Cpanic=abort -Cembed-bitcode=n -Clto=n -Cforce-unwind-tables=n -Ccodegen-units=1 -Csymbol-mangling-version=v0 -Crelocation-model=static -Zfunction-sections=n -Wclippy::float_arithmetic --target=powerpc-unknown-linux-gnu -Copt-level=s -Cdebug-assertions=n -Coverflow-checks=y @./include/generated/rustc_cfg --extern pin_init_internal --extern macros --cfg='kernel' --emit=dep-info=rust/.pin_init.o.d --emit=obj=rust/pin_init.o --emit=metadata=rust/libpin_init.rmeta --crate-type rlib -L./rust --crate-name pin_init ../rust/pin-init/src/lib.rs --sysroot=/dev/null -Zunstable-options   ; ./tools/objtool/objtool --static-call   rust/pin_init.o

Looks like the command line here is missing -L./rust/host.

Mukesh, perhaps when you test locally you didn't clean out the already-built
files inside rust directory?

Best,
Gary

> error[E0463]: can't find crate for `pin_init_internal`
>    --> ../rust/pin-init/src/lib.rs:365:11
>     |
> 365 | pub use ::pin_init_internal::pin_data;
>     |           ^^^^^^^^^^^^^^^^^ can't find crate
>
> error: aborting due to 1 previous error
>
> For more information about this error, try `rustc --explain E0463`.
> make[3]: *** [../rust/Makefile:681: rust/pin_init.o] Error 1
> make[2]: *** [/home/linkmauve/dev/linux/Makefile:1343: prepare] Error 2
> make[1]: *** [/home/linkmauve/dev/linux/Makefile:248: __sub-make] Error 2
> make[1]: Leaving directory '/home/linkmauve/dev/linux/wii'
> make: *** [Makefile:248: __sub-make] Error 2
> make ARCH=powerpc CROSS_COMPILE=powerpc-linux-musl- O=wii W=1 V=1 -j1  1.15s user 0.56s system 100% cpu 1.695 total
> ```
>
>> 
>> Regards,
>> Mukesh
>> 
>> > > 
>> > > We are actively working with our LLVM team to get the target for ppc,
>> > > ppc64 and ppc64le in the rust compiler.
>> > > 
>> > > 
>> > > [1] https://lore.kernel.org/all/20260204030507.8203-1-linkmauve@linkmauve.fr
>> > > [2] https://lore.kernel.org/all/20260204042417.83903-1-mkchauras@gmail.com
>> > > 
>> > > Changelog:
>> > > V9 -> V10:
>> > > - rust/Makefile updated with review comments from Miguel
>> > > - Patch 1/4 updated with commit message and subject
>> > > V9: https://lore.kernel.org/all/20260404121610.1956528-1-mkchauras@gmail.com/
>> > > 
>> > > V8 -> V9:
>> > > - rust/Makefile updated with a directory instead of abspath
>> > > V8: https://lore.kernel.org/all/20260403145308.1042622-1-mkchauras@gmail.com/
>> > > 
>> > > V7 -> V8:
>> > > - rust/Makefile updated to separate host libraries from target
>> > > V7: https://lore.kernel.org/all/20260329160254.2592207-1-mkchauras@gmail.com/
>> > > 
>> > > Changelog:
>> > > V6 -> V7:
>> > > - Documentation removed as powerpc is still under development
>> > > - Added a fix for race condition in rust/Makefile
>> > > V6: https://lore.kernel.org/all/20260210090023.2587534-1-mkchauras@gmail.com
>> > > 
>> > > V5 -> V6:
>> > > - Added a missing Tested by from Venkat which got missed since V3
>> > > - Support is marked as Maintained instead of experimental
>> > > V5: https://lore.kernel.org/all/20260210053756.2088302-1-mkchauras@gmail.com
>> > > 
>> > > V4 -> V5:
>> > > - Removed a nested ifdef from PPC64 for Little endian toolchain
>> > > V4: https://lore.kernel.org/all/20260209105456.1551677-1-mkchauras@gmail.com
>> > > 
>> > > V3 -> V4:
>> > > - Co-developed-by header added in patch 1
>> > > V3: https://lore.kernel.org/all/20260205180429.3280657-1-mkchauras@gmail.com
>> > > 
>> > > V2 -> V3:
>> > > - Splited HAVE_RUST in 2 lines
>> > > - BINDGEN_TARGET_powerpc initialized before assigning the same to
>> > >   BINDGEN_TARGET
>> > > V2: https://lore.kernel.org/all/20260204210125.613350-1-mkchauras@gmail.com
>> > > 
>> > > V1 -> V2:
>> > > - jump label fix for rust has been moved to a separate patch
>> > > - PPC32 support has been taken
>> > > - rust support has been marked experimental
>> > > - target.json dependency has been removed
>> > > - HAVE_RUST now depends on CPU_LITTLE_ENDIAN for PPC64
>> > > 
>> > > Link Mauve (1):
>> > >   rust: Add PowerPC support
>> > > 
>> > > Mukesh Kumar Chaurasiya (IBM) (3):
>> > >   rust: Fix "multiple candidates for rmeta dependency core" error
>> > >   powerpc/jump_label: adjust inline asm to be consistent
>> > >   powerpc: Enable Rust for ppc64le
>> > > 
>> > >  arch/powerpc/Kconfig                  |  2 +
>> > >  arch/powerpc/Makefile                 |  7 +++
>> > >  arch/powerpc/include/asm/jump_label.h | 23 ++++++----
>> > >  rust/Makefile                         | 66 ++++++++++++++++-----------
>> > >  4 files changed, 61 insertions(+), 37 deletions(-)
>> > > 
>> > > -- 
>> > > 2.53.0
>> > > 
>> > > 
>> > 
>> > -- 
>> > Link Mauve
>> > 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH V10 0/4] Rust support for powerpc [RESEND]
  2026-04-08 14:00       ` Gary Guo
@ 2026-04-08 14:15         ` Mukesh Kumar Chaurasiya
  0 siblings, 0 replies; 9+ messages in thread
From: Mukesh Kumar Chaurasiya @ 2026-04-08 14:15 UTC (permalink / raw)
  To: Gary Guo
  Cc: Link Mauve, maddy, mpe, npiggin, chleroy, peterz, jpoimboe,
	jbaron, aliceryhl, rostedt, ardb, ojeda, boqun, bjorn3_gh, lossin,
	a.hindborg, tmgross, dakr, nathan, nick.desaulniers+lkml, morbo,
	justinstitt, linuxppc-dev, linux-kernel, rust-for-linux, llvm

On Wed, Apr 08, 2026 at 03:00:23PM +0100, Gary Guo wrote:
> On Wed Apr 8, 2026 at 2:19 PM BST, Link Mauve wrote:
> > On Wed, Apr 08, 2026 at 05:23:39PM +0530, Mukesh Kumar Chaurasiya wrote:
> >> On Wed, Apr 08, 2026 at 11:51:40AM +0200, Link Mauve wrote:
> >> > Hi,
> >> > 
> >> > (This email is a resent, my IP address got flagged by spamhaus again
> >> > because I’m on a residential range, hopefully this incident is
> >> > resolved…)
> >> > 
> >> > On Tue, Apr 07, 2026 at 01:31:45AM +0530, Mukesh Kumar Chaurasiya (IBM) wrote:
> >> > > Enable experimental rust support for ppc64le and ppc32be. The patch for
> >> > > ppc32 has been provided by Link Mauve[1] and ppc64le support[2] has been
> >> > > merged over it. ppc32 needs some toolchain fixes mentioned in the patch
> >> > > `rust: Add PowerPC support` and the discussion for that is done here[1].
> >> > > 
> >> > > This has been tested on
> >> > > - powernv9 hardware
> >> > > - pseries P11 hardware
> >> > > - pseries(9, 10) qemu
> >> > > - powernv(9, 10) qemu
> >> > > - rustdoc on x86 and powerpc64le
> >> > > - rusttest on x86 and powerpc64le
> >> > 
> >> > I just tested your series for the Wii, so targeting powerpc (32, be),
> >> > and got this error:
> >> > ```
> >> > error[E0463]: can't find crate for `pin_init_internal`
> >> >    --> ../rust/pin-init/src/lib.rs:365:11
> >> >     |
> >> > 365 | pub use ::pin_init_internal::pin_data;
> >> >     |           ^^^^^^^^^^^^^^^^^ can't find crate
> >> > 
> >> > error: aborting due to 1 previous error
> >> > 
> >> > For more information about this error, try `rustc --explain E0463`.
> >> > ```
> >> > 
> >> > I didn’t get this error in a previous version of your series, would you
> >> > want me to bisect them?
> >> > 
> >> > Thanks for your continuous work on it anyway!
> >> > 
> >> 
> >> Hey Link,
> >> 
> >> Thanks for testing this.
> >> 
> >> Can you give me the command generated via make with V=1
> >> e.g. `make LLVM=1 V=1`
> >
> > Here it is:
> > ```
> > % make ARCH=powerpc CROSS_COMPILE=powerpc-linux-musl- O=wii W=1 V=1 -j1
> > make  -C /home/linkmauve/dev/linux/wii \
> > -f /home/linkmauve/dev/linux/Makefile
> > make[1]: Entering directory '/home/linkmauve/dev/linux/wii'
> > make --no-print-directory -C /home/linkmauve/dev/linux/wii \
> > -f /home/linkmauve/dev/linux/Makefile
> > ln -fsn .. source
> > # GEN     Makefile
> >   { echo "# Automatically generated by /home/linkmauve/dev/linux/Makefile: don't edit"; echo "export KBUILD_OUTPUT = /home/linkmauve/dev/linux/wii"; echo "include /home/linkmauve/dev/linux/Makefile"; } > Makefile
> > test -e .gitignore || \
> > { echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
> > make -f ../scripts/Makefile.build obj=arch/powerpc/kernel/syscalls all
> > make -f ../scripts/Makefile.build obj=scripts/basic
> > make -f ../scripts/Makefile.build obj=scripts/dtc
> > make -f ../scripts/Makefile.build obj=scripts
> > make -f ../scripts/Makefile.build obj=scripts/gcc-plugins \
> > need-builtin= \
> > need-modorder= \
> >
> > set -e; mkdir -p include/config/; trap "rm -f include/config/.tmp_kernel.release" EXIT; { ../scripts/setlocalversion ..; } > include/config/.tmp_kernel.release; if [ ! -r include/config/kernel.release ] || ! cmp -s include/config/kernel.release include/config/.tmp_kernel.release; then : '  UPD     include/config/kernel.release'; mv -f include/config/.tmp_kernel.release include/config/kernel.release; fi
> > make -f ../scripts/Makefile.asm-headers obj=arch/powerpc/include/generated/uapi/asm \
> > generic=include/uapi/asm-generic
> > make -f ../scripts/Makefile.asm-headers obj=arch/powerpc/include/generated/asm \
> > generic=include/asm-generic
> > set -e; mkdir -p include/generated/uapi/linux/; trap "rm -f include/generated/uapi/linux/.tmp_version.h" EXIT; { 	if [ 0 -gt 255 ]; then echo \#define LINUX_VERSION_CODE 459007; else echo \#define LINUX_VERSION_CODE 458752; fi; echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))'; echo \#define LINUX_VERSION_MAJOR 7; echo \#define LINUX_VERSION_PATCHLEVEL 0; echo \#define LINUX_VERSION_SUBLEVEL 0; } > include/generated/uapi/linux/.tmp_version.h; if [ ! -r include/generated/uapi/linux/version.h ] || ! cmp -s include/generated/uapi/linux/version.h include/generated/uapi/linux/.tmp_version.h; then : '  UPD     include/generated/uapi/linux/version.h'; mv -f include/generated/uapi/linux/.tmp_version.h include/generated/uapi/linux/version.h; fi
> > set -e; mkdir -p include/generated/; trap "rm -f include/generated/.tmp_utsrelease.h" EXIT; { 	if [ `echo -n "7.0.0-rc7-wii+" | wc -c ` -gt 64 ]; then echo '"7.0.0-rc7-wii+" exceeds 64 characters' >&2; exit 1; fi; echo \#define UTS_RELEASE \"7.0.0-rc7-wii+\"; } > include/generated/.tmp_utsrelease.h; if [ ! -r include/generated/utsrelease.h ] || ! cmp -s include/generated/utsrelease.h include/generated/.tmp_utsrelease.h; then : '  UPD     include/generated/utsrelease.h'; mv -f include/generated/.tmp_utsrelease.h include/generated/utsrelease.h; fi
> > set -e; mkdir -p include/generated/; trap "rm -f include/generated/.tmp_compile.h" EXIT; { ../scripts/mkcompile_h "ppc" "powerpc-linux-musl-gcc (GCC) 14.2.1 20250405" "powerpc-linux-musl-ld"; } > include/generated/.tmp_compile.h; if [ ! -r include/generated/compile.h ] || ! cmp -s include/generated/compile.h include/generated/.tmp_compile.h; then : '  UPD     include/generated/compile.h'; mv -f include/generated/.tmp_compile.h include/generated/compile.h; fi
> > ../scripts/remove-stale-files
> > make -f ../scripts/Makefile.build obj=scripts/mod
> > set -e; mkdir -p scripts/mod/; trap "rm -f scripts/mod/.tmp_devicetable-offsets.h" EXIT; { 	 echo "#ifndef __DEVICETABLE_OFFSETS_H__"; echo "#define __DEVICETABLE_OFFSETS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " */"; echo ""; sed -ne 	's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; /^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}' < scripts/mod/devicetable-offsets.s; echo ""; echo "#endif"; } > scripts/mod/.tmp_devicetable-offsets.h; if [ ! -r scripts/mod/devicetable-offsets.h ] || ! cmp -s scripts/mod/devicetable-offsets.h scripts/mod/.tmp_devicetable-offsets.h; then : '  UPD     scripts/mod/devicetable-offsets.h'; mv -f scripts/mod/.tmp_devicetable-offsets.h scripts/mod/devicetable-offsets.h; fi
> > make -f ../scripts/Makefile.build obj=. prepare
> > set -e; mkdir -p include/generated/; trap "rm -f include/generated/.tmp_timeconst.h" EXIT; { echo 1000 | bc -q ../kernel/time/timeconst.bc; } > include/generated/.tmp_timeconst.h; if [ ! -r include/generated/timeconst.h ] || ! cmp -s include/generated/timeconst.h include/generated/.tmp_timeconst.h; then : '  UPD     include/generated/timeconst.h'; mv -f include/generated/.tmp_timeconst.h include/generated/timeconst.h; fi
> > set -e; mkdir -p include/generated/; trap "rm -f include/generated/.tmp_bounds.h" EXIT; { 	 echo "#ifndef __LINUX_BOUNDS_H__"; echo "#define __LINUX_BOUNDS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " */"; echo ""; sed -ne 	's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; /^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}' < kernel/bounds.s; echo ""; echo "#endif"; } > include/generated/.tmp_bounds.h; if [ ! -r include/generated/bounds.h ] || ! cmp -s include/generated/bounds.h include/generated/.tmp_bounds.h; then : '  UPD     include/generated/bounds.h'; mv -f include/generated/.tmp_bounds.h include/generated/bounds.h; fi
> > set -e; mkdir -p include/generated/; trap "rm -f include/generated/.tmp_asm-offsets.h" EXIT; { 	 echo "#ifndef __ASM_OFFSETS_H__"; echo "#define __ASM_OFFSETS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " */"; echo ""; sed -ne 	's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; /^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}' < arch/powerpc/kernel/asm-offsets.s; echo ""; echo "#endif"; } > include/generated/.tmp_asm-offsets.h; if [ ! -r include/generated/asm-offsets.h ] || ! cmp -s include/generated/asm-offsets.h include/generated/.tmp_asm-offsets.h; then : '  UPD     include/generated/asm-offsets.h'; mv -f include/generated/.tmp_asm-offsets.h include/generated/asm-offsets.h; fi
> > set -e; mkdir -p include/generated/; trap "rm -f include/generated/.tmp_rq-offsets.h" EXIT; { 	 echo "#ifndef __RQ_OFFSETS_H__"; echo "#define __RQ_OFFSETS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " */"; echo ""; sed -ne 	's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; /^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}' < kernel/sched/rq-offsets.s; echo ""; echo "#endif"; } > include/generated/.tmp_rq-offsets.h; if [ ! -r include/generated/rq-offsets.h ] || ! cmp -s include/generated/rq-offsets.h include/generated/.tmp_rq-offsets.h; then : '  UPD     include/generated/rq-offsets.h'; mv -f include/generated/.tmp_rq-offsets.h include/generated/rq-offsets.h; fi
> > # CALL    ../scripts/checksyscalls.sh
> >   sh ../scripts/checksyscalls.sh powerpc-linux-musl-gcc -Wp,-MMD,./.missing-syscalls.d -nostdinc -I../arch/powerpc/include -I./arch/powerpc/include/generated -I../include -I./include -I../arch/powerpc/include/uapi -I./arch/powerpc/include/generated/uapi -I../include/uapi -I./include/generated/uapi -include ../include/linux/compiler-version.h -include ../include/linux/kconfig.h -include ../include/linux/compiler_types.h -D__KERNEL__ -mbig-endian -m32 -I ../arch/powerpc -fmacro-prefix-map=../= -Wundef -DKBUILD_EXTRA_WARN1 -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -msoft-float -ffixed-r2 -mmultiple -mno-readonly-in-sdata -mcpu=powerpc -mno-prefixed -mno-pcrel -mno-altivec -mno-vsx -mno-mma -fno-asynchronous-unwind-tables -mno-string -mbig-endian -fno-delete-null-pointer-checks -Os -fno-allow-store-data-races -fno-stack-protector -fomit-frame-pointer -ftrivial-auto-var-init=zero -fno-stack-clash-protection -fmin-function-alignment=4 -fstrict-flex-arrays=3 -fms-extensions -fno-strict-overflow -fno-stack-check -fconserve-stack -fno-builtin-wcslen -Wall -Wextra -Wundef -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Werror=strict-prototypes -Wno-format-security -Wno-trigraphs -Wno-frame-address -Wno-address-of-packed-member -Wmissing-declarations -Wmissing-prototypes -Wframe-larger-than=1280 -Wno-main -Wno-type-limits -Wno-dangling-pointer -Wvla-larger-than=1 -Wno-pointer-sign -Wcast-function-type -Wno-array-bounds -Wno-stringop-overflow -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wenum-conversion -Wunused -Wmissing-format-attribute -Wmissing-include-dirs -Wunused-const-variable -Wno-missing-field-initializers -Wno-shift-negative-value -Wno-maybe-uninitialized -Wno-sign-compare -Wno-unused-parameter -DGCC_PLUGINS -I../. -I.    -DKBUILD_MODFILE='"./missing-syscalls"' -DKBUILD_BASENAME='"missing_syscalls"' -DKBUILD_MODNAME='"missing_syscalls"' -D__KBUILD_MODNAME=missing_syscalls
> > make -f ../scripts/Makefile.build obj=arch/powerpc/kernel/vdso include/generated/vdso32-offsets.h
> > mkdir -p ./tools
> > make O=/home/linkmauve/dev/linux/wii subdir=tools -C ../tools/ objtool
> > mkdir -p /home/linkmauve/dev/linux/wii/tools/objtool && make O=/home/linkmauve/dev/linux/wii subdir=tools/objtool --no-print-directory -C objtool
> > make -C /home/linkmauve/dev/linux/tools/build CFLAGS= LDFLAGS= /home/linkmauve/dev/linux/wii/tools/objtool/fixdep
> > if [ ! -f /home/linkmauve/dev/linux/wii/tools/objtool/fixdep ]; then						\
> > 	make -f /home/linkmauve/dev/linux/tools/build/Makefile.build dir=. obj=fixdep HOSTCFLAGS="-Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu11   -I ../scripts/include";	\
> > 	rm -f /home/linkmauve/dev/linux/wii/tools/objtool/fixdep.o;						\
> > fi
> > make -f /home/linkmauve/dev/linux/tools/build/Makefile.build dir=. obj=fixdep HOSTCFLAGS="-Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu11   -I ../scripts/include"
> > make -C /home/linkmauve/dev/linux/tools/lib/subcmd/ O=/home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd \
> > 	DESTDIR=/home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd prefix= subdir= \
> > 	CC="gcc" LD="ld" AR="ar" EXTRA_CFLAGS="-std=gnu11 -fomit-frame-pointer -O2 -g -Werror -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations -Wwrite-strings -Wno-implicit-fallthrough -Wno-sign-compare -Wno-unused-parameter -I/home/linkmauve/dev/linux/tools/include -I/home/linkmauve/dev/linux/tools/include/uapi -I/home/linkmauve/dev/linux/tools/arch/x86/include/uapi -I/home/linkmauve/dev/linux/tools/arch/powerpc/include -I/home/linkmauve/dev/linux/tools/objtool/include -I/home/linkmauve/dev/linux/tools/objtool/arch/powerpc/include -I/home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd/include   " \
> > 	/home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd/libsubcmd.a install_headers
> > make -C /home/linkmauve/dev/linux/tools/build CFLAGS= LDFLAGS= /home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd/fixdep
> > if [ ! -f /home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd/fixdep ]; then						\
> > 	make -f /home/linkmauve/dev/linux/tools/build/Makefile.build dir=. obj=fixdep HOSTCFLAGS="-Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu11   -I ../scripts/include";	\
> > 	rm -f /home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd/fixdep.o;						\
> > fi
> > make -f /home/linkmauve/dev/linux/tools/build/Makefile.build dir=. obj=fixdep HOSTCFLAGS="-Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu11   -I ../scripts/include"
> > make[5]: 'install_headers' is up to date.
> > sh ./sync-check.sh
> > make -f /home/linkmauve/dev/linux/tools/build/Makefile.build dir=. obj=objtool CC="gcc" LD="ld" AR="ar" CFLAGS="-std=gnu11 -fomit-frame-pointer -O2 -g -Werror -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations -Wwrite-strings -Wno-implicit-fallthrough -Wno-sign-compare -Wno-unused-parameter -I/home/linkmauve/dev/linux/tools/include -I/home/linkmauve/dev/linux/tools/include/uapi -I/home/linkmauve/dev/linux/tools/arch/x86/include/uapi -I/home/linkmauve/dev/linux/tools/arch/powerpc/include -I/home/linkmauve/dev/linux/tools/objtool/include -I/home/linkmauve/dev/linux/tools/objtool/arch/powerpc/include -I/home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd/include   " \
> > 	LDFLAGS="/home/linkmauve/dev/linux/wii/tools/objtool/libsubcmd/libsubcmd.a -lelf  "
> > make -f /home/linkmauve/dev/linux/tools/build/Makefile.build dir=./arch/powerpc obj=objtool
> > sh ../scripts/rust_is_available.sh
> > make -f ../scripts/Makefile.build obj=rust
> > # RUSTC L rust/pin_init.o
> >   OBJTREE=/home/linkmauve/dev/linux/wii rustc --edition=2021 -Zbinary_dep_depinfo=y -Astable_features -Aunused_features -Dnon_ascii_idents -Dunsafe_op_in_unsafe_fn -Wmissing_docs -Wrust_2018_idioms -Wunreachable_pub -Wclippy::all -Wclippy::as_ptr_cast_mut -Wclippy::as_underscore -Wclippy::cast_lossless -Wclippy::ignored_unit_patterns -Wclippy::mut_mut -Wclippy::needless_bitwise_bool -Aclippy::needless_lifetimes -Wclippy::no_mangle_with_rust_abi -Wclippy::ptr_as_ptr -Wclippy::ptr_cast_constness -Wclippy::ref_as_ptr -Wclippy::undocumented_unsafe_blocks -Wclippy::unnecessary_safety_comment -Wclippy::unnecessary_safety_doc -Wrustdoc::missing_crate_level_docs -Wrustdoc::unescaped_backticks -Cpanic=abort -Cembed-bitcode=n -Clto=n -Cforce-unwind-tables=n -Ccodegen-units=1 -Csymbol-mangling-version=v0 -Crelocation-model=static -Zfunction-sections=n -Wclippy::float_arithmetic --target=powerpc-unknown-linux-gnu -Copt-level=s -Cdebug-assertions=n -Coverflow-checks=y @./include/generated/rustc_cfg --extern pin_init_internal --extern macros --cfg='kernel' --emit=dep-info=rust/.pin_init.o.d --emit=obj=rust/pin_init.o --emit=metadata=rust/libpin_init.rmeta --crate-type rlib -L./rust --crate-name pin_init ../rust/pin-init/src/lib.rs --sysroot=/dev/null -Zunstable-options   ; ./tools/objtool/objtool --static-call   rust/pin_init.o
>
Thanks Link.

> Looks like the command line here is missing -L./rust/host.
> 
Yeah, got the fix for it. Stupid mistake.
Will send out a new revision.
Thanks though.

Regards,
Mukesh
> Mukesh, perhaps when you test locally you didn't clean out the already-built
> files inside rust directory?
> 
> Best,
> Gary
>
> > error[E0463]: can't find crate for `pin_init_internal`
> >    --> ../rust/pin-init/src/lib.rs:365:11
> >     |
> > 365 | pub use ::pin_init_internal::pin_data;
> >     |           ^^^^^^^^^^^^^^^^^ can't find crate
> >
> > error: aborting due to 1 previous error
> >
> > For more information about this error, try `rustc --explain E0463`.
> > make[3]: *** [../rust/Makefile:681: rust/pin_init.o] Error 1
> > make[2]: *** [/home/linkmauve/dev/linux/Makefile:1343: prepare] Error 2
> > make[1]: *** [/home/linkmauve/dev/linux/Makefile:248: __sub-make] Error 2
> > make[1]: Leaving directory '/home/linkmauve/dev/linux/wii'
> > make: *** [Makefile:248: __sub-make] Error 2
> > make ARCH=powerpc CROSS_COMPILE=powerpc-linux-musl- O=wii W=1 V=1 -j1  1.15s user 0.56s system 100% cpu 1.695 total
> > ```
> >
> >> 
> >> Regards,
> >> Mukesh
> >> 
> >> > > 
> >> > > We are actively working with our LLVM team to get the target for ppc,
> >> > > ppc64 and ppc64le in the rust compiler.
> >> > > 
> >> > > 
> >> > > [1] https://lore.kernel.org/all/20260204030507.8203-1-linkmauve@linkmauve.fr
> >> > > [2] https://lore.kernel.org/all/20260204042417.83903-1-mkchauras@gmail.com
> >> > > 
> >> > > Changelog:
> >> > > V9 -> V10:
> >> > > - rust/Makefile updated with review comments from Miguel
> >> > > - Patch 1/4 updated with commit message and subject
> >> > > V9: https://lore.kernel.org/all/20260404121610.1956528-1-mkchauras@gmail.com/
> >> > > 
> >> > > V8 -> V9:
> >> > > - rust/Makefile updated with a directory instead of abspath
> >> > > V8: https://lore.kernel.org/all/20260403145308.1042622-1-mkchauras@gmail.com/
> >> > > 
> >> > > V7 -> V8:
> >> > > - rust/Makefile updated to separate host libraries from target
> >> > > V7: https://lore.kernel.org/all/20260329160254.2592207-1-mkchauras@gmail.com/
> >> > > 
> >> > > Changelog:
> >> > > V6 -> V7:
> >> > > - Documentation removed as powerpc is still under development
> >> > > - Added a fix for race condition in rust/Makefile
> >> > > V6: https://lore.kernel.org/all/20260210090023.2587534-1-mkchauras@gmail.com
> >> > > 
> >> > > V5 -> V6:
> >> > > - Added a missing Tested by from Venkat which got missed since V3
> >> > > - Support is marked as Maintained instead of experimental
> >> > > V5: https://lore.kernel.org/all/20260210053756.2088302-1-mkchauras@gmail.com
> >> > > 
> >> > > V4 -> V5:
> >> > > - Removed a nested ifdef from PPC64 for Little endian toolchain
> >> > > V4: https://lore.kernel.org/all/20260209105456.1551677-1-mkchauras@gmail.com
> >> > > 
> >> > > V3 -> V4:
> >> > > - Co-developed-by header added in patch 1
> >> > > V3: https://lore.kernel.org/all/20260205180429.3280657-1-mkchauras@gmail.com
> >> > > 
> >> > > V2 -> V3:
> >> > > - Splited HAVE_RUST in 2 lines
> >> > > - BINDGEN_TARGET_powerpc initialized before assigning the same to
> >> > >   BINDGEN_TARGET
> >> > > V2: https://lore.kernel.org/all/20260204210125.613350-1-mkchauras@gmail.com
> >> > > 
> >> > > V1 -> V2:
> >> > > - jump label fix for rust has been moved to a separate patch
> >> > > - PPC32 support has been taken
> >> > > - rust support has been marked experimental
> >> > > - target.json dependency has been removed
> >> > > - HAVE_RUST now depends on CPU_LITTLE_ENDIAN for PPC64
> >> > > 
> >> > > Link Mauve (1):
> >> > >   rust: Add PowerPC support
> >> > > 
> >> > > Mukesh Kumar Chaurasiya (IBM) (3):
> >> > >   rust: Fix "multiple candidates for rmeta dependency core" error
> >> > >   powerpc/jump_label: adjust inline asm to be consistent
> >> > >   powerpc: Enable Rust for ppc64le
> >> > > 
> >> > >  arch/powerpc/Kconfig                  |  2 +
> >> > >  arch/powerpc/Makefile                 |  7 +++
> >> > >  arch/powerpc/include/asm/jump_label.h | 23 ++++++----
> >> > >  rust/Makefile                         | 66 ++++++++++++++++-----------
> >> > >  4 files changed, 61 insertions(+), 37 deletions(-)
> >> > > 
> >> > > -- 
> >> > > 2.53.0
> >> > > 
> >> > > 
> >> > 
> >> > -- 
> >> > Link Mauve
> >> > 
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-04-08 14:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-06 20:01 [PATCH V10 0/4] Rust support for powerpc Mukesh Kumar Chaurasiya (IBM)
2026-04-06 20:01 ` [PATCH V10 1/4] rust: Separate host libraries to fix rmeta dependency conflict Mukesh Kumar Chaurasiya (IBM)
2026-04-06 20:01 ` [PATCH V10 2/4] powerpc/jump_label: adjust inline asm to be consistent Mukesh Kumar Chaurasiya (IBM)
2026-04-06 20:01 ` [PATCH V10 3/4] rust: Add PowerPC support Mukesh Kumar Chaurasiya (IBM)
2026-04-06 20:01 ` [PATCH V10 4/4] powerpc: Enable Rust for ppc64le Mukesh Kumar Chaurasiya (IBM)
     [not found] ` <adYlLLfRgSyxus3n@luna>
2026-04-08 11:53   ` [PATCH V10 0/4] Rust support for powerpc [RESEND] Mukesh Kumar Chaurasiya
2026-04-08 13:19     ` Link Mauve
2026-04-08 14:00       ` Gary Guo
2026-04-08 14:15         ` Mukesh Kumar Chaurasiya

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox