80113f3
--- xen-4.6.0/tools/xentrace/xenalyze.c.orig	2015-10-05 15:33:39.000000000 +0100
80113f3
+++ xen-4.6.0/tools/xentrace/xenalyze.c	2016-02-07 16:20:14.107618700 +0000
80113f3
@@ -2132,10 +2132,12 @@
80113f3
         } while (I <= J); /* Keep going until our pointers meet or pass */
80113f3
 
80113f3
         /* Re-adjust L and R, based on which element we're looking for */
80113f3
-        if(J_weight
80113f3
+        if(J_weight
80113f3
             L=I; L_weight = I_weight;
80113f3
-        if(K_weight
80113f3
+        }
80113f3
+        if(K_weight
80113f3
             R=J; R_weight = J_weight;
80113f3
+        }
80113f3
     }
80113f3
 
80113f3
     return A[L];
80113f3
@@ -2211,10 +2213,12 @@
80113f3
         } while (I <= J); /* Keep going until our pointers meet or pass */
80113f3
 
80113f3
         /* Re-adjust L and R, based on which element we're looking for */
80113f3
-        if(J_weight
80113f3
+        if(J_weight
80113f3
             L=I; L_weight = I_weight;
80113f3
-        if(K_weight
80113f3
+        }
80113f3
+        if(K_weight
80113f3
             R=J; R_weight = J_weight;
80113f3
+        }
80113f3
     }
80113f3
 
80113f3
     return A[L];
80113f3
@@ -4121,6 +4125,7 @@
80113f3
     struct cr3_value_struct **qsort_array;
80113f3
     int i, N=0;
80113f3
 
80113f3
+#if 0
80113f3
     int cr3_compare_total(const void *_a, const void *_b) {
80113f3
         struct cr3_value_struct *a=*(typeof(&a))_a;
80113f3
         struct cr3_value_struct *b=*(typeof(&a))_b;
80113f3
@@ -4137,6 +4142,7 @@
80113f3
         } else
80113f3
             return -1;
80113f3
     }
80113f3
+#endif
80113f3
 
