[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20251210.082603.290476643413141778.fujita.tomonori@gmail.com>
Date: Wed, 10 Dec 2025 08:26:03 +0900 (JST)
From: FUJITA Tomonori <fujita.tomonori@...il.com>
To: miguel.ojeda.sandonis@...il.com
Cc: boqun.feng@...il.com, gary@...yguo.net, a.hindborg@...nel.org,
bjorn3_gh@...tonmail.com, aliceryhl@...gle.com, tmgross@...ch.edu,
dakr@...nel.org, lossin@...nel.org, will@...nel.org, peterz@...radead.org,
mark.rutland@....com, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: Mainline x86_64/arm64 defconfig+Rust `rusttest` error
On Tue, 9 Dec 2025 11:56:08 +0100
Miguel Ojeda <miguel.ojeda.sandonis@...il.com> wrote:
> Hi all,
>
> I am seeing in mainline x86_64/arm64 defconfig+Rust the following
> `rusttest` error [1].
I think that simply marking the module! doctests as ignore would avoid
the issue. But it's possible to make the atomic helpers run on the
host side so we might want a better fix?
=
From: FUJITA Tomonori <fujita.tomonori@...il.com>
Subject: [PATCH v1] rust: macros: make module! doctests as ignore
ModuleParamAccess started using SetOnce, and SetOnce depends on the
helper functions so `make rusttest` doesn't work for module! macro.
Fix the followings:
---- rust/macros/lib.rs - module (line 62) stdout ----
error: linking with `cc` failed: exit status: 1
|
=3D note: "cc" "-m64" "/tmp/rustcHhYZSx/symbols.o" "<2 object files
omitted>" "-Wl,--as-needed" "-Wl,-Bstatic"
"./rust/test/{libkernel,libuapi,libbindings,libbuild_error,libpin_init,libf=
fi}.rlib"
"<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwi=
nd-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,librustc=
_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,l=
ibminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_co=
re-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib"
"-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl"
"-lc" "-L" "/tmp/rustcHhYZSx/raw-dylibs"
"-B<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld"
"-fuse-ld=3Dlld" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L"
"./rust/test" "-L"
"<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o"
"/tmp/rustdoctest9bUijb/rust_out" "-Wl,--gc-sections" "-pie"
"-Wl,-z,relro,-z,now" "-nodefaultlibs"
=3D note: some arguments are omitted. use `--verbose` to show all
linker arguments
=3D note: rust-lld: error: undefined symbol:
rust_helper_atomic_try_cmpxchg_relaxed
>>> referenced by kernel.e6083e32b3c2ec6-cgu.05
>>>
kernel.kernel.e6083e32b3c2ec6-cgu.05.rcgu.o:(kernel::sync::set_once::SetOnc=
e$LT$T$GT$::populate::hd1ceefad3c0dd5d9)
in archive ./rust/test/libkernel.rlib
rust-lld: error: undefined symbol: rust_helper_atomic_set_release
>>> referenced by kernel.e6083e32b3c2ec6-cgu.05
>>>
kernel.kernel.e6083e32b3c2ec6-cgu.05.rcgu.o:(kernel::sync::set_once::SetOnc=
e$LT$T$GT$::populate::hd1ceefad3c0dd5d9)
in archive ./rust/test/libkernel.rlib
collect2: error: ld returned 1 exit status
Reported-by: Miguel Ojeda <ojeda@...nel.org>
Closes: https://lore.kernel.org/rust-for-linux/CANiq72mEYacdZmHKvpbahJzO_X_qqYyiSiSTYaWEQZAfp6sbxg@mail.gmail.com/
Signed-off-by: FUJITA Tomonori <fujita.tomonori@...il.com>
---
rust/macros/lib.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rust/macros/lib.rs b/rust/macros/lib.rs
index b38002151871..8b2af1dc79d0 100644
--- a/rust/macros/lib.rs
+++ b/rust/macros/lib.rs
@@ -59,7 +59,7 @@
///
/// # Examples
///
-/// ```
+/// ```ignore
/// use kernel::prelude::*;
///
/// module!{
@@ -99,7 +99,7 @@
/// build an initramfs uses this information to put the firmware files into
/// the initramfs image.
///
-/// ```
+/// ```ignore
/// use kernel::prelude::*;
///
/// module!{
base-commit: cb015814f8b6eebcbb8e46e111d108892c5e6821
--
2.43.0
Powered by blists - more mailing lists