[ 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
Status in newer kernel trees: 6.15.y | Not found
Note: The patch differs from the upstream commit: --- 1: 749815922677 ! 1: 9212c12e784b 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_MODFILE=test.rs \ + cmd_rustdoc_test = \ OBJTREE=$(abspath $(objtree)) \ $(RUSTDOC) --test $(rust_common_flags) \ + -Zcrate-attr='feature(used_with_arg)' \ @@ rust/Makefile: quiet_cmd_rustdoc_test = RUSTDOC T $< $(rustc_target_flags) $(rustdoc_test_target_flags) \ $(rustdoc_test_quiet) \
- ## rust/kernel/firmware.rs ## -@@ rust/kernel/firmware.rs: macro_rules! module_firmware { - }; - - #[link_section = ".modinfo"] -- #[used] -+ #[used(compiler)] - static __MODULE_FIRMWARE: [u8; $($builder)*::create(__MODULE_FIRMWARE_PREFIX) - .build_length()] = $($builder)*::create(__MODULE_FIRMWARE_PREFIX).build(); - }; - - ## rust/kernel/kunit.rs ## -@@ rust/kernel/kunit.rs: macro_rules! kunit_unsafe_test_suite { - is_init: false, - }; - -- #[used] -+ #[used(compiler)] - #[allow(unused_unsafe)] - #[cfg_attr(not(target_os = "macos"), link_section = ".kunit_test_suites")] - static mut KUNIT_TEST_SUITE_ENTRY: *const ::kernel::bindings::kunit_suite = - ## rust/kernel/lib.rs ## @@ - // Expected to become stable. - #![feature(arbitrary_self_types)] - // -+// To be determined. + #![feature(inline_const)] + #![feature(lint_reasons)] + #![feature(unsize)] +#![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) { {cfg} #[doc(hidden)] - #[cfg_attr(not(target_os = "macos"), link_section = ".modinfo")] + #[link_section = ".modinfo"] - #[used] + #[used(compiler)] pub static __{module}_{counter}: [u8; {length}] = *{string}; @@ rust/macros/module.rs: mod __module_init {{ + #[used(compiler)] static __IS_RUST_MODULE: () = ();
- static mut __MOD: ::core::mem::MaybeUninit<{type_}> = + static mut __MOD: Option<{type_}> = None; @@ 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. --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 + # Compile Rust sources (.rs) + # --------------------------------------------------------------------------- + +-rust_allowed_features := arbitrary_self_types,lint_reasons ++rust_allowed_features := arbitrary_self_types,lint_reasons,used_with_arg
# `--out-dir` is required to avoid temporaries being created by `rustc` in the # current working directory, which may be not accessible in the out-of-tree
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | origin/linux-6.12.y | Success | Success |