Enabling rust support for ppc64le only.
Tested on powernv9:
$ uname -rm
6.19.0-rc8+ ppc64le
$ sudo modprobe rust_minimal
[ 632.890850] rust_minimal: Rust minimal sample (init)
[ 632.890881] rust_minimal: Am I built-in? false
[ 632.890898] rust_minimal: test_parameter: 1
$ sudo rmmod rust_minimal
[ 648.272832] rust_minimal: My numbers are [72, 108, 200]
[ 648.272873] rust_minimal: Rust minimal sample (exit)
$ sudo modprobe rust_print
[ 843.410391] rust_print: Rust printing macros sample (init)
[ 843.410424] rust_print: Emergency message (level 0) without args
[ 843.410451] rust_print: Alert message (level 1) without args
[ 843.410477] rust_print: Critical message (level 2) without args
[ 843.410503] rust_print: Error message (level 3) without args
[ 843.410530] rust_print: Warning message (level 4) without args
[ 843.410557] rust_print: Notice message (level 5) without args
[ 843.410594] rust_print: Info message (level 6) without args
[ 843.410617] rust_print: A line that is continued without args
[ 843.410646] rust_print: Emergency message (level 0) with args
[ 843.410675] rust_print: Alert message (level 1) with args
[ 843.410691] rust_print: Critical message (level 2) with args
[ 843.410727] rust_print: Error message (level 3) with args
[ 843.410761] rust_print: Warning message (level 4) with args
[ 843.410796] rust_print: Notice message (level 5) with args
[ 843.410821] rust_print: Info message (level 6) with args
[ 843.410854] rust_print: A line that is continued with args
[ 843.410892] rust_print: 1
[ 843.410895] rust_print: "hello, world"
[ 843.410924] rust_print: [samples/rust/rust_print_main.rs:35:5] c = "hello, world"
[ 843.410977] rust_print: Arc<dyn Display> says 42
[ 843.410979] rust_print: Arc<dyn Display> says hello, world
$ sudo rmmod rust_print
[ 843.411003] rust_print: "hello, world"
[ 888.499935] rust_print: Rust printing macros sample (exit)
Signed-off-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com>
---
Documentation/rust/arch-support.rst | 2 +-
arch/powerpc/Kconfig | 2 +-
arch/powerpc/Makefile | 9 ++++++++-
rust/Makefile | 9 ++++++++-
4 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/Documentation/rust/arch-support.rst b/Documentation/rust/arch-support.rst
index e26a94808e97..627471ac9238 100644
--- a/Documentation/rust/arch-support.rst
+++ b/Documentation/rust/arch-support.rst
@@ -18,7 +18,7 @@ Architecture Level of support Constraints
``arm`` Maintained ARMv7 Little Endian only.
``arm64`` Maintained Little Endian only.
``loongarch`` Maintained \-
-``powerpc`` Experimental 32-bit Big Endian only.
+``powerpc`` Experimental 64-bit Little Endian. 32-bit Big Endian.
``riscv`` Maintained ``riscv64`` and LLVM/Clang only.
``um`` Maintained \-
``x86`` Maintained ``x86_64`` only.
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 17db23b82e91..c5dd03713af2 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -283,7 +283,7 @@ config PPC
select HAVE_REGS_AND_STACK_ACCESS_API
select HAVE_RELIABLE_STACKTRACE
select HAVE_RSEQ
- select HAVE_RUST if PPC32
+ select HAVE_RUST if PPC32 || (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 9fd82c75dcbd..f93816ddc036 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -61,7 +61,14 @@ else
KBUILD_LDFLAGS_MODULE += $(objtree)/arch/powerpc/lib/crtsavres.o
endif
-KBUILD_RUSTFLAGS += --target=powerpc-unknown-linux-gnu
+ifdef CONFIG_PPC64
+ifdef CONFIG_CPU_LITTLE_ENDIAN
+KBUILD_RUSTFLAGS += --target=powerpc64le-unknown-linux-gnu
+endif
+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 ae22f2c5f0b3..c3961fd0d9a4 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -392,10 +392,17 @@ 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))
+ifdef CONFIG_PPC64
+ifdef CONFIG_CPU_LITTLE_ENDIAN
+BINDGEN_TARGET_powerpc := powerpc64le-linux-gnu
+endif
+else
+BINDGEN_TARGET_powerpc := powerpc-linux-gnu
+endif
+
# All warnings are inhibited since GCC builds are very experimental,
# many GCC warnings are not supported by Clang, they may only appear in
# some configurations, with new GCC versions, etc.
--
2.52.0
On Thu, Feb 05, 2026 at 02:31:25AM +0530, Mukesh Kumar Chaurasiya (IBM) wrote: […] > diff --git a/rust/Makefile b/rust/Makefile > index ae22f2c5f0b3..c3961fd0d9a4 100644 > --- a/rust/Makefile > +++ b/rust/Makefile > @@ -392,10 +392,17 @@ 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)) > > +ifdef CONFIG_PPC64 > +ifdef CONFIG_CPU_LITTLE_ENDIAN > +BINDGEN_TARGET_powerpc := powerpc64le-linux-gnu > +endif > +else > +BINDGEN_TARGET_powerpc := powerpc-linux-gnu > +endif You define BINDGEN_TARGET_powerpc after BINDGEN_TARGET has been set to the value of $(BINDGEN_TARGET_$(SRCARCH)), so it is empty and bindgen then gets passed --target= which makes it fail here, with this error message: ``` bindgen ../rust/bindings/bindings_helper.h --blocklist-type __kernel_s?size_t --blocklist-type __kernel_ptrdiff_t --opaque-type xregs_state --opaque-type desc_struct --opaque-type arch_lbr_state --opaque-type local_apic --opaque-type alt_instr --opaque-type x86_msi_data --opaque-type x86_msi_addr_lo --opaque-type kunit_try_catch --opaque-type spinlock --no-doc-comments --blocklist-function __list_.*_report --blocklist-item ARCH_SLAB_MINALIGN --blocklist-item ARCH_KMALLOC_MINALIGN --with-derive-custom-struct .*=MaybeZeroable --with-derive-custom-union .*=MaybeZeroable --rust-target 1.68 --use-core --with-derive-default --ctypes-prefix ffi --no-layout-tests --no-debug '.*' --enable-function-attribute-detection -o rust/bindings/bindings_generated.rs -- -Wp,-MMD,rust/bindings/.bindings_generated.rs.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=../= -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -msoft-float -mcpu=powerpc -mno-prefixed -mno-pcrel -mno-altivec -mno-vsx -mno-mma -fno-asynchronous-unwind-tables -mbig-endian -fno-delete-null-pointer-checks -Os -fno-stack-protector -fomit-frame-pointer -ftrivial-auto-var-init=zero -fno-strict-overflow -fno-stack-check -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-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 -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-packed-not-aligned -Wno-format-overflow -Wno-format-truncation -Wno-stringop-truncation -Wno-override-init -Wno-missing-field-initializers -Wno-type-limits -Wno-shift-negative-value -Wno-maybe-uninitialized -Wno-sign-compare -Wno-unused-parameter -DGCC_PLUGINS -I../rust -Irust -DKBUILD_MODFILE='"rust/bindings_generated"' -DKBUILD_BASENAME='"bindings_generated"' -DKBUILD_MODNAME='"bindings_generated"' -D__KBUILD_MODNAME=kmod_bindings_generated -w --target= -fno-builtin -D__BINDGEN__ -DMODULE ; sed -Ei 's/pub const RUST_CONST_HELPER_([a-zA-Z0-9_]*)/pub const /g' rust/bindings/bindings_generated.rs error: unsupported option '-mbig-endian' for target '' error: unsupported option '-mcpu=' for target '' error: unsupported option '-mno-prefixed' for target '' error: unsupported option '-mno-pcrel' for target '' error: unsupported option '-mno-altivec' for target '' error: unsupported option '-mno-vsx' for target '' error: unsupported option '-mno-mma' for target '' error: unsupported option '-mbig-endian' for target '' error: unknown target triple 'unknown' panicked at bindgen/ir/context.rs:562:15: libclang error; possible causes include: - Invalid flag syntax - Unrecognized flags - Invalid flag arguments - File I/O errors - Host vs. target architecture mismatch If you encounter an error missing from this list, please file an issue or a PR! ``` Did this work on PPC64? > + > # All warnings are inhibited since GCC builds are very experimental, > # many GCC warnings are not supported by Clang, they may only appear in > # some configurations, with new GCC versions, etc. > -- > 2.52.0 > With this fixed: Reviewed-by: Link Mauve <linkmauve@linkmauve.fr> Tested-by: Link Mauve <linkmauve@linkmauve.fr> -- Link Mauve
On Thu, Feb 05, 2026 at 02:52:12PM +0100, Link Mauve wrote: > On Thu, Feb 05, 2026 at 02:31:25AM +0530, Mukesh Kumar Chaurasiya (IBM) wrote: > […] > > diff --git a/rust/Makefile b/rust/Makefile > > index ae22f2c5f0b3..c3961fd0d9a4 100644 > > --- a/rust/Makefile > > +++ b/rust/Makefile > > @@ -392,10 +392,17 @@ 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)) > > > > +ifdef CONFIG_PPC64 > > +ifdef CONFIG_CPU_LITTLE_ENDIAN > > +BINDGEN_TARGET_powerpc := powerpc64le-linux-gnu > > +endif > > +else > > +BINDGEN_TARGET_powerpc := powerpc-linux-gnu > > +endif > > You define BINDGEN_TARGET_powerpc after BINDGEN_TARGET has been set to > the value of $(BINDGEN_TARGET_$(SRCARCH)), so it is empty and bindgen > then gets passed --target= which makes it fail here, with this error > message: I am able to compile it and boot it on ppc64le qemu pseries and powernv9 hardware. I agree this might cause an issue. Will fix this and send out a new revision. > ``` > bindgen ../rust/bindings/bindings_helper.h --blocklist-type __kernel_s?size_t --blocklist-type __kernel_ptrdiff_t --opaque-type xregs_state --opaque-type desc_struct --opaque-type arch_lbr_state --opaque-type local_apic --opaque-type alt_instr --opaque-type x86_msi_data --opaque-type x86_msi_addr_lo --opaque-type kunit_try_catch --opaque-type spinlock --no-doc-comments --blocklist-function __list_.*_report --blocklist-item ARCH_SLAB_MINALIGN --blocklist-item ARCH_KMALLOC_MINALIGN --with-derive-custom-struct .*=MaybeZeroable --with-derive-custom-union .*=MaybeZeroable --rust-target 1.68 --use-core --with-derive-default --ctypes-prefix ffi --no-layout-tests --no-debug '.*' --enable-function-attribute-detection -o rust/bindings/bindings_generated.rs -- -Wp,-MMD,rust/bindings/.bindings_generated.rs.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=../= -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -msoft-float -mcpu=powerpc -mno-prefixed -mno-pcrel -mno-altivec -mno-vsx -mno-mma -fno-asynchronous-unwind-tables -mbig-endian -fno-delete-null-pointer-checks -Os -fno-stack-protector -fomit-frame-pointer -ftrivial-auto-var-init=zero -fno-strict-overflow -fno-stack-check -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-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 -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-packed-not-aligned -Wno-format-overflow -Wno-format-truncation -Wno-stringop-truncation -Wno-override-init -Wno-missing-field-initializers -Wno-type-limits -Wno-shift-negative-value -Wno-maybe-uninitialized -Wno-sign-compare -Wno-unused-parameter -DGCC_PLUGINS -I../rust -Irust -DKBUILD_MODFILE='"rust/bindings_generated"' -DKBUILD_BASENAME='"bindings_generated"' -DKBUILD_MODNAME='"bindings_generated"' -D__KBUILD_MODNAME=kmod_bindings_generated -w --target= -fno-builtin -D__BINDGEN__ -DMODULE ; sed -Ei 's/pub const RUST_CONST_HELPER_([a-zA-Z0-9_]*)/pub const /g' rust/bindings/bindings_generated.rs > error: unsupported option '-mbig-endian' for target '' > error: unsupported option '-mcpu=' for target '' > error: unsupported option '-mno-prefixed' for target '' > error: unsupported option '-mno-pcrel' for target '' > error: unsupported option '-mno-altivec' for target '' > error: unsupported option '-mno-vsx' for target '' > error: unsupported option '-mno-mma' for target '' > error: unsupported option '-mbig-endian' for target '' > error: unknown target triple 'unknown' > panicked at bindgen/ir/context.rs:562:15: > libclang error; possible causes include: > - Invalid flag syntax > - Unrecognized flags > - Invalid flag arguments > - File I/O errors > - Host vs. target architecture mismatch > If you encounter an error missing from this list, please file an issue or a PR! > ``` > > Did this work on PPC64? > ppc64be still has some missing things from the toolchain side. For ppc64le it does works, atleast on powernv9 hardware and pseries POWER10 qemu. > > + > > # All warnings are inhibited since GCC builds are very experimental, > > # many GCC warnings are not supported by Clang, they may only appear in > > # some configurations, with new GCC versions, etc. > > -- > > 2.52.0 > > > > With this fixed: > Reviewed-by: Link Mauve <linkmauve@linkmauve.fr> > Tested-by: Link Mauve <linkmauve@linkmauve.fr> > Thanks. Regards, Mukesh > -- > Link Mauve
On 05/02/26 7:22 pm, Link Mauve wrote: > On Thu, Feb 05, 2026 at 02:31:25AM +0530, Mukesh Kumar Chaurasiya (IBM) wrote: > […] >> diff --git a/rust/Makefile b/rust/Makefile >> index ae22f2c5f0b3..c3961fd0d9a4 100644 >> --- a/rust/Makefile >> +++ b/rust/Makefile >> @@ -392,10 +392,17 @@ 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)) >> >> +ifdef CONFIG_PPC64 >> +ifdef CONFIG_CPU_LITTLE_ENDIAN >> +BINDGEN_TARGET_powerpc := powerpc64le-linux-gnu >> +endif >> +else >> +BINDGEN_TARGET_powerpc := powerpc-linux-gnu >> +endif > You define BINDGEN_TARGET_powerpc after BINDGEN_TARGET has been set to > the value of $(BINDGEN_TARGET_$(SRCARCH)), so it is empty and bindgen > then gets passed --target= which makes it fail here, with this error > message: > ``` > bindgen ../rust/bindings/bindings_helper.h --blocklist-type __kernel_s?size_t --blocklist-type __kernel_ptrdiff_t --opaque-type xregs_state --opaque-type desc_struct --opaque-type arch_lbr_state --opaque-type local_apic --opaque-type alt_instr --opaque-type x86_msi_data --opaque-type x86_msi_addr_lo --opaque-type kunit_try_catch --opaque-type spinlock --no-doc-comments --blocklist-function __list_.*_report --blocklist-item ARCH_SLAB_MINALIGN --blocklist-item ARCH_KMALLOC_MINALIGN --with-derive-custom-struct .*=MaybeZeroable --with-derive-custom-union .*=MaybeZeroable --rust-target 1.68 --use-core --with-derive-default --ctypes-prefix ffi --no-layout-tests --no-debug '.*' --enable-function-attribute-detection -o rust/bindings/bindings_generated.rs -- -Wp,-MMD,rust/bindings/.bindings_generated.rs.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=../= -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -msoft-float -mcpu=powerpc -mno-prefixed -mno-pcrel -mno-altivec -mno-vsx -mno-mma -fno-asynchronous-unwind-tables -mbig-endian -fno-delete-null-pointer-checks -Os -fno-stack-protector -fomit-frame-pointer -ftrivial-auto-var-init=zero -fno-strict-overflow -fno-stack-check -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-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 -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-packed-not-aligned -Wno-format-overflow -Wno-format-truncation -Wno-stringop-truncation -Wno-override-init -Wno-missing-field-initializers -Wno-type-limits -Wno-shift-negative-value -Wno-maybe-uninitialized -Wno-sign-compare -Wno-unused-parameter -DGCC_PLUGINS -I../rust -Irust -DKBUILD_MODFILE='"rust/bindings_generated"' -DKBUILD_BASENAME='"bindings_generated"' -DKBUILD_MODNAME='"bindings_generated"' -D__KBUILD_MODNAME=kmod_bindings_generated -w --target= -fno-builtin -D__BINDGEN__ -DMODULE ; sed -Ei 's/pub const RUST_CONST_HELPER_([a-zA-Z0-9_]*)/pub const /g' rust/bindings/bindings_generated.rs > error: unsupported option '-mbig-endian' for target '' > error: unsupported option '-mcpu=' for target '' > error: unsupported option '-mno-prefixed' for target '' > error: unsupported option '-mno-pcrel' for target '' > error: unsupported option '-mno-altivec' for target '' > error: unsupported option '-mno-vsx' for target '' > error: unsupported option '-mno-mma' for target '' > error: unsupported option '-mbig-endian' for target '' > error: unknown target triple 'unknown' > panicked at bindgen/ir/context.rs:562:15: > libclang error; possible causes include: > - Invalid flag syntax > - Unrecognized flags > - Invalid flag arguments > - File I/O errors > - Host vs. target architecture mismatch > If you encounter an error missing from this list, please file an issue or a PR! > ``` > > Did this work on PPC64? On ppc64le, I am not able to get a successful Rust‑enabled build yet. I am consistently hitting bindgen/libclang failures during the prepare phase. Build Failures: error: unsupported option '-mlong-double-128' for target 'unknown' error: unsupported argument 'medium' to option '-mcmodel=' for target 'unknown' error: unknown target triple 'unknown' panicked at bindgen-0.72.1/ir/context.rs:562:15: libclang error; possible causes include: - Invalid flag syntax - Unrecognized flags - Invalid flag arguments - File I/O errors - Host vs. target architecture mismatch make[2]: *** [rust/Makefile:468: rust/bindings/bindings_generated.rs] Error 101 make[2]: *** Deleting file 'rust/bindings/bindings_generated.rs' make[2]: *** [rust/Makefile:488: rust/bindings/bindings_helpers_generated.rs] Error 101 make[2]: *** Deleting file 'rust/bindings/bindings_helpers_generated.rs' make[2]: *** [rust/Makefile:474: rust/uapi/uapi_generated.rs] Error 101 make[2]: *** Deleting file 'rust/uapi/uapi_generated.rs' make[2]: *** [rust/Makefile:643: rust/core.o] Error 1 make[1]: *** [/root/linux/Makefile:1320: prepare] Error 2 make: *** [Makefile:248: __sub-make] Error 2 Regards, Venkat. >> + >> # All warnings are inhibited since GCC builds are very experimental, >> # many GCC warnings are not supported by Clang, they may only appear in >> # some configurations, with new GCC versions, etc. >> -- >> 2.52.0 >> > With this fixed: > Reviewed-by: Link Mauve <linkmauve@linkmauve.fr> > Tested-by: Link Mauve <linkmauve@linkmauve.fr> >
On Thu, Feb 05, 2026 at 08:21:31PM +0530, Venkat Rao Bagalkote wrote: > > On 05/02/26 7:22 pm, Link Mauve wrote: > > On Thu, Feb 05, 2026 at 02:31:25AM +0530, Mukesh Kumar Chaurasiya (IBM) wrote: > > […] > > > diff --git a/rust/Makefile b/rust/Makefile > > > index ae22f2c5f0b3..c3961fd0d9a4 100644 > > > --- a/rust/Makefile > > > +++ b/rust/Makefile > > > @@ -392,10 +392,17 @@ 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)) > > > +ifdef CONFIG_PPC64 > > > +ifdef CONFIG_CPU_LITTLE_ENDIAN > > > +BINDGEN_TARGET_powerpc := powerpc64le-linux-gnu > > > +endif > > > +else > > > +BINDGEN_TARGET_powerpc := powerpc-linux-gnu > > > +endif > > You define BINDGEN_TARGET_powerpc after BINDGEN_TARGET has been set to > > the value of $(BINDGEN_TARGET_$(SRCARCH)), so it is empty and bindgen > > then gets passed --target= which makes it fail here, with this error > > message: > > ``` > > bindgen ../rust/bindings/bindings_helper.h --blocklist-type __kernel_s?size_t --blocklist-type __kernel_ptrdiff_t --opaque-type xregs_state --opaque-type desc_struct --opaque-type arch_lbr_state --opaque-type local_apic --opaque-type alt_instr --opaque-type x86_msi_data --opaque-type x86_msi_addr_lo --opaque-type kunit_try_catch --opaque-type spinlock --no-doc-comments --blocklist-function __list_.*_report --blocklist-item ARCH_SLAB_MINALIGN --blocklist-item ARCH_KMALLOC_MINALIGN --with-derive-custom-struct .*=MaybeZeroable --with-derive-custom-union .*=MaybeZeroable --rust-target 1.68 --use-core --with-derive-default --ctypes-prefix ffi --no-layout-tests --no-debug '.*' --enable-function-attribute-detection -o rust/bindings/bindings_generated.rs -- -Wp,-MMD,rust/bindings/.bindings_generated.rs.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=../= -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -msoft-float -mcpu=powerpc -mno-prefixed -mno-pcrel -mno-altivec -mno-vsx -mno-mma -fno-asynchronous-unwind-tables -mbig-endian -fno-delete-null-pointer-checks -Os -fno-stack-protector -fomit-frame-pointer -ftrivial-auto-var-init=zero -fno-strict-overflow -fno-stack-check -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-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 -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-packed-not-aligned -Wno-format-overflow -Wno-format-truncation -Wno-stringop-truncation -Wno-override-init -Wno-missing-field-initializers -Wno-type-limits -Wno-shift-negative-value -Wno-maybe-uninitialized -Wno-sign-compare -Wno-unused-parameter -DGCC_PLUGINS -I../rust -Irust -DKBUILD_MODFILE='"rust/bindings_generated"' -DKBUILD_BASENAME='"bindings_generated"' -DKBUILD_MODNAME='"bindings_generated"' -D__KBUILD_MODNAME=kmod_bindings_generated -w --target= -fno-builtin -D__BINDGEN__ -DMODULE ; sed -Ei 's/pub const RUST_CONST_HELPER_([a-zA-Z0-9_]*)/pub const /g' rust/bindings/bindings_generated.rs > > error: unsupported option '-mbig-endian' for target '' > > error: unsupported option '-mcpu=' for target '' > > error: unsupported option '-mno-prefixed' for target '' > > error: unsupported option '-mno-pcrel' for target '' > > error: unsupported option '-mno-altivec' for target '' > > error: unsupported option '-mno-vsx' for target '' > > error: unsupported option '-mno-mma' for target '' > > error: unsupported option '-mbig-endian' for target '' > > error: unknown target triple 'unknown' > > panicked at bindgen/ir/context.rs:562:15: > > libclang error; possible causes include: > > - Invalid flag syntax > > - Unrecognized flags > > - Invalid flag arguments > > - File I/O errors > > - Host vs. target architecture mismatch > > If you encounter an error missing from this list, please file an issue or a PR! > > ``` > > > > Did this work on PPC64? > > On ppc64le, I am not able to get a successful Rust‑enabled build yet. > I am consistently hitting bindgen/libclang failures during the prepare > phase. > > > Build Failures: > > error: unsupported option '-mlong-double-128' for target 'unknown' > error: unsupported argument 'medium' to option '-mcmodel=' for target > 'unknown' > error: unknown target triple 'unknown' > panicked at bindgen-0.72.1/ir/context.rs:562:15: > libclang error; possible causes include: > - Invalid flag syntax > - Unrecognized flags > - Invalid flag arguments > - File I/O errors > - Host vs. target architecture mismatch > > make[2]: *** [rust/Makefile:468: rust/bindings/bindings_generated.rs] Error > 101 > make[2]: *** Deleting file 'rust/bindings/bindings_generated.rs' > > make[2]: *** [rust/Makefile:488: > rust/bindings/bindings_helpers_generated.rs] Error 101 > make[2]: *** Deleting file 'rust/bindings/bindings_helpers_generated.rs' > > make[2]: *** [rust/Makefile:474: rust/uapi/uapi_generated.rs] Error 101 > make[2]: *** Deleting file 'rust/uapi/uapi_generated.rs' > > make[2]: *** [rust/Makefile:643: rust/core.o] Error 1 > make[1]: *** [/root/linux/Makefile:1320: prepare] Error 2 > make: *** [Makefile:248: __sub-make] Error 2 > > > Regards, > > Venkat. > hey, use rust version nightly-2026-01-28 the latest one has some issue. I just raised a bug for the rustc here[1]. [1] https://github.com/rust-lang/rust/issues/152177 Regards, Mukesh > > > + > > > # All warnings are inhibited since GCC builds are very experimental, > > > # many GCC warnings are not supported by Clang, they may only appear in > > > # some configurations, with new GCC versions, etc. > > > -- > > > 2.52.0 > > > > > With this fixed: > > Reviewed-by: Link Mauve <linkmauve@linkmauve.fr> > > Tested-by: Link Mauve <linkmauve@linkmauve.fr> > >
On Thu, Feb 5, 2026 at 6:29 PM Mukesh Kumar Chaurasiya <mkchauras@gmail.com> wrote: > > use rust version nightly-2026-01-28 > > the latest one has some issue. I just raised a bug for the rustc > here[1]. > > [1] https://github.com/rust-lang/rust/issues/152177 It appears to be a bug in LLVM 22 for ppc64, not present in 21. If I understand correctly, then it may be fixed in 22.1.9 if it gets released. Thanks Jubilee for the quick reply there! Cc'ing Clang/LLVM build support, in case they didn't hear about it. I linked it in our usual lists. Cheers, Miguel
On Thu, Feb 05, 2026 at 08:34:27PM +0100, Miguel Ojeda wrote: > On Thu, Feb 5, 2026 at 6:29 PM Mukesh Kumar Chaurasiya > <mkchauras@gmail.com> wrote: > > > > use rust version nightly-2026-01-28 > > > > the latest one has some issue. I just raised a bug for the rustc > > here[1]. > > > > [1] https://github.com/rust-lang/rust/issues/152177 > > It appears to be a bug in LLVM 22 for ppc64, not present in 21. > > If I understand correctly, then it may be fixed in 22.1.9 if it gets released. > > Thanks Jubilee for the quick reply there! > > Cc'ing Clang/LLVM build support, in case they didn't hear about it. Thanks for the CC, I had not seen that issue. LLVM 22 is currently in the -rc phase and I see that the fix has been merged into the release/22.x branch as of yesterday so it should be in LLVM 21.1.0-rc3 when it get released on February 10. LLVM 21.1.8 was the last release of the 21.x series (hard to keep up with all the numbers...) and it sounds like this is only a regression from the LLVM 22 development cycle. Cheers, Nathan
On Thu, Feb 5, 2026 at 9:02 PM Nathan Chancellor <nathan@kernel.org> wrote: > > Thanks for the CC, I had not seen that issue. LLVM 22 is currently in > the -rc phase and I see that the fix has been merged into the > release/22.x branch as of yesterday so it should be in LLVM 21.1.0-rc3 > when it get released on February 10. LLVM 21.1.8 was the last release of > the 21.x series (hard to keep up with all the numbers...) and it sounds > like this is only a regression from the LLVM 22 development cycle. Yeah, sorry, mixed up 21.1.9 with the potential 22.1.9 in summer this year, bah! Fixed my comment in the issue to avoid confusion. Thanks! Cheers, Miguel
Le 04/02/2026 à 22:01, Mukesh Kumar Chaurasiya (IBM) a écrit : > [Vous ne recevez pas souvent de courriers de mkchauras@gmail.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ] > > Enabling rust support for ppc64le only. > > Tested on powernv9: > > $ uname -rm > 6.19.0-rc8+ ppc64le > > $ sudo modprobe rust_minimal > [ 632.890850] rust_minimal: Rust minimal sample (init) > [ 632.890881] rust_minimal: Am I built-in? false > [ 632.890898] rust_minimal: test_parameter: 1 > > $ sudo rmmod rust_minimal > [ 648.272832] rust_minimal: My numbers are [72, 108, 200] > [ 648.272873] rust_minimal: Rust minimal sample (exit) > > $ sudo modprobe rust_print > [ 843.410391] rust_print: Rust printing macros sample (init) > [ 843.410424] rust_print: Emergency message (level 0) without args > [ 843.410451] rust_print: Alert message (level 1) without args > [ 843.410477] rust_print: Critical message (level 2) without args > [ 843.410503] rust_print: Error message (level 3) without args > [ 843.410530] rust_print: Warning message (level 4) without args > [ 843.410557] rust_print: Notice message (level 5) without args > [ 843.410594] rust_print: Info message (level 6) without args > [ 843.410617] rust_print: A line that is continued without args > [ 843.410646] rust_print: Emergency message (level 0) with args > [ 843.410675] rust_print: Alert message (level 1) with args > [ 843.410691] rust_print: Critical message (level 2) with args > [ 843.410727] rust_print: Error message (level 3) with args > [ 843.410761] rust_print: Warning message (level 4) with args > [ 843.410796] rust_print: Notice message (level 5) with args > [ 843.410821] rust_print: Info message (level 6) with args > [ 843.410854] rust_print: A line that is continued with args > [ 843.410892] rust_print: 1 > [ 843.410895] rust_print: "hello, world" > [ 843.410924] rust_print: [samples/rust/rust_print_main.rs:35:5] c = "hello, world" > [ 843.410977] rust_print: Arc<dyn Display> says 42 > [ 843.410979] rust_print: Arc<dyn Display> says hello, world > > $ sudo rmmod rust_print > [ 843.411003] rust_print: "hello, world" > [ 888.499935] rust_print: Rust printing macros sample (exit) > > Signed-off-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com> Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org> Small comment below > --- > Documentation/rust/arch-support.rst | 2 +- > arch/powerpc/Kconfig | 2 +- > arch/powerpc/Makefile | 9 ++++++++- > rust/Makefile | 9 ++++++++- > 4 files changed, 18 insertions(+), 4 deletions(-) > > diff --git a/Documentation/rust/arch-support.rst b/Documentation/rust/arch-support.rst > index e26a94808e97..627471ac9238 100644 > --- a/Documentation/rust/arch-support.rst > +++ b/Documentation/rust/arch-support.rst > @@ -18,7 +18,7 @@ Architecture Level of support Constraints > ``arm`` Maintained ARMv7 Little Endian only. > ``arm64`` Maintained Little Endian only. > ``loongarch`` Maintained \- > -``powerpc`` Experimental 32-bit Big Endian only. > +``powerpc`` Experimental 64-bit Little Endian. 32-bit Big Endian. > ``riscv`` Maintained ``riscv64`` and LLVM/Clang only. > ``um`` Maintained \- > ``x86`` Maintained ``x86_64`` only. > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig > index 17db23b82e91..c5dd03713af2 100644 > --- a/arch/powerpc/Kconfig > +++ b/arch/powerpc/Kconfig > @@ -283,7 +283,7 @@ config PPC > select HAVE_REGS_AND_STACK_ACCESS_API > select HAVE_RELIABLE_STACKTRACE > select HAVE_RSEQ > - select HAVE_RUST if PPC32 > + select HAVE_RUST if PPC32 || (PPC64 && CPU_LITTLE_ENDIAN) Would be better to leave the first line as is and add a second line as follows: 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 9fd82c75dcbd..f93816ddc036 100644 > --- a/arch/powerpc/Makefile > +++ b/arch/powerpc/Makefile > @@ -61,7 +61,14 @@ else > KBUILD_LDFLAGS_MODULE += $(objtree)/arch/powerpc/lib/crtsavres.o > endif > > -KBUILD_RUSTFLAGS += --target=powerpc-unknown-linux-gnu > +ifdef CONFIG_PPC64 > +ifdef CONFIG_CPU_LITTLE_ENDIAN > +KBUILD_RUSTFLAGS += --target=powerpc64le-unknown-linux-gnu > +endif > +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 ae22f2c5f0b3..c3961fd0d9a4 100644 > --- a/rust/Makefile > +++ b/rust/Makefile > @@ -392,10 +392,17 @@ 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)) > > +ifdef CONFIG_PPC64 > +ifdef CONFIG_CPU_LITTLE_ENDIAN > +BINDGEN_TARGET_powerpc := powerpc64le-linux-gnu > +endif > +else > +BINDGEN_TARGET_powerpc := powerpc-linux-gnu > +endif > + > # All warnings are inhibited since GCC builds are very experimental, > # many GCC warnings are not supported by Clang, they may only appear in > # some configurations, with new GCC versions, etc. > -- > 2.52.0 >
© 2016 - 2026 Red Hat, Inc.