Re: [PATCH v2 16/19] gendwarfksyms: Add support for reserved structure fields

From: Sami Tolvanen
Date: Wed Aug 21 2024 - 19:01:55 EST


On Wed, Aug 21, 2024 at 4:31 AM Benno Lossin <benno.lossin@xxxxxxxxx> wrote:
>
> On 20.08.24 22:03, Matthew Maurer wrote:
> >>> The way `KAbiReserved` is implemented is via a `union` (maybe a bit
> >>> ironic, considering what I said in my other replies, but in this case,
> >>> we would provide a safe abstraction over this `union`, thus avoiding
> >>> exposing users of this type to `unsafe`):
> >>>
> >>> #[repr(C)]
> >>> pub union KAbiReserved<T, R> {
> >>> value: T,
> >>> _reserved: R,
> >>> }
> >>
> >> I like this approach even better, assuming any remaining issues with
> >> ownership etc. can be sorted out. This would also look identical to
> >> the C version in DWARF if you rename _reserved in the union to
> >> __kabi_reserved. Of course, we can always change gendwarfksyms to
> >> support a different scheme for Rust code if a better solution comes
> >> along later.
>
> Yeah sure, that should also then work directly with this patch, right?

Yes, this would work without changes.

Sami