Re: include/linux/build_bug.h:78:41: error: static assertion failed: "sizeof(struct rtw8814a_efuse) == 512"
From: Geert Uytterhoeven
Date: Mon Apr 13 2026 - 06:08:35 EST
Hi Arnd,
On Mon, 13 Apr 2026 at 11:30, Arnd Bergmann <arnd@xxxxxxxx> wrote:
> On Mon, Apr 13, 2026, at 11:15, Geert Uytterhoeven wrote:
> > On Mon, 13 Apr 2026 at 02:48, Ping-Ke Shih <pkshih@xxxxxxxxxxx> wrote:
> >> > On Fri, 10 Apr 2026 at 14:15, Ping-Ke Shih <pkshih@xxxxxxxxxxx> wrote:
> >> > How can that make a difference?
> >> > Both rtw8814au_efuse and rtw8814ae_efuse contain just (the same number
> >> > of) bytes, so __packed on the union should not make any difference?
> >> > Moreover, rtw8814au_efuse and rtw8814ae_efuse are already tagged with
> >> > __packed, which should also not make any difference. Someone's been
> >> > sprinkling too many __packed all over the place?
> >>
> >> I have similar thought as yours, but arm-linux-gnueabi-gcc compiler seems
> >> have special treatment with union. For this case, without __packed
> >> the offset of followed field res5 will become 0xe0.
> >
> > Hmm, I can confirm the original issue, and that adding __packed does
> > have an impact (it reduces the size of rtw8814a_efuse from 522 to 520),
> > but the actual size is still wrong (should be 512).
Aha, rtw_2g_txpwr_idx also needs __packed.
> >
> > drivers/net/wireless/realtek/rtw88/rtw88xxa.h has a similar issue, but
> > adding __packed does not make a difference there.
> >
> > Removing the __packed from struct rtw8814au_efuse increases its size
> > from 14 to 16 bytes. Looks like that ABI pads every structure to a
> > multiple of 4 bytes?
>
> Correct, that is a unique property of the ARM "OABI" legacy ABI,
> triggered by this defconfig line:
>
> # CONFIG_AEABI is not set
>
> Nobody should be using ARM OABI any more, and I think we should
> remove it from the kernel once support for the StrongARM
> CPU gets removed (I have patches for that), as those CPUs were
> the last ones that regularly used OABI.
>
> Annotating the union as '__packed' is the correct fix for
> the theoretical users of OABI, and does nothing on other
> supported targets in Linux.
OK, thanks!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds