Re: [PATCHES 00/12] pahole: Support more rust tags and references to dwz alternate debug files
Arnaldo Carvalho de Melo <[email protected]>
| Newsgroups | org.kernel.vger.dwarves,org.kernel.vger.bpf,org.kernel.vger.rust-for-linux |
|---|---|
| Message-ID | <anYpwcDBtkzE3WIt@x1> |
On Fri, Aug 07, 2026 at 07:34:10PM +0200, Miguel Ojeda wrote: > On Fri, Aug 7, 2026 at 2:43 PM Arnaldo Carvalho de Melo <[email protected]> wrote: > > > > Adding Miguel to the CC list, Miguel we're trying to improve BTF support > > for Rust, this series handles multiple enabling fixes/improvements that > > gets us to the next level, i.e. we can load everything from DWARF, now > > Thanks for the Cc! Cc'ing rust-for-linux and Gary. > > > its time to try to map it to existing BTF kinds and propose BTF > > extensions when we can't use existing encodings. > > Sounds cool :) > > > Inferring from "does any member have a niche layout" means > > reverse-engineering rustc's layout algorithm, which is explicitly > > unstable and unspecified. It'd break silently on a compiler bump, with > > no way to tell from the DWARF that you got it wrong. > > Yeah, the LLM is correct here: the Rust compiler gives very few > guarantees for the default `repr`, i.e. in common cases it has the > freedom to use whatever layout it wants (i.e. even for essentially > equivalent types in the same compilation unit) -- the official docs > are at: > > https://doc.rust-lang.org/reference/type-layout.html > > > u8 __discriminant; /* 0 1 */ > > For the niche cases like `Option<NonZero<u32>>`, what would be printed? Can you think about one such niche case that is present in the kernel rust .o files right now? I tried finding the `Option<NonZero<u32>>` to look at its DWARF but couldn't find one. - Arnaldo