Re: [PATCH v2 0/3] Inline helpers into Rust without full LTO
From: Arnd Bergmann
Date: Mon Mar 30 2026 - 08:22:39 EST
On Mon, Mar 30, 2026, at 14:03, Geert Uytterhoeven wrote:
> On Fri, 27 Mar 2026 at 10:02, Arnd Bergmann <arnd@xxxxxxxx> wrote:
>>
>> echo 'struct { short a : 3; short b :15; short c :14; } x; int y = sizeof(x);' | m68k-linux-gcc -xc - -S -o-
>>
>> this produces '4' on m68k-linux-gcc, but '6' everywhere else. I originally
>> thought this was related to this 2009 change in both compilers
>
> Oh, now I remember. AFAIK (holding wood and a rabbit leg) we don't
> have any bitfield members spanning multiple base type instances in
> the kernel.
There are certainly very few of those, but two example I found in
UAPI are
struct dvd_layer {
__u8 book_version : 4;
__u8 book_type : 4;
__u8 min_rate : 4;
__u8 disc_size : 4;
__u8 layer_type : 4;
__u8 track_path : 1;
__u8 nlayers : 2;
__u8 track_density : 4; // crosses u8 boundary
__u8 linear_density : 4;
__u8 bca : 1;
__u32 start_sector;
__u32 end_sector;
__u32 end_sector_l0;
};
struct usb_raw_ep_caps {
__u32 type_control : 1;
__u32 type_iso : 1;
__u32 type_bulk : 1;
__u32 type_int : 1;
__u32 dir_in : 1;
__u32 dir_out : 1;
// 2 bit padding on m68k, 26 bits elsewhere
};
Arnd