]>
Commit | Line | Data |
---|---|---|
edd9febb SS |
1 | From 563b1da6e6ae7af46cc8354cadb5dab416989f0a Mon Sep 17 00:00:00 2001 |
2 | From: Michael Chang <mchang@suse.com> | |
3 | Date: Mon, 26 Mar 2018 16:52:34 +0800 | |
4 | Subject: Fix packed-not-aligned error on GCC 8 | |
5 | MIME-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ||
9 | When building with GCC 8, there are several errors regarding packed-not-aligned. | |
10 | ||
11 | ./include/grub/gpt_partition.h:79:1: error: alignment 1 of ‘struct grub_gpt_partentry’ is less than 8 [-Werror=packed-not-aligned] | |
12 | ||
13 | This patch fixes the build error by cleaning up the ambiguity of placing | |
14 | aligned structure in a packed one. In "struct grub_btrfs_time" and "struct | |
15 | grub_gpt_part_type", the aligned attribute seems to be superfluous, and also | |
16 | has to be packed, to ensure the structure is bit-to-bit mapped to the format | |
17 | laid on disk. I think we could blame to copy and paste error here for the | |
18 | mistake. In "struct efi_variable", we have to use grub_efi_packed_guid_t, as | |
19 | the name suggests. :) | |
20 | ||
21 | Signed-off-by: Michael Chang <mchang@suse.com> | |
22 | Tested-by: Michael Chang <mchang@suse.com> | |
23 | Tested-by: Paul Menzel <paulepanter@users.sourceforge.net> | |
24 | Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> | |
25 | --- | |
26 | grub-core/fs/btrfs.c | 2 +- | |
27 | include/grub/efiemu/runtime.h | 2 +- | |
28 | include/grub/gpt_partition.h | 2 +- | |
29 | 3 files changed, 3 insertions(+), 3 deletions(-) | |
30 | ||
31 | diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c | |
32 | index 4849c1c..be19544 100644 | |
33 | --- a/grub-core/fs/btrfs.c | |
34 | +++ b/grub-core/fs/btrfs.c | |
35 | @@ -175,7 +175,7 @@ struct grub_btrfs_time | |
36 | { | |
37 | grub_int64_t sec; | |
38 | grub_uint32_t nanosec; | |
39 | -} __attribute__ ((aligned (4))); | |
40 | +} GRUB_PACKED; | |
41 | ||
42 | struct grub_btrfs_inode | |
43 | { | |
44 | diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h | |
45 | index 9b6b729..36d2ded 100644 | |
46 | --- a/include/grub/efiemu/runtime.h | |
47 | +++ b/include/grub/efiemu/runtime.h | |
48 | @@ -29,7 +29,7 @@ struct grub_efiemu_ptv_rel | |
49 | ||
50 | struct efi_variable | |
51 | { | |
52 | - grub_efi_guid_t guid; | |
53 | + grub_efi_packed_guid_t guid; | |
54 | grub_uint32_t namelen; | |
55 | grub_uint32_t size; | |
56 | grub_efi_uint32_t attributes; | |
57 | diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h | |
58 | index 1b32f67..9668a68 100644 | |
59 | --- a/include/grub/gpt_partition.h | |
60 | +++ b/include/grub/gpt_partition.h | |
61 | @@ -28,7 +28,7 @@ struct grub_gpt_part_type | |
62 | grub_uint16_t data2; | |
63 | grub_uint16_t data3; | |
64 | grub_uint8_t data4[8]; | |
65 | -} __attribute__ ((aligned(8))); | |
66 | +} GRUB_PACKED; | |
67 | typedef struct grub_gpt_part_type grub_gpt_part_type_t; | |
68 | ||
69 | #define GRUB_GPT_PARTITION_TYPE_EMPTY \ | |
70 | -- | |
71 | cgit v1.0-41-gc330 | |
72 |