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 <[email protected]>
Tested-by: Link Mauve <[email protected]>

Reply via email to