coreboot_tables: Make existing alignment conventions more explicit
commit9a9b2778a1f04ba5d570de154f4b6f38f3b5807a
authorJulius Werner <jwerner@chromium.org>
Thu, 1 Dec 2022 00:18:01 +0000 (30 16:18 -0800)
committerJulius Werner <jwerner@chromium.org>
Thu, 22 Dec 2022 15:34:28 +0000 (22 15:34 +0000)
treece5c6fcc45240198711ab0f159a543bab6d629b6
parentad6c407927a2aa05cb7ecb47c833b230c227db36
coreboot_tables: Make existing alignment conventions more explicit

There seem to be some recurring vague concerns about the alignment of
coreboot table entries. While the existing implementation has been
producing tables with a well-defined alignment (4 bytes) for a long
time, the code doesn't always make it very clear. This patch adds an
explicit constant to codify that alignment, assertions to check it after
each entry, and adds explicit padding to the few entry structures that
were relying on compiler padding to return a correct sizeof() value.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: Iaeef29ef255047a855066469e03b5481812e5975
Reviewed-on: https://review.coreboot.org/c/coreboot/+/70158
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Jakub Czapiga <jacz@semihalf.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Peter Stuge <peter@stuge.se>
src/commonlib/include/commonlib/coreboot_tables.h
src/lib/coreboot_table.c
tests/lib/coreboot_table-test.c