From: Daniel Kiper <daniel.kiper@oracle.com>
To: grub-devel@gnu.org
Cc: development@efficientek.com, rharwood@redhat.com
Subject: [PATCH 1/6] osdep/windows/platform: Disable gcc9 -Waddress-of-packed-member
Date: Fri, 11 Mar 2022 00:35:55 +0100 [thread overview]
Message-ID: <20220310233600.25910-2-daniel.kiper@oracle.com> (raw)
In-Reply-To: <20220310233600.25910-1-daniel.kiper@oracle.com>
$ ./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.kiper@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
next prev parent reply other threads:[~2022-03-10 23:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-10 23:35 [PATCH 0/6] Various fixes and cleanups Daniel Kiper
2022-03-10 23:35 ` Daniel Kiper [this message]
2022-03-11 2:24 ` [PATCH 1/6] osdep/windows/platform: Disable gcc9 -Waddress-of-packed-member Vladimir 'phcoder' Serbinenko
2022-03-10 23:35 ` [PATCH 2/6] loader/i386/bsd: Initialize ptr variable in grub_bsd_add_meta() Daniel Kiper
2022-03-18 7:57 ` Paul Menzel
2022-03-18 19:21 ` Glenn Washburn
2022-03-24 15:12 ` Daniel Kiper
2022-03-10 23:35 ` [PATCH 3/6] commands/i386/pc/sendkey: Fix "writing 1 byte into a region of size 0" build error Daniel Kiper
2022-03-11 17:09 ` Glenn Washburn
2022-03-11 17:23 ` Toomas Soome
2022-03-11 21:37 ` Daniel Kiper
2022-03-11 18:41 ` Vladimir 'phcoder' Serbinenko
2022-03-14 4:16 ` Michael Chang
2022-03-15 13:43 ` Daniel Kiper
2022-03-10 23:35 ` [PATCH 4/6] conf/i386-cygwin-img-ld: Do not discard .data and .edata sections Daniel Kiper
2022-03-10 23:35 ` [PATCH 5/6] configure: Drop ${grub_coredir} unneeded references Daniel Kiper
2022-03-10 23:36 ` [PATCH 6/6] INSTALL: Add more cross-compiling Debian packages Daniel Kiper
2022-03-17 6:02 ` Paul Menzel
2022-03-17 22:07 ` Daniel Kiper
2022-03-11 18:51 ` [PATCH 0/6] Various fixes and cleanups Robbie Harwood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220310233600.25910-2-daniel.kiper@oracle.com \
--to=daniel.kiper@oracle.com \
--cc=development@efficientek.com \
--cc=grub-devel@gnu.org \
--cc=rharwood@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.