All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Sasha Levin <sashal@kernel.org>
Subject: Re: [PATCH 6.12.y] rust: use `#[used(compiler)]` to fix build and `modpost` with Rust >= 1.89.0
Date: Wed, 23 Jul 2025 00:33:43 -0400	[thread overview]
Message-ID: <1753235098-80a9355f@stable.kernel.org> (raw)
In-Reply-To: <20250721194736.1150349-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

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    |

      reply	other threads:[~2025-07-23  4:33 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.12-stable tree gregkh
2025-07-21 19:47 ` [PATCH 6.12.y] rust: use `#[used(compiler)]` to fix build and `modpost` with Rust >= 1.89.0 Miguel Ojeda
2025-07-23  4:33   ` 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=1753235098-80a9355f@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.