summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Ojeda <ojeda@kernel.org>2026-08-23 21:35:29 +0200
committerMiguel Ojeda <ojeda@kernel.org>2026-08-25 22:19:27 +0200
commit1b0bab4a873f1034c27573cfc613394cff7e0a5b (patch)
tree267edb89cb1868c2fc089527dafdbd94c6ba8108
parent7dd6343fc127935425a81a8f1989907996c2868d (diff)
rust: kbuild: disambiguate `zerocopy_derive` for `rusttest`
The `rustc-dev` components for Rust 1.82.0 through 1.87.0 include a precompiled `zerocopy_derive` procedural macro in the sysroot. This range includes Rust 1.85.0, our minimum supported version. This makes `rusttest` fail because the compiler finds both the sysroot copy and the copy built in `rust/test`: error[E0464]: multiple candidates for `dylib` dependency `zerocopy_derive` found --> rust/kernel/prelude.rs:70:9 | 70 | pub use zerocopy_derive::{ | ^^^^^^^^^^^^^^^ | = note: candidate #1: .../lib/rustlib/x86_64-unknown-linux-gnu/lib/libzerocopy_derive-54d2b38896fa6bc5.so = note: candidate #2: .../rust/test/libzerocopy_derive.so Commit fe39a233ea52 ("rust: kbuild: disambiguate `zerocopy` for `rusttest`") fixed the equivalent ambiguity for `zerocopy`. Thus point to the dependency explicitly in this case too. Cc: Antoni Boucher <bouanto@zoho.com> Cc: stable@vger.kernel.org Fixes: 506054980429 ("rust: zerocopy-derive: enable support in kbuild") Link: https://patch.msgid.link/20260823193529.156066-1-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
-rw-r--r--rust/Makefile3
1 files changed, 2 insertions, 1 deletions
diff --git a/rust/Makefile b/rust/Makefile
index 3afaad4a4a3a..9211d82ac96d 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -350,7 +350,8 @@ rusttestlib-pin_init: $(src)/pin-init/src/lib.rs rusttestlib-macros \
rusttestlib-kernel: private rustc_target_flags = --extern ffi \
--extern build_error --extern macros --extern pin_init \
--extern bindings --extern uapi \
- --extern zerocopy=$(objtree)/$(obj)/test/libzerocopy.rlib --extern zerocopy_derive
+ --extern zerocopy=$(objtree)/$(obj)/test/libzerocopy.rlib \
+ --extern zerocopy_derive=$(objtree)/$(obj)/test/$(libzerocopy_derive_name)
rusttestlib-kernel: $(src)/kernel/lib.rs rusttestlib-bindings rusttestlib-uapi \
rusttestlib-build_error rusttestlib-pin_init $(obj)/$(libmacros_name) \
$(obj)/bindings.o rusttestlib-zerocopy rusttestlib-zerocopy_derive FORCE