Re: [PATCH 1/2] rust: kbuild: treat `build_error` and `rustdoc` as kernel objects
From: Miguel Ojeda
Date: Mon Nov 03 2025 - 18:06:13 EST
On Sun, Nov 2, 2025 at 10:30 PM Miguel Ojeda <ojeda@xxxxxxxxxx> wrote:
>
> Even if normally `build_error` isn't a kernel object, it should still
> be treated as such so that we pass the same flags. Similarly, `rustdoc`
> targets are never kernel objects, but we need to treat them as such.
>
> Otherwise, starting with Rust 1.91.0 (released 2025-10-30), `rustc`
> will complain about missing sanitizer flags since `-Zsanitizer` is a
> target modifier too [1]:
>
> error: mixing `-Zsanitizer` will cause an ABI mismatch in crate `build_error`
> --> rust/build_error.rs:3:1
> |
> 3 | //! Build-time error.
> | ^
> |
> = help: the `-Zsanitizer` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely
> = note: unset `-Zsanitizer` in this crate is incompatible with `-Zsanitizer=kernel-address` in dependency `core`
> = help: set `-Zsanitizer=kernel-address` in this crate or unset `-Zsanitizer` in `core`
> = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitizer` to silence this error
>
> Thus explicitly mark them as kernel objects.
>
> Cc: stable@xxxxxxxxxxxxxxx # Needed in 6.12.y and later (Rust is pinned in older LTSs).
> Link: https://github.com/rust-lang/rust/pull/138736 [1]
> Signed-off-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
Applied series to `rust-fixes` -- thanks everyone!
I will send another less urgent one for 1.92.0 (in beta now) that goes
on top of these here.
Cheers,
Miguel