]> git.pld-linux.org Git - packages/xen.git/blame - gcc9.patch
- alignment fix
[packages/xen.git] / gcc9.patch
CommitLineData
56bb081c
JR
1From 3fd3b266d4198c06e8e421ca515d9ba09ccd5155 Mon Sep 17 00:00:00 2001
2From: Jan Beulich <jbeulich@suse.com>
3Date: Mon, 13 May 2019 09:51:23 +0200
4Subject: [PATCH] trace: fix build with gcc9
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9While I've not observed this myself, gcc 9 (imo validly) reportedly may
10complain
11
12trace.c: In function '__trace_hypercall':
13trace.c:826:19: error: taking address of packed member of 'struct <anonymous>' may result in an unaligned pointer value [-Werror=address-of-packed-member]
14 826 | uint32_t *a = d.args;
15
16and the fix is rather simple - remove the __packed attribute. Introduce
17a BUILD_BUG_ON() as replacement, for the unlikely case that Xen might
18get ported to an architecture where array alignment higher that that of
19its elements.
20
21Reported-by: Martin Liška <martin.liska@suse.com>
22Signed-off-by: Jan Beulich <jbeulich@suse.com>
23Acked-by: George Dunlap <george.dunlap@citrix.com>
24---
25 xen/common/trace.c | 8 +++++++-
26 1 file changed, 7 insertions(+), 1 deletion(-)
27
28diff --git a/xen/common/trace.c b/xen/common/trace.c
29index cc294fc38473..d1ef81407b71 100644
30--- a/xen/common/trace.c
31+++ b/xen/common/trace.c
32@@ -819,12 +819,18 @@ void __trace_var(u32 event, bool_t cycles, unsigned int extra,
33 void __trace_hypercall(uint32_t event, unsigned long op,
34 const xen_ulong_t *args)
35 {
36- struct __packed {
37+ struct {
38 uint32_t op;
39 uint32_t args[6];
40 } d;
41 uint32_t *a = d.args;
42
43+ /*
44+ * In lieu of using __packed above, which gcc9 legitimately doesn't
45+ * like in combination with the address of d.args[] taken.
46+ */
47+ BUILD_BUG_ON(offsetof(typeof(d), args) != sizeof(d.op));
48+
49 #define APPEND_ARG32(i) \
50 do { \
51 unsigned i_ = (i); \
52--- xen-4.11.1/xen/drivers/passthrough/vtd/vtd.h.orig 2018-11-29 14:04:11.000000000 +0000
53+++ xen-4.11.1/xen/drivers/passthrough/vtd/vtd.h 2019-02-05 21:32:50.056774501 +0000
54@@ -28,7 +28,7 @@
55 /* Allow for both IOAPIC and IOSAPIC. */
56 #define IO_xAPIC_route_entry IO_APIC_route_entry
57
58-struct IO_APIC_route_remap_entry {
59+struct __packed IO_APIC_route_remap_entry {
60 union {
61 u64 val;
62 struct {
63--- xen-4.11.1/xen/arch/x86/cpu/mtrr/generic.c.orig 2018-11-29 14:04:11.000000000 +0000
64+++ xen-4.11.1/xen/arch/x86/cpu/mtrr/generic.c 2019-02-10 19:24:09.378805103 +0000
65@@ -171,6 +171,9 @@
66 printk("%sMTRR variable ranges %sabled:\n", level,
67 mtrr_state.enabled ? "en" : "dis");
68 width = (paddr_bits - PAGE_SHIFT + 3) / 4;
69+ if ( width > 64 ) {
70+ width=64;
71+ }
72
73 for (i = 0; i < num_var_ranges; ++i) {
74 if (mtrr_state.var_ranges[i].mask & MTRR_PHYSMASK_VALID)
a6b4b06c
JR
75--- xen-4.6.6/xen/arch/x86/mm.c~ 2017-07-06 09:04:28.000000000 +0200
76+++ xen-4.6.6/xen/arch/x86/mm.c 2019-10-27 14:02:41.582770616 +0100
77@@ -517,7 +517,7 @@
78 make_cr3(v, cr3_mfn);
79 }
80
81-static const char __section(".bss.page_aligned") zero_page[PAGE_SIZE];
82+static const char __section(".bss.page_aligned.const") zero_page[PAGE_SIZE];
83
84 static void invalidate_shadow_ldt(struct vcpu *v, int flush)
85 {
This page took 0.071829 seconds and 4 git commands to generate.