[PATCH 2/2] efi_loader: Fix warnings on unaligned accesses

Tom Rini trini at konsulko.com
Fri Apr 7 04:24:04 CEST 2023


On Fri, Apr 07, 2023 at 10:46:08AM +0900, AKASHI Takahiro wrote:
> Hi Ilias,
> 
> On Thu, Apr 06, 2023 at 10:37:07PM +0300, Ilias Apalodimas wrote:
> > Tom reports that when building with clang we see this warning:
> > field guid within 'struct efi_hii_keyboard_layout' is less aligned than 'efi_guid_t' and is usually due to 'struct efi_hii_keyboard_layout' being packed, which can lead to unaligned accesses [-Wunaligned-access]
> > 
> > This happens because 'struct efi_hii_keyboard_layout' is defined as
> > packed while efi_guid_t is 32bit aligned.
> 
> There are a couple of 'struct' definitions which are *packed*
> and contain an 'efi_guid_t' member in efi_api.h.
> If 'efi_hii_keyboard_layout' is the only place that causes a clang warning,
> we need a more specific explanation to clarify the problem.
> 
> > However the EFI spec describes the EFI_GUID as
> > "128-bit buffer containing a unique identifier value.
> > Unless otherwise specified aligned on a 64-bit boundary"
> 
> That's right, but this text in this context may sound misleading.
> (It doesn't explain why 'efi_guid_t' is 32-bit aligned.)

When we build for qemu_arm64 another one of the instances pops up. My
first guess is that we have unused parts of the ABI and so while the
code would trigger the warning, it's not referenced and so doesn't ?

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20230406/ea2b6c40/attachment.sig>


More information about the U-Boot mailing list