File gcc9-ignore-warnings.patch of Package xen

References: bsc#1121391

Error in trace.c: 
    trace.c: In function '__trace_hypercall':
    trace.c:826:19: error: taking address of packed member of 'struct <anonymous>' may result in an unaligned pointer value [-Werror=address-of-packed-member]
      826 |     uint32_t *a = d.args;
Error in generic.c:
    generic.c: In function 'print_mtrr_state':
    generic.c:177:11: error: '%0*lx' directive output between 1 and 1073741823 bytes may cause result to exceed 'INT_MAX' [-Werror=format-overflow=]
      177 |    printk("%s  %u base %0*"PRIx64"000 mask %0*"PRIx64"000 %s\n",
Error in utils.c:
    utils.c: In function 'vtd_dump_iommu_info':
    utils.c:286:33: error: converting a packed 'struct IO_APIC_route_entry' pointer (alignment 1) to a 'struct IO_APIC_route_remap_entry' pointer (alignment 8) may result in an unaligned pointer value [-Werror=address-of-packed-member]
      286 |                 remap = (struct IO_APIC_route_remap_entry *) &rte;
          |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~
Error in intremap.c:
    intremap.c: In function 'ioapic_rte_to_remap_entry':
    intremap.c:338:25: error: converting a packed 'struct IO_APIC_route_entry' pointer (alignment 1) to a 'struct IO_APIC_route_remap_entry' pointer (alignment 8) may result in an unaligned pointer value [-Werror=address-of-packed-member]
      338 |     remap_rte = (struct IO_APIC_route_remap_entry *) old_rte;
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
   
--- a/xen/common/trace.c
+++ b/xen/common/trace.c
@@ -816,6 +816,9 @@ unlock:
         tasklet_schedule(&trace_notify_dom0_tasklet);
 }
 
+#if __GNUC__ > 8
+#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
+#endif
 void __trace_hypercall(uint32_t event, unsigned long op,
                        const xen_ulong_t *args)
 {
@@ -824,6 +827,7 @@ void __trace_hypercall(uint32_t event, u
         uint32_t args[6];
     } d;
     uint32_t *a = d.args;
+    /* __attribute__((aligned(32))) uint32_t *a = d.args; */
 
 #define APPEND_ARG32(i)                         \
     do {                                        \
--- a/xen/arch/x86/cpu/mtrr/generic.c
+++ b/xen/arch/x86/cpu/mtrr/generic.c
@@ -182,7 +182,7 @@ static void __init print_fixed(unsigned
 static void __init print_mtrr_state(const char *level)
 {
 	unsigned int i;
-	int width;
+	unsigned char width; /* gcc9 doesn't like plain "int" here */
 
 	printk("%sMTRR default type: %s\n", level,
 	       mtrr_attrib_to_str(mtrr_state.def_type));
--- a/xen/drivers/passthrough/vtd/utils.c
+++ b/xen/drivers/passthrough/vtd/utils.c
@@ -172,6 +172,9 @@ void print_vtd_entries(struct iommu *iom
     } while ( --level );
 }
 
+#if __GNUC__ > 8
+#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
+#endif
 void vtd_dump_iommu_info(unsigned char key)
 {
     struct acpi_drhd_unit *drhd;
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -322,6 +322,9 @@ static int remap_entry_to_ioapic_rte(
     return 0;
 }
 
+#if __GNUC__ > 8
+#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
+#endif
 static int ioapic_rte_to_remap_entry(struct iommu *iommu,
     int apic, unsigned int ioapic_pin, struct IO_xAPIC_route_entry *old_rte,
     unsigned int rte_upper, unsigned int value)
openSUSE Build Service is sponsored by