grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 0/8] fix gcc9 build with -Werror=address-of-packed-member


From: Vladimir 'phcoder' Serbinenko
Subject: Re: [PATCH 0/8] fix gcc9 build with -Werror=address-of-packed-member
Date: Tue, 9 Apr 2019 20:57:25 +1000

On Tue, Apr 9, 2019 at 8:48 PM Michael Chang <address@hidden> wrote:
>
> This patch set attempts to resolve the build failure in openSUSE build
> service equipped with new gcc 9 compiler, which has added a new warning
> flag -Waddress-of-packed-member.
>
> The new warning performs the check for taking the address of packed
> member directly to a pointer variable with higher alignment requirement
> and the outcome is risky to memory alignment fault on some architecture
> when deferencing it.
The problem here is that there is no way to tell the compiler to
create a structure without padding but a pointer to which is aligned.
This is very common in GRUB. Consider a struct like following:
grub_uint16_t a;
grub_uint32_t b;
grub_uint16_t c[40];

This needs packed attribute as otherwise compiler will insert a
padding before b. Yet c is guaranteed to be aligned if the pointer to
the structure is aligned.
>
> Please help to review.
>
> Thanks.
>
> Michael Chang (8):
>   cpio: fix gcc9 error address-of-packed-member
>   jfs: fix gcc9 error address-of-packed-member
>   hfs: fix gcc9 error address-of-packed-member
>   hfsplus: fix gcc9 error address-of-packed-member
>   acpi: fix gcc9 error address-of-packed-member
>   usbtest: fix gcc9 error address-of-packed-member
>   chainloader: fix gcc9 error address-of-packed-member
>   efi: fix gcc9 error address-of-packed-member
>
>  grub-core/commands/usbtest.c       | 13 ++++++++-
>  grub-core/fs/cpio.c                |  5 ++--
>  grub-core/fs/cpio_be.c             |  5 ++--
>  grub-core/fs/hfsplus.c             | 57 
> ++++++++++++++++++++++++++------------
>  grub-core/fs/jfs.c                 |  5 ++--
>  grub-core/kern/efi/efi.c           | 27 ++++++++++++++++--
>  grub-core/loader/efi/chainloader.c | 12 ++++++--
>  include/grub/acpi.h                |  2 +-
>  include/grub/hfs.h                 |  2 +-
>  9 files changed, 96 insertions(+), 32 deletions(-)
>
> --
> 2.16.4
>
>
> _______________________________________________
> Grub-devel mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/grub-devel



-- 
Regards
Vladimir 'phcoder' Serbinenko



reply via email to

[Prev in Thread] Current Thread [Next in Thread]