* [PATCH] rust: kbuild: skip gendwarfksyms in `bindings.o` for Rust >= 1.91.0
@ 2025-11-08 1:42 Miguel Ojeda
2025-11-08 2:30 ` Miguel Ojeda
0 siblings, 1 reply; 4+ messages in thread
From: Miguel Ojeda @ 2025-11-08 1:42 UTC (permalink / raw)
To: Sami Tolvanen, Miguel Ojeda, Alex Gaynor
Cc: linux-modules, linux-kbuild, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, rust-for-linux, linux-kernel,
patches, stable, Haiyue Wang
Starting with Rust 1.91.0 (released 2025-10-30), in upstream commit
ab91a63d403b ("Ignore intrinsic calls in cross-crate-inlining cost model")
[1][2], `bindings.o` stops containing DWARF debug information because the
`Default` implementations contained `write_bytes()` calls which are now
ignored in that cost model (note that `CLIPPY=1` does not reproduce it).
This means `gendwarfksyms` complains:
RUSTC L rust/bindings.o
error: gendwarfksyms: process_module: dwarf_get_units failed: no debugging information?
For the moment, conditionally skip `gendwarfksyms` for Rust >= 1.91.0.
Cc: stable@vger.kernel.org # Needed in 6.12.y and later (Rust is pinned in older LTSs).
Reported-by: Haiyue Wang <haiyuewa@163.com>
Closes: https://lore.kernel.org/rust-for-linux/b8c1c73d-bf8b-4bf2-beb1-84ffdcd60547@163.com/
Link: https://github.com/rust-lang/rust/commit/ab91a63d403b0105cacd72809cd292a72984ed99 [1]
Link: https://github.com/rust-lang/rust/pull/145910 [2]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
rust/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/rust/Makefile b/rust/Makefile
index 3e545c1a0ff4..269bf7cf5b97 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -543,6 +543,7 @@ $(obj)/ffi.o: private skip_gendwarfksyms = 1
$(obj)/ffi.o: $(src)/ffi.rs $(obj)/compiler_builtins.o FORCE
+$(call if_changed_rule,rustc_library)
+$(obj)/bindings.o: private skip_gendwarfksyms := $(if $(call rustc-min-version,109100),1)
$(obj)/bindings.o: private rustc_target_flags = --extern ffi --extern pin_init
$(obj)/bindings.o: $(src)/bindings/lib.rs \
$(obj)/ffi.o \
base-commit: dc77806cf3b4788d328fddf245e86c5b529f31a2
--
2.51.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] rust: kbuild: skip gendwarfksyms in `bindings.o` for Rust >= 1.91.0
2025-11-08 1:42 [PATCH] rust: kbuild: skip gendwarfksyms in `bindings.o` for Rust >= 1.91.0 Miguel Ojeda
@ 2025-11-08 2:30 ` Miguel Ojeda
2025-11-08 2:37 ` Miguel Ojeda
2025-11-08 2:49 ` Sami Tolvanen
0 siblings, 2 replies; 4+ messages in thread
From: Miguel Ojeda @ 2025-11-08 2:30 UTC (permalink / raw)
To: Sami Tolvanen
Cc: Alex Gaynor, linux-modules, linux-kbuild, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, rust-for-linux, linux-kernel,
patches, stable, Haiyue Wang, Miguel Ojeda
On Sat, Nov 8, 2025 at 2:44 AM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> note that `CLIPPY=1` does not reproduce it
And obviously this means we have to special case this one too...
$(obj)/bindings.o: private skip_gendwarfksyms := $(if $(call
rustc-min-version,109100),$(if $(KBUILD_CLIPPY),,1))
There may be other cases that disable the optimization or similar,
plus we may have other small crates in the future that could also
suffer from this, so it may be best to simply force to generate the
DWARF with a dummy symbol from that crate for the time being as the
fix:
#[expect(unused)]
static DUMMY_SYMBOL_FOR_DWARF_DEBUGINFO_GENERATION_FOR_GENDWARFKSYMS:
() = ();
With `#[no_mangle]` may be more reliable and it also gives an actual
exported symbol.
And then later do something in the `cmd` command itself or teaching
`genkallksyms` to auto-skip in cases like this.
What do you think?
Cheers,
Miguel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] rust: kbuild: skip gendwarfksyms in `bindings.o` for Rust >= 1.91.0
2025-11-08 2:30 ` Miguel Ojeda
@ 2025-11-08 2:37 ` Miguel Ojeda
2025-11-08 2:49 ` Sami Tolvanen
1 sibling, 0 replies; 4+ messages in thread
From: Miguel Ojeda @ 2025-11-08 2:37 UTC (permalink / raw)
To: Sami Tolvanen
Cc: Alex Gaynor, linux-modules, linux-kbuild, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, rust-for-linux, linux-kernel,
patches, stable, Haiyue Wang, Miguel Ojeda
On Sat, Nov 8, 2025 at 3:30 AM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> With `#[no_mangle]` may be more reliable and it also gives an actual
> exported symbol.
Or `#[used]` to keep it mangled since we don't care.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rust: kbuild: skip gendwarfksyms in `bindings.o` for Rust >= 1.91.0
2025-11-08 2:30 ` Miguel Ojeda
2025-11-08 2:37 ` Miguel Ojeda
@ 2025-11-08 2:49 ` Sami Tolvanen
1 sibling, 0 replies; 4+ messages in thread
From: Sami Tolvanen @ 2025-11-08 2:49 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Alex Gaynor, linux-modules, linux-kbuild, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, rust-for-linux, linux-kernel,
patches, stable, Haiyue Wang, Miguel Ojeda
On Fri, Nov 7, 2025 at 6:31 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Sat, Nov 8, 2025 at 2:44 AM Miguel Ojeda <ojeda@kernel.org> wrote:
> >
> > note that `CLIPPY=1` does not reproduce it
>
> And obviously this means we have to special case this one too...
>
> $(obj)/bindings.o: private skip_gendwarfksyms := $(if $(call
> rustc-min-version,109100),$(if $(KBUILD_CLIPPY),,1))
>
> There may be other cases that disable the optimization or similar,
> plus we may have other small crates in the future that could also
> suffer from this, so it may be best to simply force to generate the
> DWARF with a dummy symbol from that crate for the time being as the
> fix:
>
> #[expect(unused)]
> static DUMMY_SYMBOL_FOR_DWARF_DEBUGINFO_GENERATION_FOR_GENDWARFKSYMS:
> () = ();
This looks reasonable to me, and indeed seems to fix the problem.
> And then later do something in the `cmd` command itself or teaching
> `genkallksyms` to auto-skip in cases like this.
>
> What do you think?
Like I mentioned in the other thread, we ideally wouldn't silently
skip symbol versioning because the exported symbols won't be usable in
this case.
Sami
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-11-08 2:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-08 1:42 [PATCH] rust: kbuild: skip gendwarfksyms in `bindings.o` for Rust >= 1.91.0 Miguel Ojeda
2025-11-08 2:30 ` Miguel Ojeda
2025-11-08 2:37 ` Miguel Ojeda
2025-11-08 2:49 ` Sami Tolvanen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).