* ./include/grub/gpt_partition.h:79:1: error: alignment 1 of ‘struct grub_gpt_partentry’ is less than 8 [-Werror=packed-not-aligned]
@ 2018-03-21 7:31 Paul Menzel
2018-03-21 9:44 ` [PATCH] Fix packed-not-aligned error on GCC 8 Michael Chang
0 siblings, 1 reply; 7+ messages in thread
From: Paul Menzel @ 2018-03-21 7:31 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 2132 bytes --]
Dear GRUB folks,
Building GRUB’s master branch with GCC 8 shows the error below.
```
$ gcc-8 --version | head -1
gcc-8 (Debian 8-20180320-1) 8.0.1 20180320 (experimental) [trunk revision 258670]
$ git log --oneline -1
e2faabacf ieee1275: split up grub_machine_get_bootlocation
$ ./autogen.sh
$ ./configure --with-platform=coreboot --enable-boot-time CC=gcc-8
$ make
[…]
gcc-8 -DHAVE_CONFIG_H -I. -Wall -W -DGRUB_UTIL=1 -D_FILE_OFFSET_BITS=64 -I./include -DGRUB_FILE=\"grub-core/disk/ldm.c\" -I. -I. -I. -I. -I./include -I./include -I./grub-core/lib/libgcrypt-grub/src/ -I./grub-core/gnulib -I./grub-core/gnulib -D_FILE_OFFSET_BITS=64 -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wcast-align -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -Werror -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion -MT grub-core/disk/libgrubkern_a-ldm.o -MD -MP -MF grub-core/disk/.deps-util/libgrubkern_a-ldm.Tpo -c -o grub-core/disk/libgrubkern_a-ldm.o `test -f 'grub-core/disk/ldm.c' || echo './'`grub-core/disk/ldm.c
In file included from grub-core/disk/ldm.c:26:
./include/grub/gpt_partition.h:79:1: error: alignment 1 of ‘struct grub_gpt_partentry’ is less than 8 [-Werror=packed-not-aligned]
} GRUB_PACKED;
^
```
Thanks,
Paul
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] Fix packed-not-aligned error on GCC 8
2018-03-21 7:31 ./include/grub/gpt_partition.h:79:1: error: alignment 1 of ‘struct grub_gpt_partentry’ is less than 8 [-Werror=packed-not-aligned] Paul Menzel
@ 2018-03-21 9:44 ` Michael Chang
2018-03-22 14:09 ` Daniel Kiper
0 siblings, 1 reply; 7+ messages in thread
From: Michael Chang @ 2018-03-21 9:44 UTC (permalink / raw)
To: The development of GNU GRUB
Here just came up with a patch that fixed the GCC 8 error for me. :) Would you
test it work for you as well ?
Thanks,
Michael
--
When building with GCC 8, there are several errors regarding packed-not-aligned.
./include/grub/gpt_partition.h:79:1: error: alignment 1 of ‘struct grub_gpt_partentry’ is less than 8 [-Werror=packed-not-aligned]
This patch tries to fix the build error by cleaning up the ambiguity of placing
aligned structure in a packed one. In "struct grub_btrfs_time" and "struct
grub_gpt_part_type", the aligned attribute seems to be superfluous, and also
has to be packed, to ensure the structure is bit-to-bit mapped to the format
laid on disk. I think we could blame to copy and paste error here for the
mistake. In "struct efi_variable", we have to use grub_efi_packed_guid_t, as
the name suggests. :)
---
grub-core/fs/btrfs.c | 2 +-
include/grub/efiemu/runtime.h | 2 +-
include/grub/gpt_partition.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index 4849c1ceb..be195448d 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -175,7 +175,7 @@ struct grub_btrfs_time
{
grub_int64_t sec;
grub_uint32_t nanosec;
-} __attribute__ ((aligned (4)));
+} GRUB_PACKED;
struct grub_btrfs_inode
{
diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h
index 9b6b729f4..36d2dedf4 100644
--- a/include/grub/efiemu/runtime.h
+++ b/include/grub/efiemu/runtime.h
@@ -29,7 +29,7 @@ struct grub_efiemu_ptv_rel
struct efi_variable
{
- grub_efi_guid_t guid;
+ grub_efi_packed_guid_t guid;
grub_uint32_t namelen;
grub_uint32_t size;
grub_efi_uint32_t attributes;
diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h
index 1b32f6725..9668a68c3 100644
--- a/include/grub/gpt_partition.h
+++ b/include/grub/gpt_partition.h
@@ -28,7 +28,7 @@ struct grub_gpt_part_type
grub_uint16_t data2;
grub_uint16_t data3;
grub_uint8_t data4[8];
-} __attribute__ ((aligned(8)));
+} GRUB_PACKED;
typedef struct grub_gpt_part_type grub_gpt_part_type_t;
#define GRUB_GPT_PARTITION_TYPE_EMPTY \
--
2.13.6
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix packed-not-aligned error on GCC 8
2018-03-21 9:44 ` [PATCH] Fix packed-not-aligned error on GCC 8 Michael Chang
@ 2018-03-22 14:09 ` Daniel Kiper
2018-03-26 8:52 ` Michael Chang
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Kiper @ 2018-03-22 14:09 UTC (permalink / raw)
To: paulepanter, mchang; +Cc: grub-devel
Hi,
Paul, does this patch work for you?
Michael, if it does please repost with your SOB and Tested-by: lines.
Daniel
On Wed, Mar 21, 2018 at 05:44:47PM +0800, Michael Chang wrote:
> Here just came up with a patch that fixed the GCC 8 error for me. :) Would you
> test it work for you as well ?
>
> Thanks,
> Michael
>
> --
>
> When building with GCC 8, there are several errors regarding packed-not-aligned.
>
> ./include/grub/gpt_partition.h:79:1: error: alignment 1 of ???struct grub_gpt_partentry??? is less than 8 [-Werror=packed-not-aligned]
>
> This patch tries to fix the build error by cleaning up the ambiguity of placing
> aligned structure in a packed one. In "struct grub_btrfs_time" and "struct
> grub_gpt_part_type", the aligned attribute seems to be superfluous, and also
> has to be packed, to ensure the structure is bit-to-bit mapped to the format
> laid on disk. I think we could blame to copy and paste error here for the
> mistake. In "struct efi_variable", we have to use grub_efi_packed_guid_t, as
> the name suggests. :)
>
> ---
> grub-core/fs/btrfs.c | 2 +-
> include/grub/efiemu/runtime.h | 2 +-
> include/grub/gpt_partition.h | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
> index 4849c1ceb..be195448d 100644
> --- a/grub-core/fs/btrfs.c
> +++ b/grub-core/fs/btrfs.c
> @@ -175,7 +175,7 @@ struct grub_btrfs_time
> {
> grub_int64_t sec;
> grub_uint32_t nanosec;
> -} __attribute__ ((aligned (4)));
> +} GRUB_PACKED;
>
> struct grub_btrfs_inode
> {
> diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h
> index 9b6b729f4..36d2dedf4 100644
> --- a/include/grub/efiemu/runtime.h
> +++ b/include/grub/efiemu/runtime.h
> @@ -29,7 +29,7 @@ struct grub_efiemu_ptv_rel
>
> struct efi_variable
> {
> - grub_efi_guid_t guid;
> + grub_efi_packed_guid_t guid;
> grub_uint32_t namelen;
> grub_uint32_t size;
> grub_efi_uint32_t attributes;
> diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h
> index 1b32f6725..9668a68c3 100644
> --- a/include/grub/gpt_partition.h
> +++ b/include/grub/gpt_partition.h
> @@ -28,7 +28,7 @@ struct grub_gpt_part_type
> grub_uint16_t data2;
> grub_uint16_t data3;
> grub_uint8_t data4[8];
> -} __attribute__ ((aligned(8)));
> +} GRUB_PACKED;
> typedef struct grub_gpt_part_type grub_gpt_part_type_t;
>
> #define GRUB_GPT_PARTITION_TYPE_EMPTY \
> --
> 2.13.6
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix packed-not-aligned error on GCC 8
2018-03-22 14:09 ` Daniel Kiper
@ 2018-03-26 8:52 ` Michael Chang
2018-03-26 14:28 ` Daniel Kiper
0 siblings, 1 reply; 7+ messages in thread
From: Michael Chang @ 2018-03-26 8:52 UTC (permalink / raw)
To: The development of GNU GRUB; +Cc: paulepanter, Daniel Kiper
When building with GCC 8, there are several errors regarding packed-not-aligned.
./include/grub/gpt_partition.h:79:1: error: alignment 1 of ‘struct grub_gpt_partentry’ is less than 8 [-Werror=packed-not-aligned]
This patch tries to fix the build error by cleaning up the ambiguity of placing
aligned structure in a packed one. In "struct grub_btrfs_time" and "struct
grub_gpt_part_type", the aligned attribute seems to be superfluous, and also
has to be packed, to ensure the structure is bit-to-bit mapped to the format
laid on disk. I think we could blame to copy and paste error here for the
mistake. In "struct efi_variable", we have to use grub_efi_packed_guid_t, as
the name suggests. :)
Signed-off-by: Michael Chang <mchang@suse.com>
Tested-by: Michael Chang <mchang@suse.com>
---
grub-core/fs/btrfs.c | 2 +-
include/grub/efiemu/runtime.h | 2 +-
include/grub/gpt_partition.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index 4849c1ceb..be195448d 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -175,7 +175,7 @@ struct grub_btrfs_time
{
grub_int64_t sec;
grub_uint32_t nanosec;
-} __attribute__ ((aligned (4)));
+} GRUB_PACKED;
struct grub_btrfs_inode
{
diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h
index 9b6b729f4..36d2dedf4 100644
--- a/include/grub/efiemu/runtime.h
+++ b/include/grub/efiemu/runtime.h
@@ -29,7 +29,7 @@ struct grub_efiemu_ptv_rel
struct efi_variable
{
- grub_efi_guid_t guid;
+ grub_efi_packed_guid_t guid;
grub_uint32_t namelen;
grub_uint32_t size;
grub_efi_uint32_t attributes;
diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h
index 1b32f6725..9668a68c3 100644
--- a/include/grub/gpt_partition.h
+++ b/include/grub/gpt_partition.h
@@ -28,7 +28,7 @@ struct grub_gpt_part_type
grub_uint16_t data2;
grub_uint16_t data3;
grub_uint8_t data4[8];
-} __attribute__ ((aligned(8)));
+} GRUB_PACKED;
typedef struct grub_gpt_part_type grub_gpt_part_type_t;
#define GRUB_GPT_PARTITION_TYPE_EMPTY \
--
2.13.6
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix packed-not-aligned error on GCC 8
2018-03-26 8:52 ` Michael Chang
@ 2018-03-26 14:28 ` Daniel Kiper
2018-03-28 4:59 ` Michael Chang
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Kiper @ 2018-03-26 14:28 UTC (permalink / raw)
To: mchang, paulepanter, Daniel Kiper; +Cc: grub-devel
On Mon, Mar 26, 2018 at 04:52:34PM +0800, Michael Chang wrote:
> When building with GCC 8, there are several errors regarding packed-not-aligned.
>
> ./include/grub/gpt_partition.h:79:1: error: alignment 1 of ???struct grub_gpt_partentry??? is less than 8 [-Werror=packed-not-aligned]
>
> This patch tries to fix the build error by cleaning up the ambiguity of placing
s/tries to fix/fixes/?
> aligned structure in a packed one. In "struct grub_btrfs_time" and "struct
> grub_gpt_part_type", the aligned attribute seems to be superfluous, and also
> has to be packed, to ensure the structure is bit-to-bit mapped to the format
> laid on disk. I think we could blame to copy and paste error here for the
> mistake. In "struct efi_variable", we have to use grub_efi_packed_guid_t, as
> the name suggests. :)
>
> Signed-off-by: Michael Chang <mchang@suse.com>
> Tested-by: Michael Chang <mchang@suse.com>
Otherwise, Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
If there are no objections I will apply this in a week or so.
Daniel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix packed-not-aligned error on GCC 8
2018-03-26 14:28 ` Daniel Kiper
@ 2018-03-28 4:59 ` Michael Chang
2018-03-31 20:38 ` Paul Menzel
0 siblings, 1 reply; 7+ messages in thread
From: Michael Chang @ 2018-03-28 4:59 UTC (permalink / raw)
To: grub-devel
On Mon, Mar 26, 2018 at 04:28:20PM +0200, Daniel Kiper wrote:
> On Mon, Mar 26, 2018 at 04:52:34PM +0800, Michael Chang wrote:
> > When building with GCC 8, there are several errors regarding packed-not-aligned.
> >
> > ./include/grub/gpt_partition.h:79:1: error: alignment 1 of ???struct grub_gpt_partentry??? is less than 8 [-Werror=packed-not-aligned]
> >
> > This patch tries to fix the build error by cleaning up the ambiguity of placing
>
> s/tries to fix/fixes/?
Yes. I think the patch is adequate to say so.
>
> > aligned structure in a packed one. In "struct grub_btrfs_time" and "struct
> > grub_gpt_part_type", the aligned attribute seems to be superfluous, and also
> > has to be packed, to ensure the structure is bit-to-bit mapped to the format
> > laid on disk. I think we could blame to copy and paste error here for the
> > mistake. In "struct efi_variable", we have to use grub_efi_packed_guid_t, as
> > the name suggests. :)
> >
> > Signed-off-by: Michael Chang <mchang@suse.com>
> > Tested-by: Michael Chang <mchang@suse.com>
>
> Otherwise, Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
>
> If there are no objections I will apply this in a week or so.
Thank you very much. :)
Regards,
Michael
>
> Daniel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix packed-not-aligned error on GCC 8
2018-03-28 4:59 ` Michael Chang
@ 2018-03-31 20:38 ` Paul Menzel
0 siblings, 0 replies; 7+ messages in thread
From: Paul Menzel @ 2018-03-31 20:38 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 1564 bytes --]
Dear Michael, dear Daniel,
Thank you for the fix.
Am Mittwoch, den 28.03.2018, 12:59 +0800 schrieb Michael Chang:
> On Mon, Mar 26, 2018 at 04:28:20PM +0200, Daniel Kiper wrote:
> > On Mon, Mar 26, 2018 at 04:52:34PM +0800, Michael Chang wrote:
> > > When building with GCC 8, there are several errors regarding packed-not-aligned.
> > >
> > > ./include/grub/gpt_partition.h:79:1: error: alignment 1 of ???struct grub_gpt_partentry??? is less than 8 [-Werror=packed-not-aligned]
> > >
> > > This patch tries to fix the build error by cleaning up the ambiguity of placing
> >
> > s/tries to fix/fixes/?
>
> Yes. I think the patch is adequate to say so.
I also think, *fixes* sounds better. Maybe Daniel can amend that.
> > > aligned structure in a packed one. In "struct grub_btrfs_time" and "struct
> > > grub_gpt_part_type", the aligned attribute seems to be superfluous, and also
> > > has to be packed, to ensure the structure is bit-to-bit mapped to the format
> > > laid on disk. I think we could blame to copy and paste error here for the
> > > mistake. In "struct efi_variable", we have to use grub_efi_packed_guid_t, as
> > > the name suggests. :)
> > >
> > > Signed-off-by: Michael Chang <mchang@suse.com>
> > > Tested-by: Michael Chang <mchang@suse.com>
> >
> > Otherwise, Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
> >
> > If there are no objections I will apply this in a week or so.
>
> Thank you very much. :)
Tested-by: Paul Menzel <paulepanter@users.sourceforge.net>
Thanks,
Paul
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-03-31 20:39 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-21 7:31 ./include/grub/gpt_partition.h:79:1: error: alignment 1 of ‘struct grub_gpt_partentry’ is less than 8 [-Werror=packed-not-aligned] Paul Menzel
2018-03-21 9:44 ` [PATCH] Fix packed-not-aligned error on GCC 8 Michael Chang
2018-03-22 14:09 ` Daniel Kiper
2018-03-26 8:52 ` Michael Chang
2018-03-26 14:28 ` Daniel Kiper
2018-03-28 4:59 ` Michael Chang
2018-03-31 20:38 ` Paul Menzel
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.