]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rust: arch: um: Fix building 32-bit UML with GCC
authorDavid Gow <david@davidgow.net>
Sat, 25 Apr 2026 03:41:23 +0000 (11:41 +0800)
committerMiguel Ojeda <ojeda@kernel.org>
Thu, 30 Apr 2026 20:40:57 +0000 (22:40 +0200)
32-bit UML builds can be configured either by setting CONFIG_64BIT=n or
with SUBARCH=i386. Both work with Rust-for-Linux when clang is the
compiler, but when SUBARCH=i386, we don't set a bindgen target correctly if
gcc is the compiler.

Add the appropriate bindgen target configuration for i386, as is done in
Makefile.clang.

[ For reference, the errors look like:

        BINDGEN rust/bindings/bindings_generated.rs
      error: unsupported option '-mno-sse' for target ''
      ...
      error: unknown target triple 'unknown'
      panicked at .../bindgen-0.72.1/ir/context.rs:562:15:
      libclang error; possible causes include:
      ...

    - Miguel ]

Fixes: ab0f4cedc355 ("arch: um: rust: Add i386 support for Rust")
Signed-off-by: David Gow <david@davidgow.net>
Link: https://patch.msgid.link/20260425034125.53866-1-david@davidgow.net
[ Added space in title. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/Makefile

index b361bfedfdf07a7bacd2e93ee4e0fc7c9d08b6b0..b9e9f512cec3143a9ed69cbb4fbb286ebaab5a3f 100644 (file)
@@ -403,6 +403,8 @@ 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
+# This is only for i386 UM builds, which need the 32-bit target not -m32
+BINDGEN_TARGET_i386    := i386-linux-gnu
 BINDGEN_TARGET_um      := $(BINDGEN_TARGET_$(SUBARCH))
 BINDGEN_TARGET         := $(BINDGEN_TARGET_$(SRCARCH))