aboutsummaryrefslogtreecommitdiffstats
path: root/main/xen/ipxe-gcc9.patch
blob: a89b8e7149d8e6b3a4e6733647c1334b590d1e54 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
diff --git a/tools/firmware/etherboot/patches/build-Fix-%s-directive-argument-is-null-error.patch b/tools/firmware/etherboot/patches/build-Fix-%s-directive-argument-is-null-error.patch
new file mode 100644
index 0000000..03a0bd4
--- /dev/null
+++ b/tools/firmware/etherboot/patches/build-Fix-%s-directive-argument-is-null-error.patch
@@ -0,0 +1,32 @@
+From 412acd7854de10e7194f362a6b1a3257a17974f7 Mon Sep 17 00:00:00 2001
+From: Valentine Barshak <gvaxon@gmail.com>
+Date: Sun, 9 Jun 2019 13:30:11 +0300
+Subject: [PATCH] [build] Fix "'%s' directive argument is null" error
+
+Use '%p' directive, and print handle's address if the address is null
+and the handle doesn't have a name.  This fixes the following
+compilation error:
+
+  interface/efi/efi_debug.c:334:3: error: '%s' directive
+  argument is null [-Werror=format-overflow=]
+
+Signed-off-by: Valentine Barshak <gvaxon@gmail.com>
+Signed-off-by: Michael Brown <mcb30@ipxe.org>
+---
+ src/interface/efi/efi_debug.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/src/interface/efi/efi_debug.c b/src/interface/efi/efi_debug.c
+index 8ea0a822d..de9b1af55 100644
+--- a/src/interface/efi/efi_debug.c
++++ b/src/interface/efi/efi_debug.c
+@@ -331,8 +331,7 @@ void dbg_efi_protocols ( EFI_HANDLE handle ) {
+ 
+ 	/* Sanity check */
+ 	if ( ! handle ) {
+-		printf ( "HANDLE %s could not retrieve protocols\n",
+-			 efi_handle_name ( handle ) );
++		printf ( "HANDLE %p could not retrieve protocols\n", handle );
+ 		return;
+ 	}
+ 
diff --git a/tools/firmware/etherboot/patches/build-Workaround-compilation-error-with-gcc-9.1.patch b/tools/firmware/etherboot/patches/build-Workaround-compilation-error-with-gcc-9.1.patch
new file mode 100644
index 0000000..8ce1620
--- /dev/null
+++ b/tools/firmware/etherboot/patches/build-Workaround-compilation-error-with-gcc-9.1.patch
@@ -0,0 +1,51 @@
+From 1dd56dbd11082fb622c2ed21cfaced4f47d798a6 Mon Sep 17 00:00:00 2001
+From: Valentine Barshak <gvaxon@gmail.com>
+Date: Mon, 22 Jul 2019 10:47:50 +0100
+Subject: [PATCH] [build] Workaround compilation error with gcc 9.1
+
+Compiling with gcc 9.1 generates lots of "taking address of packed
+member of ... may result in an unaligned pointer value" warnings.
+
+Some of these warnings are genuine, and indicate correctly that parts
+of iPXE currently require the CPU (or runtime environment) to support
+unaligned accesses.  For example: the TCP/IP receive data path will
+attempt to access 32-bit fields that may not be aligned to a 32-bit
+boundary.
+
+Other warnings are either spurious (such as when the pointer is to a
+variable-length byte array, which can have no alignment requirement
+anyway) or unhelpful (such as when the pointer is used solely to
+provide a debug colour value for the DBGC() macro).
+
+There appears to be no easy way to silence the spurious warnings.
+Since the ability to perform unaligned accesses is already a
+requirement for iPXE, work around the problem by silencing this class
+of warnings.
+
+Signed-off-by: Valentine Barshak <gvaxon@gmail.com>
+Modified-by: Michael Brown <mcb30@ipxe.org>
+Signed-off-by: Michael Brown <mcb30@ipxe.org>
+---
+ src/Makefile.housekeeping | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping
+index f8334921b..4b09e81f0 100644
+--- a/src/Makefile.housekeeping
++++ b/src/Makefile.housekeeping
+@@ -185,6 +185,15 @@ WNST_TEST = $(CC) -Wstringop-truncation -x c -c /dev/null -o /dev/null \
+ 		  >/dev/null 2>&1
+ WNST_FLAGS := $(shell $(WNST_TEST) && $(ECHO) '-Wno-stringop-truncation')
+ WORKAROUND_CFLAGS += $(WNST_FLAGS)
++
++# gcc 9.1 generates warnings for taking address of packed member which
++# may result in an unaligned pointer value.  Inhibit the warnings.
++#
++WNAPM_TEST = $(CC) -Wno-address-of-packed-member -x c -c /dev/null \
++		   -o /dev/null >/dev/null 2>&1
++WNAPM_FLAGS := $(shell $(WNAPM_TEST) && \
++		 $(ECHO) '-Wno-address-of-packed-member')
++WORKAROUND_CFLAGS += $(WNAPM_FLAGS)
+ endif
+ 
+ # Some versions of gas choke on division operators, treating them as
diff --git a/tools/firmware/etherboot/patches/series b/tools/firmware/etherboot/patches/series
index 86cb300..07c2c4b 100644
--- a/tools/firmware/etherboot/patches/series
+++ b/tools/firmware/etherboot/patches/series
@@ -1 +1,4 @@
 boot_prompt_option.patch
+zbin-Fix-compiler-warning-with-gcc-9.patch
+build-Workaround-compilation-error-with-gcc-9.1.patch
+build-Fix-%s-directive-argument-is-null-error.patch
diff --git a/tools/firmware/etherboot/patches/zbin-Fix-compiler-warning-with-gcc-9.patch b/tools/firmware/etherboot/patches/zbin-Fix-compiler-warning-with-gcc-9.patch
new file mode 100644
index 0000000..e48307f
--- /dev/null
+++ b/tools/firmware/etherboot/patches/zbin-Fix-compiler-warning-with-gcc-9.patch
@@ -0,0 +1,54 @@
+From 956f6a7227b62ce98d7840439af17bbca04f0c86 Mon Sep 17 00:00:00 2001
+From: Michael Brown <mcb30@ipxe.org>
+Date: Mon, 21 Jan 2019 11:17:04 +0000
+Subject: [PATCH] [zbin] Fix compiler warning with GCC 9
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+GCC 9 warns that abs() may truncate its signed long argument.  Fix by
+using labs() instead.
+
+Reported-by: Martin Liška <mliska@suse.cz>
+Signed-off-by: Michael Brown <mcb30@ipxe.org>
+---
+ src/util/zbin.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/util/zbin.c b/src/util/zbin.c
+index 75fba583f..3a4670b88 100644
+--- a/src/util/zbin.c
++++ b/src/util/zbin.c
+@@ -386,16 +386,16 @@ static int process_zinfo_add ( struct input_file *input
+ 		 ( ( 1UL << ( 8 * datasize ) ) - 1 ) : ~0UL );
+ 
+ 	if ( val < 0 ) {
+-		fprintf ( stderr, "Add %s%#x+%#lx at %#zx %sflows field\n",
+-			  ( ( addend < 0 ) ? "-" : "" ), abs ( addend ), size,
++		fprintf ( stderr, "Add %s%#lx+%#lx at %#zx %sflows field\n",
++			  ( ( addend < 0 ) ? "-" : "" ), labs ( addend ), size,
+ 			  offset, ( ( addend < 0 ) ? "under" : "over" ) );
+ 		return -1;
+ 	}
+ 
+ 	if ( val & ~mask ) {
+-		fprintf ( stderr, "Add %s%#x+%#lx at %#zx overflows %zd-byte "
++		fprintf ( stderr, "Add %s%#lx+%#lx at %#zx overflows %zd-byte "
+ 			  "field (%d bytes too big)\n",
+-			  ( ( addend < 0 ) ? "-" : "" ), abs ( addend ), size,
++			  ( ( addend < 0 ) ? "-" : "" ), labs ( addend ), size,
+ 			  offset, datasize,
+ 			  ( int )( ( val - mask - 1 ) * add->divisor ) );
+ 		return -1;
+@@ -414,9 +414,9 @@ static int process_zinfo_add ( struct input_file *input
+ 	}
+ 
+ 	if ( DEBUG ) {
+-		fprintf ( stderr, "ADDx [%#zx,%#zx) (%s%#x+(%#zx/%#x)) = "
++		fprintf ( stderr, "ADDx [%#zx,%#zx) (%s%#lx+(%#zx/%#x)) = "
+ 			  "%#lx\n", offset, ( offset + datasize ),
+-			  ( ( addend < 0 ) ? "-" : "" ), abs ( addend ),
++			  ( ( addend < 0 ) ? "-" : "" ), labs ( addend ),
+ 			  len, add->divisor, val );
+ 	}
+