summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--recipes-extended/xen/files/xen-fix-gcc12-build-issues.patch433
-rw-r--r--recipes-extended/xen/xen_4.16.bb1
2 files changed, 434 insertions, 0 deletions
diff --git a/recipes-extended/xen/files/xen-fix-gcc12-build-issues.patch b/recipes-extended/xen/files/xen-fix-gcc12-build-issues.patch
new file mode 100644
index 00000000..6cdd312d
--- /dev/null
+++ b/recipes-extended/xen/files/xen-fix-gcc12-build-issues.patch
@@ -0,0 +1,433 @@
1References: bsc#1196545
2
3Compiling against gcc12.
4
5Many of the failures are -Werror=array-bounds where macros
6from mm.h are being used. Common Examples are,
7include/asm/mm.h:528:61: error: array subscript 0 is outside array bounds of 'long unsigned int[0]' [-Werror=array-bounds]
8include/xen/mm.h:287:21: error: array subscript [0, 288230376151711743] is outside array bounds of 'struct page_info[0]' [-Werror=array-bounds]
9
10There are also several other headers that generate array-bounds macro failures.
11The pragmas to override are mostly in '.c' files with the exception of,
12xen/arch/x86/mm/shadow/private.h
13xen/include/asm-x86/paging.h
14
15[Upstream-Status: imported from: https://build.opensuse.org/package/view_file/openSUSE:Factory/xen/gcc12-fixes.patch?expand=1]
16
17Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
18
19
20Index: xen-4.16.1-testing/xen/drivers/passthrough/amd/iommu_intr.c
21===================================================================
22--- xen-4.16.1-testing.orig/xen/drivers/passthrough/amd/iommu_intr.c
23+++ xen-4.16.1-testing/xen/drivers/passthrough/amd/iommu_intr.c
24@@ -23,6 +23,10 @@
25
26 #include "iommu.h"
27
28+#if __GNUC__ >= 12
29+#pragma GCC diagnostic ignored "-Warray-bounds"
30+#endif
31+
32 union irte32 {
33 uint32_t raw;
34 struct {
35Index: xen-4.16.1-testing/xen/drivers/passthrough/x86/hvm.c
36===================================================================
37--- xen-4.16.1-testing.orig/xen/drivers/passthrough/x86/hvm.c
38+++ xen-4.16.1-testing/xen/drivers/passthrough/x86/hvm.c
39@@ -901,6 +901,9 @@ static void __hvm_dpci_eoi(struct domain
40 hvm_pirq_eoi(pirq);
41 }
42
43+#if __GNUC__ >= 12
44+#pragma GCC diagnostic ignored "-Waddress"
45+#endif
46 static void hvm_gsi_eoi(struct domain *d, unsigned int gsi)
47 {
48 struct pirq *pirq = pirq_info(d, gsi);
49Index: xen-4.16.1-testing/xen/common/domctl.c
50===================================================================
51--- xen-4.16.1-testing.orig/xen/common/domctl.c
52+++ xen-4.16.1-testing/xen/common/domctl.c
53@@ -32,6 +32,10 @@
54 #include <public/domctl.h>
55 #include <xsm/xsm.h>
56
57+#if __GNUC__ >= 12
58+#pragma GCC diagnostic ignored "-Warray-bounds"
59+#endif
60+
61 static DEFINE_SPINLOCK(domctl_lock);
62
63 static int nodemask_to_xenctl_bitmap(struct xenctl_bitmap *xenctl_nodemap,
64Index: xen-4.16.1-testing/xen/common/efi/boot.c
65===================================================================
66--- xen-4.16.1-testing.orig/xen/common/efi/boot.c
67+++ xen-4.16.1-testing/xen/common/efi/boot.c
68@@ -31,6 +31,10 @@
69 #undef __ASSEMBLY__
70 #endif
71
72+#if __GNUC__ >= 12
73+#pragma GCC diagnostic ignored "-Warray-bounds"
74+#endif
75+
76 #define EFI_REVISION(major, minor) (((major) << 16) | (minor))
77
78 #define SMBIOS3_TABLE_GUID \
79Index: xen-4.16.1-testing/xen/common/xmalloc_tlsf.c
80===================================================================
81--- xen-4.16.1-testing.orig/xen/common/xmalloc_tlsf.c
82+++ xen-4.16.1-testing/xen/common/xmalloc_tlsf.c
83@@ -28,6 +28,10 @@
84 #include <xen/pfn.h>
85 #include <asm/time.h>
86
87+#if __GNUC__ >= 12
88+#pragma GCC diagnostic ignored "-Warray-bounds"
89+#endif
90+
91 #define MAX_POOL_NAME_LEN 16
92
93 /* Some IMPORTANT TLSF parameters */
94Index: xen-4.16.1-testing/xen/common/memory.c
95===================================================================
96--- xen-4.16.1-testing.orig/xen/common/memory.c
97+++ xen-4.16.1-testing/xen/common/memory.c
98@@ -35,6 +35,10 @@
99 #include <asm/guest.h>
100 #endif
101
102+#if __GNUC__ >= 12
103+#pragma GCC diagnostic ignored "-Warray-bounds"
104+#endif
105+
106 struct memop_args {
107 /* INPUT */
108 struct domain *domain; /* Domain to be affected. */
109Index: xen-4.16.1-testing/xen/common/page_alloc.c
110===================================================================
111--- xen-4.16.1-testing.orig/xen/common/page_alloc.c
112+++ xen-4.16.1-testing/xen/common/page_alloc.c
113@@ -155,6 +155,10 @@
114 #define PGC_reserved 0
115 #endif
116
117+#if __GNUC__ >= 12
118+#pragma GCC diagnostic ignored "-Warray-bounds"
119+#endif
120+
121 /*
122 * Comma-separated list of hexadecimal page numbers containing bad bytes.
123 * e.g. 'badpage=0x3f45,0x8a321'.
124@@ -1529,6 +1533,7 @@ static void free_heap_pages(
125 }
126
127
128+
129 /*
130 * Following rules applied for page offline:
131 * Once a page is broken, it can't be assigned anymore
132Index: xen-4.16.1-testing/xen/common/vmap.c
133===================================================================
134--- xen-4.16.1-testing.orig/xen/common/vmap.c
135+++ xen-4.16.1-testing/xen/common/vmap.c
136@@ -9,6 +9,10 @@
137 #include <xen/vmap.h>
138 #include <asm/page.h>
139
140+#if __GNUC__ >= 12
141+#pragma GCC diagnostic ignored "-Warray-bounds"
142+#endif
143+
144 static DEFINE_SPINLOCK(vm_lock);
145 static void *__read_mostly vm_base[VMAP_REGION_NR];
146 #define vm_bitmap(x) ((unsigned long *)vm_base[x])
147Index: xen-4.16.1-testing/xen/include/asm-x86/paging.h
148===================================================================
149--- xen-4.16.1-testing.orig/xen/include/asm-x86/paging.h
150+++ xen-4.16.1-testing/xen/include/asm-x86/paging.h
151@@ -32,6 +32,10 @@
152 #include <asm/flushtlb.h>
153 #include <asm/domain.h>
154
155+#if __GNUC__ >= 12
156+#pragma GCC diagnostic ignored "-Warray-bounds"
157+#endif
158+
159 /*****************************************************************************
160 * Macros to tell which paging mode a domain is in */
161
162Index: xen-4.16.1-testing/xen/arch/x86/x86_64/traps.c
163===================================================================
164--- xen-4.16.1-testing.orig/xen/arch/x86/x86_64/traps.c
165+++ xen-4.16.1-testing/xen/arch/x86/x86_64/traps.c
166@@ -25,6 +25,9 @@
167 #include <asm/hvm/hvm.h>
168 #include <asm/hvm/support.h>
169
170+#if __GNUC__ >= 12
171+#pragma GCC diagnostic ignored "-Warray-bounds"
172+#endif
173
174 static void print_xen_info(void)
175 {
176Index: xen-4.16.1-testing/xen/arch/x86/cpu/mcheck/mcaction.c
177===================================================================
178--- xen-4.16.1-testing.orig/xen/arch/x86/cpu/mcheck/mcaction.c
179+++ xen-4.16.1-testing/xen/arch/x86/cpu/mcheck/mcaction.c
180@@ -4,6 +4,10 @@
181 #include "vmce.h"
182 #include "mce.h"
183
184+#if __GNUC__ >= 12
185+#pragma GCC diagnostic ignored "-Warray-bounds"
186+#endif
187+
188 static struct mcinfo_recovery *
189 mci_action_add_pageoffline(int bank, struct mc_info *mi,
190 mfn_t mfn, uint32_t status)
191Index: xen-4.16.1-testing/xen/arch/x86/cpu/mcheck/mce.c
192===================================================================
193--- xen-4.16.1-testing.orig/xen/arch/x86/cpu/mcheck/mce.c
194+++ xen-4.16.1-testing/xen/arch/x86/cpu/mcheck/mce.c
195@@ -30,6 +30,10 @@
196 #include "util.h"
197 #include "vmce.h"
198
199+#if __GNUC__ >= 12
200+#pragma GCC diagnostic ignored "-Warray-bounds"
201+#endif
202+
203 bool __read_mostly opt_mce = true;
204 boolean_param("mce", opt_mce);
205 bool __read_mostly mce_broadcast;
206Index: xen-4.16.1-testing/xen/arch/x86/hvm/hvm.c
207===================================================================
208--- xen-4.16.1-testing.orig/xen/arch/x86/hvm/hvm.c
209+++ xen-4.16.1-testing/xen/arch/x86/hvm/hvm.c
210@@ -81,6 +81,10 @@
211
212 #include <compat/hvm/hvm_op.h>
213
214+#if __GNUC__ >= 12
215+#pragma GCC diagnostic ignored "-Warray-bounds"
216+#endif
217+
218 bool_t __read_mostly hvm_enabled;
219
220 #ifdef DBG_LEVEL_0
221Index: xen-4.16.1-testing/xen/arch/x86/pv/dom0_build.c
222===================================================================
223--- xen-4.16.1-testing.orig/xen/arch/x86/pv/dom0_build.c
224+++ xen-4.16.1-testing/xen/arch/x86/pv/dom0_build.c
225@@ -22,6 +22,10 @@
226 #include <asm/pv/mm.h>
227 #include <asm/setup.h>
228
229+#if __GNUC__ >= 12
230+#pragma GCC diagnostic ignored "-Warray-bounds"
231+#endif
232+
233 /* Allow ring-3 access in long mode as guest cannot use ring 1 ... */
234 #define BASE_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER)
235 #define L1_PROT (BASE_PROT|_PAGE_GUEST_KERNEL)
236Index: xen-4.16.1-testing/xen/arch/x86/pv/ro-page-fault.c
237===================================================================
238--- xen-4.16.1-testing.orig/xen/arch/x86/pv/ro-page-fault.c
239+++ xen-4.16.1-testing/xen/arch/x86/pv/ro-page-fault.c
240@@ -26,6 +26,10 @@
241 #include "emulate.h"
242 #include "mm.h"
243
244+#if __GNUC__ >= 12
245+#pragma GCC diagnostic ignored "-Warray-bounds"
246+#endif
247+
248 /*********************
249 * Writable Pagetables
250 */
251Index: xen-4.16.1-testing/xen/arch/x86/pv/emul-priv-op.c
252===================================================================
253--- xen-4.16.1-testing.orig/xen/arch/x86/pv/emul-priv-op.c
254+++ xen-4.16.1-testing/xen/arch/x86/pv/emul-priv-op.c
255@@ -40,6 +40,10 @@
256 #include "emulate.h"
257 #include "mm.h"
258
259+#if __GNUC__ >= 12
260+#pragma GCC diagnostic ignored "-Warray-bounds"
261+#endif
262+
263 struct priv_op_ctxt {
264 struct x86_emulate_ctxt ctxt;
265 struct {
266Index: xen-4.16.1-testing/xen/arch/x86/pv/mm.c
267===================================================================
268--- xen-4.16.1-testing.orig/xen/arch/x86/pv/mm.c
269+++ xen-4.16.1-testing/xen/arch/x86/pv/mm.c
270@@ -26,6 +26,10 @@
271
272 #include "mm.h"
273
274+#if __GNUC__ >= 12
275+#pragma GCC diagnostic ignored "-Warray-bounds"
276+#endif
277+
278 /*
279 * Get a mapping of a PV guest's l1e for this linear address. The return
280 * pointer should be unmapped using unmap_domain_page().
281Index: xen-4.16.1-testing/xen/arch/x86/domain_page.c
282===================================================================
283--- xen-4.16.1-testing.orig/xen/arch/x86/domain_page.c
284+++ xen-4.16.1-testing/xen/arch/x86/domain_page.c
285@@ -18,6 +18,10 @@
286 #include <asm/hardirq.h>
287 #include <asm/setup.h>
288
289+#if __GNUC__ >= 12
290+#pragma GCC diagnostic ignored "-Warray-bounds"
291+#endif
292+
293 static DEFINE_PER_CPU(struct vcpu *, override);
294
295 static inline struct vcpu *mapcache_current_vcpu(void)
296Index: xen-4.16.1-testing/xen/arch/x86/mm/shadow/private.h
297===================================================================
298--- xen-4.16.1-testing.orig/xen/arch/x86/mm/shadow/private.h
299+++ xen-4.16.1-testing/xen/arch/x86/mm/shadow/private.h
300@@ -33,6 +33,10 @@
301
302 #include "../mm-locks.h"
303
304+#if __GNUC__ >= 12
305+#pragma GCC diagnostic ignored "-Warray-bounds"
306+#endif
307+
308 /******************************************************************************
309 * Levels of self-test and paranoia
310 */
311Index: xen-4.16.1-testing/xen/arch/x86/mm/hap/hap.c
312===================================================================
313--- xen-4.16.1-testing.orig/xen/arch/x86/mm/hap/hap.c
314+++ xen-4.16.1-testing/xen/arch/x86/mm/hap/hap.c
315@@ -42,6 +42,10 @@
316
317 #include "private.h"
318
319+#if __GNUC__ >= 12
320+#pragma GCC diagnostic ignored "-Warray-bounds"
321+#endif
322+
323 /************************************************/
324 /* HAP VRAM TRACKING SUPPORT */
325 /************************************************/
326Index: xen-4.16.1-testing/xen/arch/x86/mm/p2m-pod.c
327===================================================================
328--- xen-4.16.1-testing.orig/xen/arch/x86/mm/p2m-pod.c
329+++ xen-4.16.1-testing/xen/arch/x86/mm/p2m-pod.c
330@@ -31,6 +31,10 @@
331
332 #include "mm-locks.h"
333
334+#if __GNUC__ >= 12
335+#pragma GCC diagnostic ignored "-Warray-bounds"
336+#endif
337+
338 #define superpage_aligned(_x) (((_x)&(SUPERPAGE_PAGES-1))==0)
339
340 /* Enforce lock ordering when grabbing the "external" page_alloc lock */
341Index: xen-4.16.1-testing/xen/arch/x86/mm/p2m-ept.c
342===================================================================
343--- xen-4.16.1-testing.orig/xen/arch/x86/mm/p2m-ept.c
344+++ xen-4.16.1-testing/xen/arch/x86/mm/p2m-ept.c
345@@ -36,6 +36,10 @@
346
347 #include "mm-locks.h"
348
349+#if __GNUC__ >= 12
350+#pragma GCC diagnostic ignored "-Warray-bounds"
351+#endif
352+
353 #define atomic_read_ept_entry(__pepte) \
354 ( (ept_entry_t) { .epte = read_atomic(&(__pepte)->epte) } )
355
356Index: xen-4.16.1-testing/xen/arch/x86/mm/p2m.c
357===================================================================
358--- xen-4.16.1-testing.orig/xen/arch/x86/mm/p2m.c
359+++ xen-4.16.1-testing/xen/arch/x86/mm/p2m.c
360@@ -44,6 +44,10 @@
361
362 #include "mm-locks.h"
363
364+#if __GNUC__ >= 12
365+#pragma GCC diagnostic ignored "-Warray-bounds"
366+#endif
367+
368 /* Override macro from asm/page.h to make work with mfn_t */
369 #undef virt_to_mfn
370 #define virt_to_mfn(v) _mfn(__virt_to_mfn(v))
371Index: xen-4.16.1-testing/xen/arch/x86/tboot.c
372===================================================================
373--- xen-4.16.1-testing.orig/xen/arch/x86/tboot.c
374+++ xen-4.16.1-testing/xen/arch/x86/tboot.c
375@@ -16,6 +16,10 @@
376 #include <asm/setup.h>
377 #include <crypto/vmac.h>
378
379+#if __GNUC__ >= 12
380+#pragma GCC diagnostic ignored "-Warray-bounds"
381+#endif
382+
383 /* tboot=<physical address of shared page> */
384 static unsigned long __initdata opt_tboot_pa;
385 integer_param("tboot", opt_tboot_pa);
386Index: xen-4.16.1-testing/tools/firmware/hvmloader/ovmf.c
387===================================================================
388--- xen-4.16.1-testing.orig/tools/firmware/hvmloader/ovmf.c
389+++ xen-4.16.1-testing/tools/firmware/hvmloader/ovmf.c
390@@ -34,6 +34,11 @@
391 #include <xen/hvm/ioreq.h>
392 #include <xen/memory.h>
393
394+#if __GNUC__ >= 12
395+#pragma GCC diagnostic ignored "-Warray-bounds"
396+#pragma GCC diagnostic ignored "-Wstringop-overflow"
397+#endif
398+
399 #define OVMF_MAXOFFSET 0x000FFFFFULL
400 #define OVMF_END 0x100000000ULL
401 #define LOWCHUNK_BEGIN 0x000F0000
402Index: xen-4.16.1-testing/tools/firmware/hvmloader/seabios.c
403===================================================================
404--- xen-4.16.1-testing.orig/tools/firmware/hvmloader/seabios.c
405+++ xen-4.16.1-testing/tools/firmware/hvmloader/seabios.c
406@@ -29,6 +29,11 @@
407 #include <acpi2_0.h>
408 #include <libacpi.h>
409
410+#if __GNUC__ >= 12
411+#pragma GCC diagnostic ignored "-Warray-bounds"
412+#pragma GCC diagnostic ignored "-Wstringop-overflow"
413+#endif
414+
415 struct seabios_info {
416 char signature[14]; /* XenHVMSeaBIOS\0 */
417 uint8_t length; /* Length of this struct */
418Index: xen-4.16.1-testing/tools/firmware/hvmloader/util.c
419===================================================================
420--- xen-4.16.1-testing.orig/tools/firmware/hvmloader/util.c
421+++ xen-4.16.1-testing/tools/firmware/hvmloader/util.c
422@@ -31,6 +31,10 @@
423 #include <xen/hvm/hvm_xs_strings.h>
424 #include <xen/hvm/params.h>
425
426+#if __GNUC__ >= 12
427+#pragma GCC diagnostic ignored "-Warray-bounds"
428+#endif
429+
430 /*
431 * Check whether there exists overlap in the specified memory range.
432 * Returns true if exists, else returns false.
433
diff --git a/recipes-extended/xen/xen_4.16.bb b/recipes-extended/xen/xen_4.16.bb
index 986484a4..de5d1e5b 100644
--- a/recipes-extended/xen/xen_4.16.bb
+++ b/recipes-extended/xen/xen_4.16.bb
@@ -7,6 +7,7 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
7SRC_URI = " \ 7SRC_URI = " \
8 git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ 8 git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
9 file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \ 9 file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
10 file://xen-fix-gcc12-build-issues.patch \
10 " 11 "
11 12
12LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5" 13LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"