Re: [PATCH v1] tools build: Fix rust cross compilation

From: Miguel Ojeda

Date: Mon Feb 16 2026 - 15:41:54 EST


On Fri, Feb 13, 2026 at 8:12 PM Dmitrii Dolgov <9erthalion6@xxxxxxxxx> wrote:
>
> Currently no target is specified to compile rust code when needed, which
> breaks cross compilation. Detect required target and pass it via
> rust_flags to the compiler.
>
> Note that CROSS_COMPILE might be different from what rust compiler
> expects, since it may omit the target vendor value, e.g.
> "aarch64-linux-gnu" instead of "aarch64-unknown-linux-gnu". Thus
> explicitly map supported CROSS_COMPILE values to corresponding Rust
> versions, as suggested by Miguel Ojeda.
>
> Tested using arm64 cross-compilation example from [1].
>
> [1]: https://perfwiki.github.io/main/arm64-cross-compilation-dockerfile/
>
> Signed-off-by: Dmitrii Dolgov <9erthalion6@xxxxxxxxx>

I think this was meant to v2.

By the way, should this have a Fixes: tag? i.e. since it sounds like
this fixes an issue. Perhaps to 6a32fa5ccd33 ("tools build: Add a
feature test for rust compiler"), or something else? I also usually
recommend showing the error message in the commit message.

(Also, you can use "Link: ... [1]" for the link.)

Cc'ing Kbuild maintainers too.

I hope that helps!

Cheers,
Miguel