Re: include/linux/build_bug.h:78:41: error: static assertion failed: "struct bpf_fib_lookup size check"
From: Arnd Bergmann
Date: Wed Apr 03 2024 - 07:17:45 EST
On Wed, Apr 3, 2024, at 12:09, Anton Protopopov wrote:
> On Wed, Apr 3, 2024 at 11:57 AM Anton Protopopov <aspsk@xxxxxxxxxxxxx> wrote:
end.
>>
>> Yeah, I am sending a patch for this right now. Better not to depend on
>> compiler options
>
> One __packed__ was not enough though. The problem was also with the
> union of two __u16's which is padded to be 32 bits when AEABI=n and
> the whole structure is packed (so total size is 66 in this case).
The __packed attribute is easy to misunderstand, in this case you
would need to mark every internal union and struct as well, since
you otherwise run into one or both of these problems:
- an inner aggregate with explicit packing still requires
32-bit alignment (and padding) for each member, even if the
outer struct puts it at an unaligned position
- You get a compiler warning if an internal structure
is follows the normal alignment constraints but is located
at an unaligned offset, since that violates the alignment
constraints of the C standard.
Arnd