Skip to content

Commit 926d536

Browse files
committed
rust: workaround rustdoc target modifiers bug
Starting with Rust 1.88.0 (released 2025-06-26), `rustdoc` complains about a target modifier mismatch in configurations where `-Zfixed-x18` is passed: error: mixing `-Zfixed-x18` will cause an ABI mismatch in crate `rust_out` | = help: the `-Zfixed-x18` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely = note: unset `-Zfixed-x18` in this crate is incompatible with `-Zfixed-x18=` in dependency `core` = help: set `-Zfixed-x18=` in this crate or unset `-Zfixed-x18` in `core` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=fixed-x18` to silence this error The reason is that `rustdoc` was not passing the target modifiers when configuring the session options, and thus it would report a mismatch that did not exist as soon as a target modifier is used in a dependency. We did not notice it in the kernel until now because `-Zfixed-x18` has been a target modifier only since 1.88.0 (and it is the only one we use so far). The issue has been reported upstream [1] and a fix has been submitted [2], including a test similar to the kernel case. Meanwhile, conditionally pass `-Cunsafe-allow-abi-mismatch=fixed-x18` to workaround the issue on our side. Reported-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Closes: https://lore.kernel.org/rust-for-linux/36cdc798-524f-4910-8b77-d7b9fac08d77@oss.qualcomm.com/ Link: rust-lang/rust#144521 [1] Link: rust-lang/rust#144523 [2] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent 89be9a8 commit 926d536

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

rust/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $<
7474
-Zunstable-options --generate-link-to-definition \
7575
--output $(rustdoc_output) \
7676
--crate-name $(subst rustdoc-,,$@) \
77+
$(if $(call rustc-min-version,108800),-Cunsafe-allow-abi-mismatch=fixed-x18) \
7778
$(if $(rustdoc_host),,--sysroot=/dev/null) \
7879
@$(objtree)/include/generated/rustc_cfg $<
7980

0 commit comments

Comments
 (0)