Re: [PATCH v1] tools build: Fix feature test for rust compiler
From: Miguel Ojeda
Date: Wed Feb 11 2026 - 05:45:20 EST
On Wed, Feb 11, 2026 at 10:58 AM Dmitrii Dolgov <9erthalion6@xxxxxxxxx> wrote:
>
> Currently a dummy rust code is compiled to detect if the rust feature
> could be enabled. It turns out that in this case rust emits a dependency
> file without any external references:
>
> /perf/feature/test-rust.d: test-rust.rs
>
> /perf/feature/test-rust.bin: test-rust.rs
>
> test-rust.rs:
>
> This can lead to a situation, when rustc was removed after a successful build,
> but the build process still thinks it's there and the feature is enabled on
> subsequent runs.
>
> Instead simply check the compiler presence to detect the feature, as
> suggested by Arnaldo Carvalho de Melo. This way no actual test-rust.bin
> will be created, meaning the feature check will not be cached and always
> performed. That's exactly what we want, and the overhead of doing this
> every time is minimal.
>
> Tested with multiple rounds of install/remove of the rust package.
>
> Signed-off-by: Dmitrii Dolgov <9erthalion6@xxxxxxxxx>
Not sure if Kbuild covers this given it is `tools/`, but just in case
given the `MAINTAINERS` file, Cc'ing them, as well as rust-for-linux
since we try to use it as an index of Rust-related things there within
the kernel.
I hope that helps.
Cheers,
Miguel