From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Sasha Levin <sashal@kernel.org>
Subject: Re: [PATCH 6.15.y] rust: use `#[used(compiler)]` to fix build and `modpost` with Rust >= 1.89.0
Date: Wed, 23 Jul 2025 00:34:22 -0400 [thread overview]
Message-ID: <1753234834-a2642eb2@stable.kernel.org> (raw)
In-Reply-To: <20250721194904.1150898-1-ojeda@kernel.org>
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected.
No action required from the submitter.
The upstream commit SHA1 provided is correct: 7498159226772d66f150dd406be462d75964a366
Note: The patch differs from the upstream commit:
---
1: 749815922677 ! 1: a3a4555a1d32 rust: use `#[used(compiler)]` to fix build and `modpost` with Rust >= 1.89.0
@@ Commit message
Acked-by: Björn Roy Baron <bjorn3_gh@protonmail.com>
Link: https://lore.kernel.org/r/20250712160103.1244945-3-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
+ (cherry picked from commit 7498159226772d66f150dd406be462d75964a366)
+ Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
## rust/Makefile ##
@@ rust/Makefile: quiet_cmd_rustdoc_test = RUSTDOC T $<
@@ rust/kernel/kunit.rs: macro_rules! kunit_unsafe_test_suite {
## rust/kernel/lib.rs ##
@@
- // Expected to become stable.
- #![feature(arbitrary_self_types)]
- //
+ #![feature(const_mut_refs)]
+ #![feature(const_ptr_write)]
+ #![feature(const_refs_to_cell)]
+// To be determined.
+#![feature(used_with_arg)]
-+//
- // `feature(derive_coerce_pointee)` is expected to become stable. Before Rust
- // 1.84.0, it did not exist, so enable the predecessor features.
- #![cfg_attr(CONFIG_RUSTC_HAS_COERCE_POINTEE, feature(derive_coerce_pointee))]
+
+ // Ensure conditional compilation based on the kernel configuration works;
+ // otherwise we may silently break things like initcall handling.
## rust/macros/module.rs ##
@@ rust/macros/module.rs: fn emit_base(&mut self, field: &str, content: &str, builtin: bool) {
@@ rust/macros/module.rs: mod __module_init {{
+ #[used(compiler)]
static __IS_RUST_MODULE: () = ();
- static mut __MOD: ::core::mem::MaybeUninit<{type_}> =
+ static mut __MOD: core::mem::MaybeUninit<{type_}> =
@@ rust/macros/module.rs: mod __module_init {{
#[cfg(MODULE)]
@@ rust/macros/module.rs: mod __module_init {{
#[link_section = \"{initcall_section}\"]
- #[used]
+ #[used(compiler)]
- pub static __{ident}_initcall: extern \"C\" fn() ->
- ::kernel::ffi::c_int = __{ident}_init;
+ pub static __{name}_initcall: extern \"C\" fn() -> kernel::ffi::c_int = __{name}_init;
+ #[cfg(not(MODULE))]
## scripts/Makefile.build ##
@@ scripts/Makefile.build: $(obj)/%.lst: $(obj)/%.c FORCE
- # - Stable since Rust 1.82.0: `feature(asm_const)`, `feature(raw_ref_op)`.
- # - Stable since Rust 1.87.0: `feature(asm_goto)`.
- # - Expected to become stable: `feature(arbitrary_self_types)`.
-+# - To be determined: `feature(used_with_arg)`.
- #
- # Please see https://github.com/Rust-for-Linux/linux/issues/2 for details on
- # the unstable features in use.
+ # Compile Rust sources (.rs)
+ # ---------------------------------------------------------------------------
+
-rust_allowed_features := asm_const,asm_goto,arbitrary_self_types,lint_reasons,raw_ref_op
+rust_allowed_features := asm_const,asm_goto,arbitrary_self_types,lint_reasons,raw_ref_op,used_with_arg
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| origin/linux-6.15.y | Success | Success |
prev parent reply other threads:[~2025-07-23 4:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-21 9:30 FAILED: patch "[PATCH] rust: use `#[used(compiler)]` to fix build and `modpost` with" failed to apply to 6.15-stable tree gregkh
2025-07-21 19:49 ` [PATCH 6.15.y] rust: use `#[used(compiler)]` to fix build and `modpost` with Rust >= 1.89.0 Miguel Ojeda
2025-07-23 4:34 ` Sasha Levin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1753234834-a2642eb2@stable.kernel.org \
--to=sashal@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.