From 36ddb7bd09dd00ba1d909ced1cf268d3c5add852 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Sun, 7 Jun 2020 19:35:49 +0200 Subject: [PATCH] - updated patch and build, added build fixes for newer gcc --- gcc10.patch | 161 +++++++++++++++++++++++++++++++++++++++++ gcc9.patch | 23 ++++++ odd-glib2-fix.patch | 19 ----- sysmacros.patch | 11 --- xen-make.patch | 11 --- xen-no_Werror.patch | 10 --- xen-no_fetcher.patch | 6 +- xen-pkgconfigdir.patch | 9 --- xen-symbols.patch | 2 +- xen.spec | 53 +++++++------- 10 files changed, 214 insertions(+), 91 deletions(-) create mode 100644 gcc10.patch create mode 100644 gcc9.patch delete mode 100644 odd-glib2-fix.patch delete mode 100644 xen-make.patch delete mode 100644 xen-pkgconfigdir.patch diff --git a/gcc10.patch b/gcc10.patch new file mode 100644 index 0000000..0a5c546 --- /dev/null +++ b/gcc10.patch @@ -0,0 +1,161 @@ +--- 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, + }; diff --git a/gcc9.patch b/gcc9.patch new file mode 100644 index 0000000..16c526a --- /dev/null +++ b/gcc9.patch @@ -0,0 +1,23 @@ +--- xen-4.11.1/xen/drivers/passthrough/vtd/vtd.h.orig 2018-11-29 14:04:11.000000000 +0000 ++++ xen-4.11.1/xen/drivers/passthrough/vtd/vtd.h 2019-02-05 21:32:50.056774501 +0000 +@@ -28,7 +28,7 @@ + /* Allow for both IOAPIC and IOSAPIC. */ + #define IO_xAPIC_route_entry IO_APIC_route_entry + +-struct IO_APIC_route_remap_entry { ++struct __packed IO_APIC_route_remap_entry { + union { + u64 val; + struct { +--- xen-4.11.1/xen/arch/x86/cpu/mtrr/generic.c.orig 2018-11-29 14:04:11.000000000 +0000 ++++ xen-4.11.1/xen/arch/x86/cpu/mtrr/generic.c 2019-02-10 19:24:09.378805103 +0000 +@@ -171,6 +171,9 @@ + printk("%sMTRR variable ranges %sabled:\n", level, + mtrr_state.enabled ? "en" : "dis"); + width = (paddr_bits - PAGE_SHIFT + 3) / 4; ++ if ( width > 64 ) { ++ width=64; ++ } + + for (i = 0; i < num_var_ranges; ++i) { + if (mtrr_state.var_ranges[i].mask & MTRR_PHYSMASK_VALID) diff --git a/odd-glib2-fix.patch b/odd-glib2-fix.patch deleted file mode 100644 index cdc1959..0000000 --- a/odd-glib2-fix.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- xen-4.4.0/tools/qemu-xen/ui/vnc-enc-tight.c.orig 2014-03-14 11:53:18.512514455 +0000 -+++ xen-4.4.0/tools/qemu-xen/ui/vnc-enc-tight.c 2014-03-14 15:03:52.245475390 +0000 -@@ -31,7 +31,6 @@ - /* This needs to be before jpeglib.h line because of conflict with - INT32 definitions between jmorecfg.h (included by jpeglib.h) and - Win32 basetsd.h (included by windows.h). */ --#include "qemu-common.h" - - #ifdef CONFIG_VNC_PNG - /* The following define is needed by pngconf.h. Otherwise it won't compile, -@@ -44,6 +43,8 @@ - #include - #endif - -+#include "qemu-common.h" -+ - #include "qemu/bswap.h" - #include "qapi/qmp/qint.h" - #include "vnc.h" diff --git a/sysmacros.patch b/sysmacros.patch index fec468b..4ee0eb1 100644 --- a/sysmacros.patch +++ b/sysmacros.patch @@ -1,14 +1,3 @@ -diff -urN xen-4.6.5/tools/blktap2/control/tap-ctl-allocate.c xen-4.6.5.build/tools/blktap2/control/tap-ctl-allocate.c ---- xen-4.6.5/tools/blktap2/control/tap-ctl-allocate.c 2017-03-07 17:19:05.000000000 +0100 -+++ xen-4.6.5.build/tools/blktap2/control/tap-ctl-allocate.c 2017-04-14 15:01:13.935244471 +0200 -@@ -36,6 +36,7 @@ - #include - #include - #include -+#include - #include - - #include "tap-ctl.h" diff -urN xen-4.6.5/tools/libxl/libxl_internal.h xen-4.6.5.build/tools/libxl/libxl_internal.h --- xen-4.6.5/tools/libxl/libxl_internal.h 2017-03-07 17:19:05.000000000 +0100 +++ xen-4.6.5.build/tools/libxl/libxl_internal.h 2017-04-14 15:05:55.088806418 +0200 diff --git a/xen-make.patch b/xen-make.patch deleted file mode 100644 index cf57b89..0000000 --- a/xen-make.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- xen-4.4.1/tools/blktap2/vhd/Makefile.orig 2014-09-02 08:20:19.000000000 +0200 -+++ xen-4.4.1/tools/blktap2/vhd/Makefile 2014-10-25 23:08:01.972163664 +0200 -@@ -27,7 +27,7 @@ - - build: $(IBIN) - --LIBS_DEPENDS := lib/libvhd.so lib/vhd.a -+LIBS_DEPENDS := lib/libvhd.so lib/libvhd.a - $(LIBS_DEPENDS):subdirs-all - - vhd-util: vhd-util.o $(LIBS_DEPENDS) diff --git a/xen-no_Werror.patch b/xen-no_Werror.patch index 299077c..0d0532a 100644 --- a/xen-no_Werror.patch +++ b/xen-no_Werror.patch @@ -9,13 +9,3 @@ HOSTCFLAGS += -fno-strict-aliasing DISTDIR ?= $(XEN_ROOT)/dist ---- xen-4.4.1/tools/blktap2/drivers/Makefile~ 2014-09-02 08:20:19.000000000 +0200 -+++ xen-4.4.1/tools/blktap2/drivers/Makefile 2014-12-13 19:19:17.070688454 +0100 -@@ -4,7 +4,6 @@ - LOCK_UTIL = lock-util - INST_DIR = $(sbindir) - --CFLAGS += -Werror - CFLAGS += -Wno-unused - CFLAGS += -fno-strict-aliasing - CFLAGS += -I$(BLKTAP_ROOT)/include -I$(BLKTAP_ROOT)/drivers diff --git a/xen-no_fetcher.patch b/xen-no_fetcher.patch index 2d8fa49..8b9047a 100644 --- a/xen-no_fetcher.patch +++ b/xen-no_fetcher.patch @@ -1,9 +1,10 @@ diff -dur xen-4.3.0.orig/m4/fetcher.m4 xen-4.3.0/m4/fetcher.m4 --- xen-4.3.0.orig/m4/fetcher.m4 2013-07-09 12:46:56.000000000 +0200 +++ xen-4.3.0/m4/fetcher.m4 2013-10-05 18:39:42.948294115 +0200 -@@ -1,14 +1,4 @@ +@@ -1,16 +1,4 @@ AC_DEFUN([AX_CHECK_FETCHER], [ -AC_PATH_PROG([WGET],[wget], [no]) +-AC_PATH_PROG([FALSE],[false], [/bin/false]) -AS_IF([test x"$WGET" != x"no"], [ - FETCHER="$WGET -c -O" -], [ @@ -11,7 +12,8 @@ diff -dur xen-4.3.0.orig/m4/fetcher.m4 xen-4.3.0/m4/fetcher.m4 - AS_IF([test x"$FTP" != x"no"], [ - FETCHER="$FTP -o" - ], [ -- AC_MSG_ERROR([cannot find wget or ftp]) +- FETCHER="$FALSE" +- AC_MSG_WARN([cannot find wget or ftp]) - ]) -]) +FETCHER="/bin/false Refusing to download" diff --git a/xen-pkgconfigdir.patch b/xen-pkgconfigdir.patch deleted file mode 100644 index f1d5f97..0000000 --- a/xen-pkgconfigdir.patch +++ /dev/null @@ -1,9 +0,0 @@ -pkg-config files are arch-dependent (due to libdir usage), so use arch-dependent location. ---- xen-4.9.0/config/Paths.mk.in.orig 2017-06-27 20:13:19.000000000 +0200 -+++ xen-4.9.0/config/Paths.mk.in 2017-07-31 20:59:29.558580546 +0200 -@@ -57,4 +57,4 @@ - XEN_CONFIG_DIR := @XEN_CONFIG_DIR@ - XEN_SCRIPT_DIR := @XEN_SCRIPT_DIR@ - --PKG_INSTALLDIR := ${SHAREDIR}/pkgconfig -+PKG_INSTALLDIR := ${libdir}/pkgconfig diff --git a/xen-symbols.patch b/xen-symbols.patch index db30fd8..e5ca4a8 100644 --- a/xen-symbols.patch +++ b/xen-symbols.patch @@ -7,6 +7,6 @@ diff -dur xen-4.2.0.orig/tools/libfsimage/common/Makefile xen-4.2.0/tools/libfsi LDFLAGS-$(CONFIG_SunOS) = -Wl,-M -Wl,mapfile-SunOS -LDFLAGS-$(CONFIG_Linux) = -Wl,mapfile-GNU +LDFLAGS-$(CONFIG_Linux) = -Wl,mapfile-GNU -ldl - LDFLAGS = $(LDFLAGS-y) + LDFLAGS += $(LDFLAGS-y) CFLAGS += $(PTHREAD_CFLAGS) diff --git a/xen.spec b/xen.spec index 5755ef2..1afb03a 100644 --- a/xen.spec +++ b/xen.spec @@ -85,20 +85,19 @@ Patch0: %{name}-python_scripts.patch Patch1: %{name}-symbols.patch Patch2: %{name}-link.patch Patch3: pygrubfix.patch -Patch4: %{name}-pkgconfigdir.patch # Warning: this disables ingress filtering implemented in xen scripts! -Patch7: %{name}-net-disable-iptables-on-bridge.patch -Patch10: %{name}-qemu.patch -Patch12: %{name}-doc.patch -Patch13: %{name}-paths.patch -Patch14: %{name}-no_fetcher.patch -Patch15: odd-glib2-fix.patch -Patch18: %{name}-make.patch -Patch19: %{name}-no_Werror.patch -Patch22: %{name}-stubdom-build.patch -Patch23: link.patch -Patch24: %{name}-systemd.patch -Patch28: sysmacros.patch +Patch4: %{name}-net-disable-iptables-on-bridge.patch +Patch5: %{name}-qemu.patch +Patch6: %{name}-doc.patch +Patch7: %{name}-paths.patch +Patch8: %{name}-no_fetcher.patch +Patch9: %{name}-no_Werror.patch +Patch10: %{name}-stubdom-build.patch +Patch11: link.patch +Patch12: %{name}-systemd.patch +Patch13: sysmacros.patch +Patch14: gcc9.patch +Patch15: gcc10.patch URL: http://www.xen.org/products/xenhyp.html BuildRequires: autoconf >= 2.67 %ifarch %{ix86} %{x8664} @@ -390,18 +389,17 @@ Nadzorca Xen w postaci, która może być uruchomiona wprost z firmware %patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 +%patch6 -p1 %patch7 -p1 +%patch8 -p1 +%patch9 -p1 %patch10 -p1 +%patch11 -p1 %patch12 -p1 %patch13 -p1 %patch14 -p1 %patch15 -p1 -%patch18 -p1 -%patch19 -p1 -%patch22 -p1 -%patch23 -p1 -%patch24 -p1 -%patch28 -p1 # stubdom sources ln -s %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} %{SOURCE14} stubdom @@ -428,12 +426,10 @@ install -d our-ld ln -f -s /usr/bin/ld.bfd our-ld/ld export PATH=$(pwd)/our-ld:$PATH -export CFLAGS="%{rpmcflags} -I/usr/include/ncurses" -export CXXFLAGS="%{rpmcflags} -I/usr/include/ncurses" - # NOTE on ac_cv_*: # - use openssl (libcrypto) instead of libgcrypt as openssl is obligatory anyway # - prevent libiconv from being detected (not needed with glibc) + %configure \ CPPFLAGS="%{rpmcppflags} -I/usr/include/ncurses" \ ac_cv_lib_gcrypt_gcry_md_hash_buffer=no \ @@ -448,18 +444,19 @@ export CXXFLAGS="%{rpmcflags} -I/usr/include/ncurses" %endif --with-systemd=%{systemdunitdir} -%{__make} -j1 dist-xen dist-tools dist-docs \ +export EXTRA_CFLAGS_XEN_TOOLS="%{rpmcflags} -I/usr/include/ncurses" +export EXTRA_CFLAGS_QEMU_TRADITIONAL="%{rpmcflags} -I/usr/include/ncurses" +export EXTRA_CFLAGS_QEMU_XEN="%{rpmcflags} -I/usr/include/ncurses" + +%{__make} dist-xen dist-tools dist-docs \ %{!?with_ocaml:OCAML_TOOLS=n} \ XSM_ENABLE=%{?with_xsm:y}%{!?with_xsm:n} \ CC="%{__cc}" \ CXX="%{__cxx}" \ V=1 -unset CFLAGS -unset CXXFLAGS - %if %{with stubdom} -%{__make} -j1 dist-stubdom \ +%{__make} dist-stubdom \ %{!?with_ocaml:OCAML_TOOLS=n} \ XSM_ENABLE=%{?with_xsm:y}%{!?with_xsm:n} \ CC="%{__cc}" \ @@ -476,7 +473,7 @@ install -d $RPM_BUILD_ROOT/etc/{xen/examples,modules-load.d,logrotate.d} \ install -d $RPM_BUILD_ROOT/etc/efi-boot/update.d %endif -%{__make} -j1 install-xen install-tools %{?with_stubdom:install-stubdom} install-docs \ +%{__make} install-xen install-tools %{?with_stubdom:install-stubdom} install-docs \ %{!?with_ocaml:OCAML_TOOLS=n} \ XSM_ENABLE=%{?with_xsm:y}%{!?with_xsm:n} \ DESTDIR=$RPM_BUILD_ROOT \ -- 2.43.0