Re: [PATCH 00/15] Implement MODVERSIONS for Rust

Greg Kroah-Hartman
2024-07-16T07:12:26Z

On Mon, Jul 15, 2024 at 08:39:59PM +0000, Sami Tolvanen wrote:
> If using unions here is acceptable to everyone, a simple solution
> would be to use a known name prefix for the reserved members and teach
> gendwarfksyms to only print out the original type for the replaced
> ones. For example:
>
> The initial placeholder:
>
> u8 __kabi_reserved_1[8];

Don't use u8, use u64 please, it makes things simpler :)

> After replacement:
>
> union {
> u64 new_member;
> struct {
> u8 __kabi_reserved_1[8];
> };
> }

Note, such a thing would only be for the distros that want it, you can
add support for this to the tool, but there is no need for any
__kabi_reserved fields in mainline.

> Here gendwarfksyms would see the __kabi_reserved prefix and only use
> u8 [8] for the CRC calculation. Does this sound reasonable?
>
> Greg, I know you've been dealing with this for a long time, any thoughts?

It's a good start, yes. Also watch out for when structures go from
"anonymous" to "fully described" when new #include lines get added to
files. The current tooling has issues with that, so we need to use
__GENKSYMS__ #ifdef lines in some places to keep crc generation stable.
Don't know if dwarf output would be susceptible to the same issues with
that or not, but you should check.

thanks,

greg k-h