[PATCH 1/2] rust: pass correct target to bindgen on Usermode Linux

From: Thomas Weißschuh
Date: Sat Feb 08 2025 - 08:32:47 EST


Usermode Linux uses "um" as primary architecture name and the underlying
physical architecture is provided in "SUBARCH".
Resolve the target architecture flags through that underlying architecture.
This is the same pattern as used by scripts/Makefile.clang from which
the bindgen flags are derived.

Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
---
rust/Makefile | 1 +
1 file changed, 1 insertion(+)

diff --git a/rust/Makefile b/rust/Makefile
index 8fcfd60447bc89ba2c66a4f341288db2387b0956..a94fafb91d7d743c6c1b2248479c0d723964e5c4 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -245,6 +245,7 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
# Derived from `scripts/Makefile.clang`.
BINDGEN_TARGET_x86 := x86_64-linux-gnu
BINDGEN_TARGET_arm64 := aarch64-linux-gnu
+BINDGEN_TARGET_um := $(BINDGEN_TARGET_$(SUBARCH))
BINDGEN_TARGET := $(BINDGEN_TARGET_$(SRCARCH))

# All warnings are inhibited since GCC builds are very experimental,

--
2.48.1