lkml.org 
[lkml]   [2024]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: include/linux/build_bug.h:78:41: error: static assertion failed: "struct bpf_fib_lookup size check"
On Wed, Apr 3, 2024, at 12:09, Anton Protopopov wrote:
> On Wed, Apr 3, 2024 at 11:57 AM Anton Protopopov <aspsk@isovalent.com> 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

\
 
 \ /
  Last update: 2024-05-27 16:22    [W:0.100 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site