]> git.ipfire.org Git - ipfire-3.x.git/blame - grub/patches/grub-2.02-fix-packed-not-aligned-error-on-gcc-8.patch
util-linux: Update to 2.38.1
[ipfire-3.x.git] / grub / patches / grub-2.02-fix-packed-not-aligned-error-on-gcc-8.patch
CommitLineData
edd9febb
SS
1From 563b1da6e6ae7af46cc8354cadb5dab416989f0a Mon Sep 17 00:00:00 2001
2From: Michael Chang <mchang@suse.com>
3Date: Mon, 26 Mar 2018 16:52:34 +0800
4Subject: Fix packed-not-aligned error on GCC 8
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9When 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
13This patch fixes the build error by cleaning up the ambiguity of placing
14aligned structure in a packed one. In "struct grub_btrfs_time" and "struct
15grub_gpt_part_type", the aligned attribute seems to be superfluous, and also
16has to be packed, to ensure the structure is bit-to-bit mapped to the format
17laid on disk. I think we could blame to copy and paste error here for the
18mistake. In "struct efi_variable", we have to use grub_efi_packed_guid_t, as
19the name suggests. :)
20
21Signed-off-by: Michael Chang <mchang@suse.com>
22Tested-by: Michael Chang <mchang@suse.com>
23Tested-by: Paul Menzel <paulepanter@users.sourceforge.net>
24Reviewed-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
31diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
32index 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 {
44diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h
45index 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;
57diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h
58index 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--
71cgit v1.0-41-gc330
72