Re: [PATCH v6] kbuild: host: use single executable for rustc -C linker

From: Mohamad Alsadhan

Date: Thu Apr 16 2026 - 17:01:15 EST


Apologies for getting back to you late, I was busy with other things
and I wanted to double-check things before replying.

On 26/04/01 07:53am, Yoann Congal wrote:
>
> Does using "scripts/" without a $(obj)/$(srctree)/... prefix always works?
> I know I've suggested this as a quick fix. But I did not think about it
> a lot.
>

You're in fact correct, it's not always correct. Thanks for pointing
it out :)

I assumed it was fine since the top-level build runs the scripts pass
before rust/, and existing Kbuild commands commonly refer to generated
tools under scripts/ using paths relative to the object tree.

That misses some cases:

- On e.g. ARM64 with `CONFIG_RUST_KERNEL_DOCTESTS=n`, no Rust hostprog
may be built in `scripts/`, so `scripts/rustc-wrapper` may never be
generated before `rust/Makefile` needs it.

- `scripts/Makefile.host` is also used outside `scripts/`. For example,
`samples/rust/hostprogs/` generates
`samples/rust/hostprogs/rustc-wrapper`, but the hardcoded path
made rustc look for `scripts/rustc-wrapper`.

A v7 patch is on the way that should fix this issue, by always
generating `scripts/rustc-wrapper` for `CONFIG_RUST=y` and using
`$(obj)/rustc-wrapper` for generic host Rust builds (+ some little
hardening and cleaning).

Best regards,
Mo