Re: [PATCH 1/2] rust: pass correct target to bindgen on Usermode Linux
From: David Gow
Date: Mon Feb 10 2025 - 05:57:06 EST
On Sat, 8 Feb 2025 at 21:32, Thomas Weißschuh <linux@xxxxxxxxxxxxxx> wrote:
>
> 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>
> ---
(+cc linux-um, but I assume this will probably go in via the Rust tree, anyway.)
Thanks very much: this is enough to get Rust-for-Linux working with
gcc under 64-bit UML on my system.
However, this is actually a bit of a coincidence -- and there are
still some issues with 32-bit UML -- as the UML Rust flags are
currently conditionally set if CC_IS_CLANG. This is my fault (it was
to work around some bugs with older gcc), and I've sent a patch[1] to
fix it. (Though note that 32-bit UML/Rust still hits issues with
atomics in the block driver, so you'll need to disable that for now.)
Regardless, this is a significant improvement, thanks!
Reviewed-by: David Gow <davidgow@xxxxxxxxxx>
Thanks,
-- David
[1]: https://lore.kernel.org/rust-for-linux/20250210105353.2238769-2-davidgow@xxxxxxxxxx/
> 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
>
>