$ ./configure --target=x86_64-w64-mingw32 --with-platform=efi --host=x86_64-w64-mingw32 $ make
[...] In file included from grub-core/osdep/platform.c:4: grub-core/osdep/windows/platform.c: In function ‘grub_install_register_efi’: grub-core/osdep/windows/platform.c:382:41: error: taking address of packed member of ‘struct grub_efi_file_path_device_path’ may result in an unaligned pointer value [-Werror=address-of-packed-member] 382 | path16_len = grub_utf8_to_utf16 (filep->path_name, | ~~~~~^~~~~~~~~~~ Disable the -Wadress-of-packaed-member diagnostic for grub_utf8_to_utf16() call which contains filep->path_name reference. It seems safe because the structure is defined according to the UEFI spec and we hope authors did not make any mistake... :-) This fix is similar to the fix in the commit 8e8723a6b (f2fs: Disable gcc9 -Waddress-of-packed-member). Signed-off-by: Daniel Kiper <daniel.ki...@oracle.com> --- grub-core/osdep/windows/platform.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/grub-core/osdep/windows/platform.c b/grub-core/osdep/windows/platform.c index 253f8d101..075776d50 100644 --- a/grub-core/osdep/windows/platform.c +++ b/grub-core/osdep/windows/platform.c @@ -379,10 +379,20 @@ grub_install_register_efi (grub_device_t efidir_grub_dev, filep->header.type = GRUB_EFI_MEDIA_DEVICE_PATH_TYPE; filep->header.subtype = GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE; +#if __GNUC__ >= 9 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" +#endif + path16_len = grub_utf8_to_utf16 (filep->path_name, path8_len * GRUB_MAX_UTF16_PER_UTF8, (const grub_uint8_t *) efifile_path, path8_len, 0); + +#if __GNUC__ >= 9 +#pragma GCC diagnostic pop +#endif + filep->path_name[path16_len] = 0; filep->header.length = sizeof (*filep) + (path16_len + 1) * sizeof (grub_uint16_t); pathptr = &filep->path_name[path16_len + 1]; -- 2.11.0 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel