]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust: macros: ignore example with module parameters
authorFUJITA Tomonori <fujita.tomonori@gmail.com>
Wed, 14 Jan 2026 18:16:38 +0000 (18:16 +0000)
committerMiguel Ojeda <ojeda@kernel.org>
Wed, 14 Jan 2026 18:52:43 +0000 (19:52 +0100)
commit81a304f5b39c9a0a26c1b42997e60a5c9be05ec8
tree6c363df39cd8492a01cbd4b416b1491d6e26dff1
parent3a1ec424dd9c9491138a5ebadb24ce9f33e6a822
rust: macros: ignore example with module parameters

`ModuleParamAccess` uses `SetOnce`, which depends on the helper functions
so the `macros` crate example under `rusttest` fails to build:

    ---- rust/macros/lib.rs - module (line 62) stdout ----
    error: linking with `cc` failed: exit status: 1
      |
      = note:  "cc" "-m64" ...
      = note: some arguments are omitted. use `--verbose` to show all linker arguments
      = note: rust-lld: error: undefined symbol: rust_helper_atomic_try_cmpxchg_relaxed
              >>> referenced by kernel.ecd446ce39a5fcbb-cgu.3
              >>>               kernel.kernel.ecd446ce39a5fcbb-cgu.3.rcgu.o:(kernel::sync::set_once::SetOnce$LT$T$GT$::populate::h8b02644e30bd70bc) in archive ./rust/test/libkernel.rlib

              rust-lld: error: undefined symbol: rust_helper_atomic_set_release
              >>> referenced by kernel.ecd446ce39a5fcbb-cgu.3
              >>>               kernel.kernel.ecd446ce39a5fcbb-cgu.3.rcgu.o:(kernel::sync::set_once::SetOnce$LT$T$GT$::populate::h8b02644e30bd70bc) in archive ./rust/test/libkernel.rlib
              collect2: error: ld returned 1 exit status

Thus ignore that example to fix the error.

[ Only the first one is needed (the other example does not use
  parameters), so we can keep it enabled. Thus I removed that second
  deletion (and reworded a bit).

  We may want to do something better here later on; on the other hand,
  we should get KUnit tests for `macros` too eventually, so we may end
  up removing or repurposing that target anyway, so it is not a big deal.

    - Miguel ]

Reported-by: Miguel Ojeda <ojeda@kernel.org>
Closes: https://lore.kernel.org/rust-for-linux/CANiq72mEYacdZmHKvpbahJzO_X_qqYyiSiSTYaWEQZAfp6sbxg@mail.gmail.com/
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Fixes: 0b24f9740f26 ("rust: module: update the module macro with module parameter support")
Link: https://patch.msgid.link/20251210.082603.290476643413141778.fujita.tomonori@gmail.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/macros/lib.rs