80113f3
     int cr3_compare_start(const void *_a, const void *_b) {
80113f3
         struct cr3_value_struct *a=*(typeof(&a))_a;
80113f3
--- xen-4.6.0/tools/qemu-xen-traditional/hw/bt-l2cap.c.orig	2015-09-08 15:42:31.000000000 +0100
80113f3
+++ xen-4.6.0/tools/qemu-xen-traditional/hw/bt-l2cap.c	2016-02-07 12:34:17.440826593 +0000
80113f3
@@ -999,7 +999,7 @@
80113f3
 
80113f3
     if (hdr->data[0] & 1) {
80113f3
         if (len != 4)
80113f3
-            /* TODO: Signal an error? */;
80113f3
+            /* TODO: Signal an error? */
80113f3
             return;
80113f3
 
80113f3
         return l2cap_sframe_in(ch, le16_to_cpup((void *) hdr->data));
80113f3
--- xen-4.6.0/tools/qemu-xen-traditional/hw/bt-sdp.c.orig	2015-09-08 15:42:31.000000000 +0100
80113f3
+++ xen-4.6.0/tools/qemu-xen-traditional/hw/bt-sdp.c	2016-02-07 12:53:39.576577307 +0000
80113f3
@@ -172,7 +172,7 @@
80113f3
     } else
80113f3
         start = 0;
80113f3
 
80113f3
-    if (len > 1);
80113f3
+    if (len > 1)
80113f3
         return -SDP_INVALID_SYNTAX;
80113f3
 
80113f3
     /* Output the results */
a2598ad
--- xen-4.6.0/stubdom/newlib.gcc6.patch.orig	2016-02-07 22:51:53.809083403 +0000
a2598ad
+++ xen-4.6.0/stubdom/newlib.gcc6.patch	2016-02-07 22:51:27.006105528 +0000
a2598ad
@@ -0,0 +1,24 @@
80113f3
+--- newlib-1.16.0/newlib/libm/math/k_rem_pio2.c.orig	2000-02-17 19:39:51.000000000 +0000
80113f3
++++ newlib-1.16.0/newlib/libm/math/k_rem_pio2.c	2016-02-07 13:00:30.069397106 +0000
a2598ad
+@@ -187,7 +187,8 @@
80113f3
+ 
80113f3
+     /* compute q[0],q[1],...q[jk] */
80113f3
+ 	for (i=0;i<=jk;i++) {
80113f3
+-	    for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw;
a2598ad
++	    for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j];
a2598ad
++	    q[i] = fw;
a2598ad
+ 	}
a2598ad
+ 
a2598ad
+ 	jz = jk;
a2598ad
+--- newlib-1.16.0/newlib/libm/math/kf_rem_pio2.c.orig	2016-02-07 16:47:05.925457144 +0000
a2598ad
++++ newlib-1.16.0/newlib/libm/math/kf_rem_pio2.c	2016-02-07 22:48:25.921499258 +0000
a2598ad
+@@ -77,7 +77,8 @@
a2598ad
+ 
a2598ad
+     /* compute q[0],q[1],...q[jk] */
a2598ad
+ 	for (i=0;i<=jk;i++) {
a2598ad
+-	    for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw;
a2598ad
++	    for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j];
a2598ad
++	    q[i] = fw;
80113f3
+ 	}
80113f3
+ 
80113f3
+ 	jz = jk;
80113f3
--- xen-4.6.0/stubdom/Makefile.orig	2015-10-05 15:33:39.000000000 +0100
80113f3
+++ xen-4.6.0/stubdom/Makefile	2016-02-07 13:10:02.036072565 +0000
80113f3
@@ -80,6 +80,7 @@
80113f3
 	patch -d $@ -p0 < newlib.patch
80113f3
 	patch -d $@ -p0 < newlib-chk.patch
80113f3
 	patch -d $@ -p1 < newlib-stdint-size_max-fix-from-1.17.0.patch
80113f3
+	patch -d $@ -p1 < newlib.gcc6.patch
80113f3
 	find $@ -type f | xargs perl -i.bak \
80113f3
 		-pe 's/\b_(tzname|daylight|timezone)\b/$$1/g'
80113f3
 	touch $@
80113f3
--- xen-4.6.0/tools/qemu-xen-traditional/block-qcow2.c.orig	2015-09-08 15:42:31.000000000 +0100
80113f3
+++ xen-4.6.0/tools/qemu-xen-traditional/block-qcow2.c	2016-02-07 13:16:47.112164538 +0000
80113f3
@@ -617,7 +617,7 @@
80113f3
         if (offset + i * cluster_size != (be64_to_cpu(l2_table[i]) & ~mask))
80113f3
             break;
80113f3
 
80113f3
-	return (i - start);
80113f3
+    return (i - start);
80113f3
 }
80113f3
 
80113f3
 static int count_contiguous_free_clusters(uint64_t nb_clusters, uint64_t *l2_table)
a2598ad
--- xen-4.6.0/tools/qemu-xen-traditional/xenstore.c.orig	2015-09-08 15:42:31.000000000 +0100
a2598ad
+++ xen-4.6.0/tools/qemu-xen-traditional/xenstore.c	2016-02-07 22:58:50.267277387 +0000
a2598ad
@@ -621,7 +621,7 @@
a2598ad
         params = xs_read(xsh, XBT_NULL, buf, &len;;
a2598ad
         if (params == NULL)
a2598ad
             continue;
a2598ad
-	    pstrcpy(bs->filename, sizeof(bs->filename), params);
a2598ad
+	pstrcpy(bs->filename, sizeof(bs->filename), params);
a2598ad
 	}
a2598ad
 #else
a2598ad
         if (params[0]) {