+--- xen-4.13.0/tools/xenstore/utils.h.orig 2019-12-17 14:23:09.000000000 +0000
++++ xen-4.13.0/tools/xenstore/utils.h 2020-01-21 21:13:05.108957447 +0000
+@@ -24,7 +24,7 @@
+ void barf(const char *fmt, ...) __attribute__((noreturn));
+ void barf_perror(const char *fmt, ...) __attribute__((noreturn));
+
+-void (*xprintf)(const char *fmt, ...);
++extern void (*xprintf)(const char *fmt, ...);
+
+ #define eprintf(_fmt, _args...) xprintf("[ERR] %s" _fmt, __FUNCTION__, ##_args)
+
+--- xen-4.13.0/tools/xenstore/xenstored_core.h.orig 2020-01-21 21:15:19.243931307 +0000
++++ xen-4.13.0/tools/xenstore/xenstored_core.h 2020-01-21 21:38:35.340617819 +0000
+@@ -204,7 +204,7 @@
+ /* Open a pipe for signal handling */
+ void init_pipe(int reopen_log_pipe[2]);
+
+-xengnttab_handle **xgt_handle;
++extern xengnttab_handle **xgt_handle;
+
+ int remember_string(struct hashtable *hash, const char *str);
+
+--- xen-4.13.0/tools/libxl/libxlu_pci.c.orig 2019-12-17 14:23:09.000000000 +0000
++++ xen-4.13.0/tools/libxl/libxlu_pci.c 2020-01-21 21:56:26.812212916 +0000
+@@ -48,7 +48,7 @@
+ int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci *pcidev, const char *str)
+ {
+ unsigned state = STATE_DOMAIN;
+- unsigned dom, bus, dev, func, vslot = 0;
++ unsigned dom = 0, bus = 0, dev = 0, func = 0, vslot = 0;
+ char *buf2, *tok, *ptr, *end, *optkey = NULL;
+
+ if ( NULL == (buf2 = ptr = strdup(str)) )
+--- xen-4.13.0/tools/libxl/libxl_utils.c.orig 2019-12-17 14:23:09.000000000 +0000
++++ xen-4.13.0/tools/libxl/libxl_utils.c 2020-01-21 22:34:52.096300774 +0000
+@@ -1259,7 +1259,7 @@
+ }
+ memset(un, 0, sizeof(struct sockaddr_un));
+ un->sun_family = AF_UNIX;
+- strncpy(un->sun_path, path, sizeof(un->sun_path));
++ strncpy(un->sun_path, path, sizeof(un->sun_path)-1);
+ return 0;
+ }
+
+--- xen-4.13.0/tools/debugger/kdd/kdd.h.orig 2019-12-17 14:23:09.000000000 +0000
++++ xen-4.13.0/tools/debugger/kdd/kdd.h 2020-01-21 23:35:55.458605582 +0000
+@@ -323,7 +323,7 @@
+ kdd_msg msg;
+ kdd_reg reg;
+ kdd_stc stc;
+- uint8_t payload[0];
++ uint8_t payload[65535];
+ };
+ } PACKED kdd_pkt;
+
+--- xen-4.13.0/tools/xenpmd/Makefile.orig 2019-12-17 14:23:09.000000000 +0000
++++ xen-4.13.0/tools/xenpmd/Makefile 2020-01-22 22:13:16.564873608 +0000
+@@ -3,6 +3,7 @@
+
+ CFLAGS += -Werror
+ CFLAGS += $(CFLAGS_libxenstore)
++CFLAGS += -Wno-error=format-truncation
+
+ LDLIBS += $(LDLIBS_libxenstore)
+
+--- xen-4.13.1/tools/firmware/etherboot/Config~ 2020-05-14 14:19:32.000000000 +0200
++++ xen-4.13.1/tools/firmware/etherboot/Config 2020-06-07 17:14:49.704183136 +0200
+@@ -7,3 +7,5 @@
+
+ CFLAGS += -UCONSOLE_SERIAL
+ CFLAGS += -DCONSOLE_SERIAL=1
++
++CFLAGS += -Wno-error=array-bounds -Wno-error=enum-conversion
+--- xen-4.13.1/stubdom/Makefile~ 2020-06-07 17:54:17.000000000 +0200
++++ xen-4.13.1/stubdom/Makefile 2020-06-07 17:57:37.373200925 +0200
+@@ -232,6 +232,7 @@
+ patch -d $@ -p1 < vtpm-cmake-Wextra.patch
+ patch -d $@ -p1 < vtpm-implicit-fallthrough.patch
+ patch -d $@ -p1 < vtpm_TPM_ChangeAuthAsymFinish.patch
++ patch -d $@ -p1 < vtpm-gcc10.patch
+ mkdir $@/build
+ cd $@/build; CC=${CC} $(CMAKE) .. -DCMAKE_C_FLAGS:STRING="-std=c99 -DTPM_NO_EXTERN $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-declaration-after-statement"
+ touch $@
+--- xen-4.13.1/stubdom/vtpm-gcc10.patch~ 2020-06-07 17:54:17.000000000 +0200
++++ xen-4.13.1/stubdom/vtpm-gcc10.patch 2020-06-07 17:57:37.373200925 +0200
+@@ -0,0 +1,47 @@
++--- tpm_emulator-x86_64/tpm/tpm_emulator_extern.h~ 2011-12-20 19:30:06.000000000 +0100
+++++ tpm_emulator-x86_64/tpm/tpm_emulator_extern.h 2020-06-07 17:52:04.278217629 +0200
++@@ -29,7 +29,7 @@
++ TPM_LOG_ERROR
++ };
++
++-void (*tpm_log)(int priority, const char *fmt, ...);
+++extern void (*tpm_log)(int priority, const char *fmt, ...);
++
++ #if defined(_WIN32) || defined(_WIN64)
++ #define __BFILE__ ((strrchr(__FILE__, '\\') ? : __FILE__ - 1) + 1)
++@@ -44,27 +44,27 @@
++ #define error(fmt, ...) tpm_log(TPM_LOG_ERROR, "%s:%d: Error: " fmt "\n", \
++ __BFILE__, __LINE__, ## __VA_ARGS__)
++ /* initialization */
++-int (*tpm_extern_init)(void);
++-void (*tpm_extern_release)(void);
+++extern int (*tpm_extern_init)(void);
+++extern void (*tpm_extern_release)(void);
++
++ /* memory allocation */
++
++-void* (*tpm_malloc)(size_t size);
+++extern void* (*tpm_malloc)(size_t size);
++
++-void (*tpm_free)(/*const*/ void *ptr);
+++extern void (*tpm_free)(/*const*/ void *ptr);
++
++ /* random numbers */
++
++-void (*tpm_get_extern_random_bytes)(void *buf, size_t nbytes);
+++extern void (*tpm_get_extern_random_bytes)(void *buf, size_t nbytes);
++
++ /* usec since last call */
++
++-uint64_t (*tpm_get_ticks)(void);
+++extern uint64_t (*tpm_get_ticks)(void);
++
++ /* file handling */
++
++-int (*tpm_write_to_storage)(uint8_t *data, size_t data_length);
++-int (*tpm_read_from_storage)(uint8_t **data, size_t *data_length);
+++extern int (*tpm_write_to_storage)(uint8_t *data, size_t data_length);
+++extern int (*tpm_read_from_storage)(uint8_t **data, size_t *data_length);
++
++ #endif /* _TPM_EMULATOR_EXTERN_H_ */
++
+--- xen-4.13.1/stubdom/vtpmmgr/vtpmmgr.h.orig 2020-06-07 18:20:43.261215712 +0200
++++ xen-4.13.1/stubdom/vtpmmgr/vtpmmgr.h 2020-06-07 18:20:56.731170041 +0200
+@@ -50,11 +50,6 @@
+ #define RSA_KEY_SIZE 0x0800
+ #define RSA_CIPHER_SIZE (RSA_KEY_SIZE / 8)
+
+-enum {
+- TPM1_HARDWARE = 1,
+- TPM2_HARDWARE,
+-} tpm_version;
+-
+ struct tpm_hardware_version {
+ int hw_version;
+ };
+--- xen-4.13.1/stubdom/vtpmmgr/vtpmmgr.c~ 2020-05-14 14:19:32.000000000 +0200
++++ xen-4.13.1/stubdom/vtpmmgr/vtpmmgr.c 2020-06-07 18:23:14.950766928 +0200
+@@ -45,6 +45,11 @@
+ #include "vtpmmgr.h"
+ #include "tcg.h"
+
++enum {
++ TPM1_HARDWARE = 1,
++ TPM2_HARDWARE,
++} tpm_version;
++
+ struct tpm_hardware_version hardware_version = {
+ .hw_version = TPM1_HARDWARE,
+ };