summaryrefslogtreecommitdiff
path: root/sysutils/xentools45
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2015-01-29 21:33:47 +0000
committerjoerg <joerg@pkgsrc.org>2015-01-29 21:33:47 +0000
commit5f598016d06523995ccb3cab8744ec4d5d785dae (patch)
tree2e4c364a725638d4fd02437cb854073e53573553 /sysutils/xentools45
parent67b03897208f601cd37e28b3c5a8e50dda68ec6f (diff)
downloadpkgsrc-5f598016d06523995ccb3cab8744ec4d5d785dae.tar.gz
Fix build with clang and on NetBSD/current.
Diffstat (limited to 'sysutils/xentools45')
-rw-r--r--sysutils/xentools45/Makefile5
-rw-r--r--sysutils/xentools45/distinfo8
-rw-r--r--sysutils/xentools45/patches/patch-.._.._ipxe_src_interface_efi_efi_snp.c42
-rw-r--r--sysutils/xentools45/patches/patch-.._.._ipxe_src_net_fcels.c124
-rw-r--r--sysutils/xentools45/patches/patch-.._.._ipxe_src_net_tls.c70
-rw-r--r--sysutils/xentools45/patches/patch-Rules.mk50
-rw-r--r--sysutils/xentools45/patches/patch-libxl_libxl__save__helper.c12
-rw-r--r--sysutils/xentools45/patches/patch-qemu-xen_xen-hvm.c13
8 files changed, 321 insertions, 3 deletions
diff --git a/sysutils/xentools45/Makefile b/sysutils/xentools45/Makefile
index 898594cc9c6..9eb1d22c31b 100644
--- a/sysutils/xentools45/Makefile
+++ b/sysutils/xentools45/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2015/01/27 14:52:56 prlw1 Exp $
+# $NetBSD: Makefile,v 1.4 2015/01/29 21:33:47 joerg Exp $
VERSION= 4.5.0
VERSION_IPXE= 9a93db3f0947484e30e753bbd61a10b17336e20e
@@ -195,7 +195,8 @@ EXTRA_CFLAGS+= -Wno-error=ignored-attributes -no-integrated-as \
-Wno-error=unused-function -Wno-error=format \
-Wno-error=unused-const-variable \
-Wno-error=gnu-designator -Wno-error=uninitialized \
- -Wno-error=parentheses-equality
+ -Wno-error=parentheses-equality \
+ -Wno-error=enum-conversion
BUILDLINK_TRANSFORM+= rm:-falign-jumps=1 rm:-falign-loops=1 \
rm:-mpreferred-stack-boundary=2
.endif
diff --git a/sysutils/xentools45/distinfo b/sysutils/xentools45/distinfo
index 5ac6c683b3c..71d3030c265 100644
--- a/sysutils/xentools45/distinfo
+++ b/sysutils/xentools45/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.3 2015/01/25 13:14:46 joerg Exp $
+$NetBSD: distinfo,v 1.4 2015/01/29 21:33:47 joerg Exp $
SHA1 (ipxe-git-9a93db3f0947484e30e753bbd61a10b17336e20e.tar.gz) = fecadf952821e830ce1a1d19655288eef8488f88
RMD160 (ipxe-git-9a93db3f0947484e30e753bbd61a10b17336e20e.tar.gz) = 539bfa12db7054228250d6dd380bbf96c1a040f8
@@ -7,12 +7,16 @@ SHA1 (xen-4.5.0.tar.gz) = c4aab5fb366496ad1edc7fe0a935a0d604335637
RMD160 (xen-4.5.0.tar.gz) = e35ba0cb484492c1a289218eb9bf53b57dbd3a45
Size (xen-4.5.0.tar.gz) = 18404933 bytes
SHA1 (patch-.._.._ipxe_src_core_settings.c) = 9e053e5e9936f49c46af0d59382a67d5f28cb39d
+SHA1 (patch-.._.._ipxe_src_interface_efi_efi_snp.c) = 7cd8a2d2dbeff55624b5d3461d22cd8331221762
+SHA1 (patch-.._.._ipxe_src_net_fcels.c) = 7c13c87af5e38233f8b867503789f536394e7005
+SHA1 (patch-.._.._ipxe_src_net_tls.c) = c36b812c4c9a3aa7309219dfad2f7a24ba818e59
SHA1 (patch-.._Config.mk) = 36a8942a9fc0f7d601c9b5f7fd1332db99f9ac4b
SHA1 (patch-.._docs_man_xl.cfg.pod.5) = e2058495b6fe85af338e22560d46996d36aeedab
SHA1 (patch-.._docs_man_xl.conf.pod.5) = 015da24a45388468d56f1ecfa60f6acf07bdfef8
SHA1 (patch-.._docs_man_xl.pod.1) = b194f2c5608c6f0e80a4abd8655808cf91355cd5
SHA1 (patch-.._docs_man_xlcpupool.cfg.pod.5) = b44813af965e4d9d0d51c18b22d286736a4663b2
SHA1 (patch-Makefile) = 5d5b9678ed9764275ee95f49d24e8538a0e8a01c
+SHA1 (patch-Rules.mk) = e0dc4234c35dc2d78afad4a90b0af829a6a10b50
SHA1 (patch-blktap_drivers_Makefile) = 7cc53b2a0dea1694a969046ab8542271ca63f9e7
SHA1 (patch-configure) = d1a1b9c9e00dd79bb872190282006201510ce2c1
SHA1 (patch-examples_Makefile) = 5fe7bb876d254cf0c4f774ed0f08dcaea5b355ff
@@ -29,6 +33,7 @@ SHA1 (patch-libfsimage_ufs_ufs.h) = ce1461ab83499edb4e127e3b7af9dfc1e9c0267f
SHA1 (patch-libxc_xc__netbsd.c) = 547a713bbe9ddc92ee51b57a7b58a619f01225f1
SHA1 (patch-libxl_Makefile) = 5b5dede29e5d9c579cdd7d6497f692ecf3a3c2cb
SHA1 (patch-libxl_libxl__create.c) = d4c94e9a389e9a7601513460f31c82e4f4bf28c9
+SHA1 (patch-libxl_libxl__save__helper.c) = 70e5237e28bea1aa87486e080fc25aa81300a6d8
SHA1 (patch-libxl_libxl_uuid.c) = d14286be8ccdbcb5fae544a1968e7b681b63e884
SHA1 (patch-ocaml_common.make) = 4d4bddca7b5d93489a3f6620af51d95bbe265abb
SHA1 (patch-ocaml_xenstored_Makefile) = 8014db42b65ca9290013069d1f3cb816e3f023c2
@@ -51,4 +56,5 @@ SHA1 (patch-qemu-xen-traditional_xen-hooks.mak) = ccc055fdb56ee796e1464f709aa576
SHA1 (patch-qemu-xen_audio_audio.c) = 8452d63fe90e38a64111d0cf425bacd565fe6d82
SHA1 (patch-qemu-xen_qemu-doc.texi) = 721e80d15ac30ac71df3d6c4c485b0bf70897cf9
SHA1 (patch-qemu-xen_util_hbitmap.c) = 5a495ae2b47d1ff6dd342633b8d655582f21dffe
+SHA1 (patch-qemu-xen_xen-hvm.c) = 11d4deb5de577e8beb2d1c6c3ca886e3d7563f8a
SHA1 (patch-xenstore_xc.c) = 51b39e9929062e72d0ff85f0ee6d13a6ac04ac65
diff --git a/sysutils/xentools45/patches/patch-.._.._ipxe_src_interface_efi_efi_snp.c b/sysutils/xentools45/patches/patch-.._.._ipxe_src_interface_efi_efi_snp.c
new file mode 100644
index 00000000000..2f94d6b292c
--- /dev/null
+++ b/sysutils/xentools45/patches/patch-.._.._ipxe_src_interface_efi_efi_snp.c
@@ -0,0 +1,42 @@
+$NetBSD: patch-.._.._ipxe_src_interface_efi_efi_snp.c,v 1.1 2015/01/29 21:33:47 joerg Exp $
+
+--- ../../ipxe/src/interface/efi/efi_snp.c.orig 2015-01-25 20:37:13.000000000 +0000
++++ ../../ipxe/src/interface/efi/efi_snp.c
+@@ -984,15 +984,16 @@ efi_snp_package_list ( struct efi_snp_de
+ struct efi_snp_formset formset;
+ union {
+ EFI_HII_STRING_PACKAGE_HDR strings;
+- uint8_t pad[strings_len];
+ } __attribute__ (( packed )) strings;
+- EFI_HII_PACKAGE_HEADER end;
+ } __attribute__ (( packed )) *package_list;
++ EFI_HII_PACKAGE_HEADER *end;
++ size_t plen = sizeof(*package_list) + strings_len + sizeof(*end);
+
+ /* Allocate package list */
+- package_list = zalloc ( sizeof ( *package_list ) );
++ package_list = zalloc ( plen );
+ if ( ! package_list )
+ return NULL;
++ end = (char *)package_list + plen - sizeof(*end);
+
+ /* Create a unique GUID for this package list and formset */
+ efi_snp_formset.FormSet.FormSet.Guid.Data1++;
+@@ -1001,13 +1002,13 @@ efi_snp_package_list ( struct efi_snp_de
+ memcpy ( &package_list->header.PackageListGuid,
+ &efi_snp_formset.FormSet.FormSet.Guid,
+ sizeof ( package_list->header.PackageListGuid ) );
+- package_list->header.PackageLength = sizeof ( *package_list );
++ package_list->header.PackageLength = plen;
+ memcpy ( &package_list->formset, &efi_snp_formset,
+ sizeof ( package_list->formset ) );
+ efi_snp_strings ( &package_list->strings.strings,
+- sizeof ( package_list->strings ), snpdev );
+- package_list->end.Length = sizeof ( package_list->end );
+- package_list->end.Type = EFI_HII_PACKAGE_END;
++ strings_len, snpdev );
++ end->Length = sizeof ( *end );
++ end->Type = EFI_HII_PACKAGE_END;
+
+ return &package_list->header;
+ }
diff --git a/sysutils/xentools45/patches/patch-.._.._ipxe_src_net_fcels.c b/sysutils/xentools45/patches/patch-.._.._ipxe_src_net_fcels.c
new file mode 100644
index 00000000000..9b496f78d43
--- /dev/null
+++ b/sysutils/xentools45/patches/patch-.._.._ipxe_src_net_fcels.c
@@ -0,0 +1,124 @@
+$NetBSD: patch-.._.._ipxe_src_net_fcels.c,v 1.1 2015/01/29 21:33:47 joerg Exp $
+
+--- ../../ipxe/src/net/fcels.c.orig 2015-01-25 20:27:57.000000000 +0000
++++ ../../ipxe/src/net/fcels.c
+@@ -946,8 +946,11 @@ int fc_els_prli_tx ( struct fc_els *els,
+ struct fc_els_prli_descriptor *descriptor, void *param ) {
+ struct {
+ struct fc_prli_frame frame;
+- uint8_t param[descriptor->param_len];
+- } __attribute__ (( packed )) prli;
++ uint8_t param[];
++ } __attribute__ (( packed )) *prli;
++ size_t plen = sizeof(*prli) + descriptor->param_len;
++ uint8_t prli_buf[plen];
++ prli = (void *)prli_buf;
+ struct fc_ulp *ulp;
+ int rc;
+
+@@ -960,22 +963,22 @@ int fc_els_prli_tx ( struct fc_els *els,
+ }
+
+ /* Build frame for transmission */
+- memset ( &prli, 0, sizeof ( prli ) );
+- prli.frame.command = fc_els_tx_command ( els, FC_ELS_PRLI );
+- prli.frame.page_len =
+- ( sizeof ( prli.frame.page ) + sizeof ( prli.param ) );
+- prli.frame.len = htons ( sizeof ( prli ) );
+- prli.frame.page.type = descriptor->type;
++ memset ( prli, 0, plen );
++ prli->frame.command = fc_els_tx_command ( els, FC_ELS_PRLI );
++ prli->frame.page_len =
++ ( sizeof ( prli->frame.page ) + descriptor->param_len );
++ prli->frame.len = htons ( plen );
++ prli->frame.page.type = descriptor->type;
+ if ( fc_els_is_request ( els ) ) {
+- prli.frame.page.flags |= htons ( FC_PRLI_ESTABLISH );
++ prli->frame.page.flags |= htons ( FC_PRLI_ESTABLISH );
+ } else if ( fc_link_ok ( &ulp->link ) ) {
+- prli.frame.page.flags |= htons ( FC_PRLI_ESTABLISH |
++ prli->frame.page.flags |= htons ( FC_PRLI_ESTABLISH |
+ FC_PRLI_RESPONSE_SUCCESS );
+ }
+- memcpy ( &prli.param, param, sizeof ( prli.param ) );
++ memcpy ( &prli->param, param, descriptor->param_len );
+
+ /* Transmit frame */
+- if ( ( rc = fc_els_tx ( els, &prli, sizeof ( prli ) ) ) != 0 )
++ if ( ( rc = fc_els_tx ( els, prli, plen ) ) != 0 )
+ goto err_tx;
+
+ /* Drop temporary reference to ULP */
+@@ -1003,13 +1006,14 @@ int fc_els_prli_rx ( struct fc_els *els,
+ void *data, size_t len ) {
+ struct {
+ struct fc_prli_frame frame;
+- uint8_t param[descriptor->param_len];
++ uint8_t param[];
+ } __attribute__ (( packed )) *prli = data;
++ size_t plen = sizeof(*prli) + descriptor->param_len;
+ struct fc_ulp *ulp;
+ int rc;
+
+ /* Sanity check */
+- if ( len < sizeof ( *prli ) ) {
++ if ( len < plen ) {
+ DBGC ( els, FCELS_FMT " received underlength frame:\n",
+ FCELS_ARGS ( els ) );
+ DBGC_HDA ( els, 0, data, len );
+@@ -1018,7 +1022,7 @@ int fc_els_prli_rx ( struct fc_els *els,
+ }
+
+ DBGC ( els, FCELS_FMT " has parameters:\n", FCELS_ARGS ( els ) );
+- DBGC_HDA ( els, 0, prli->param, sizeof ( prli->param ) );
++ DBGC_HDA ( els, 0, prli->param, descriptor->param_len );
+
+ /* Get ULP */
+ ulp = fc_ulp_get_port_id_type ( els->port, &els->peer_port_id,
+@@ -1039,7 +1043,7 @@ int fc_els_prli_rx ( struct fc_els *els,
+ /* Log in ULP, if applicable */
+ if ( prli->frame.page.flags & htons ( FC_PRLI_ESTABLISH ) ) {
+ if ( ( rc = fc_ulp_login ( ulp, prli->param,
+- sizeof ( prli->param ),
++ descriptor->param_len,
+ fc_els_is_request ( els ) ) ) != 0 ){
+ DBGC ( els, FCELS_FMT " could not log in ULP: %s\n",
+ FCELS_ARGS ( els ), strerror ( rc ) );
+@@ -1089,15 +1093,16 @@ int fc_els_prli_detect ( struct fc_els *
+ const void *data, size_t len ) {
+ const struct {
+ struct fc_prli_frame frame;
+- uint8_t param[descriptor->param_len];
++ uint8_t param[];
+ } __attribute__ (( packed )) *prli = data;
++ size_t plen = sizeof(*prli) + descriptor->param_len;
+
+ /* Check for PRLI */
+ if ( prli->frame.command != FC_ELS_PRLI )
+ return -EINVAL;
+
+ /* Check for sufficient length to contain service parameter page */
+- if ( len < sizeof ( *prli ) )
++ if ( len < plen )
+ return -EINVAL;
+
+ /* Check for upper-layer protocol type */
+@@ -1252,15 +1257,16 @@ static int fc_els_echo_rx_request ( stru
+ size_t len ) {
+ struct {
+ struct fc_echo_frame_header echo;
+- char payload[ len - sizeof ( struct fc_echo_frame_header ) ];
++ char payload[];
+ } *echo = data;
++ size_t plen = suzeif(*echo) + len - sizeof ( struct fc_echo_frame_header );
+ int rc;
+
+ DBGC ( els, FCELS_FMT "\n", FCELS_ARGS ( els ) );
+
+ /* Transmit response */
+ echo->echo.command = FC_ELS_LS_ACC;
+- if ( ( rc = fc_els_tx ( els, echo, sizeof ( *echo ) ) ) != 0 )
++ if ( ( rc = fc_els_tx ( els, echo, plen ) ) != 0 )
+ return rc;
+
+ /* Nothing to do */
diff --git a/sysutils/xentools45/patches/patch-.._.._ipxe_src_net_tls.c b/sysutils/xentools45/patches/patch-.._.._ipxe_src_net_tls.c
new file mode 100644
index 00000000000..06ef1bf64f2
--- /dev/null
+++ b/sysutils/xentools45/patches/patch-.._.._ipxe_src_net_tls.c
@@ -0,0 +1,70 @@
+$NetBSD: patch-.._.._ipxe_src_net_tls.c,v 1.1 2015/01/29 21:33:47 joerg Exp $
+
+--- ../../ipxe/src/net/tls.c.orig 2010-02-02 17:12:44.000000000 +0100
++++ ../../ipxe/src/net/tls.c 2013-05-26 20:05:24.000000000 +0200
+@@ -704,18 +704,23 @@ static int tls_send_client_key_exchange
+ RSA_CTX *rsa_ctx;
+ RSA_pub_key_new ( &rsa_ctx, tls->rsa.modulus, tls->rsa.modulus_len,
+ tls->rsa.exponent, tls->rsa.exponent_len );
++ size_t elen = rsa_ctx->num_octets;
+ struct {
+ uint32_t type_length;
+ uint16_t encrypted_pre_master_secret_len;
+- uint8_t encrypted_pre_master_secret[rsa_ctx->num_octets];
+- } __attribute__ (( packed )) key_xchg;
+-
+- memset ( &key_xchg, 0, sizeof ( key_xchg ) );
+- key_xchg.type_length = ( cpu_to_le32 ( TLS_CLIENT_KEY_EXCHANGE ) |
+- htonl ( sizeof ( key_xchg ) -
+- sizeof ( key_xchg.type_length ) ) );
+- key_xchg.encrypted_pre_master_secret_len
+- = htons ( sizeof ( key_xchg.encrypted_pre_master_secret ) );
++ uint8_t encrypted_pre_master_secret[];
++ } __attribute__ (( packed )) *key_xchg;
++ size_t klen = sizeof(*key_xchg) + elen;
++ char key_xchg_buf[klen];
++
++ key_xchg = (void *)key_xchg;
++
++ memset ( key_xchg, 0, klen );
++ key_xchg->type_length = ( cpu_to_le32 ( TLS_CLIENT_KEY_EXCHANGE ) |
++ htonl ( klen -
++ sizeof ( key_xchg->type_length ) ) );
++ key_xchg->encrypted_pre_master_secret_len
++ = htons ( elen );
+
+ /* FIXME: Hack alert */
+ DBGC ( tls, "RSA encrypting plaintext, modulus, exponent:\n" );
+@@ -725,14 +730,13 @@ static int tls_send_client_key_exchange
+ DBGC_HD ( tls, tls->rsa.exponent, tls->rsa.exponent_len );
+ RSA_encrypt ( rsa_ctx, ( const uint8_t * ) &tls->pre_master_secret,
+ sizeof ( tls->pre_master_secret ),
+- key_xchg.encrypted_pre_master_secret, 0 );
++ key_xchg->encrypted_pre_master_secret, 0 );
+ DBGC ( tls, "RSA encrypt done. Ciphertext:\n" );
+- DBGC_HD ( tls, &key_xchg.encrypted_pre_master_secret,
+- sizeof ( key_xchg.encrypted_pre_master_secret ) );
++ DBGC_HD ( tls, &key_xchg->encrypted_pre_master_secret, elen );
+ RSA_free ( rsa_ctx );
+
+
+- return tls_send_handshake ( tls, &key_xchg, sizeof ( key_xchg ) );
++ return tls_send_handshake ( tls, key_xchg, klen );
+ }
+
+ /**
+@@ -856,12 +860,12 @@ static int tls_new_server_hello ( struct
+ uint8_t session_id_len;
+ char next[0];
+ } __attribute__ (( packed )) *hello_a = data;
++ size_t slen = hello_a->session_id_len;
+ struct {
+- uint8_t session_id[hello_a->session_id_len];
+ uint16_t cipher_suite;
+ uint8_t compression_method;
+ char next[0];
+- } __attribute__ (( packed )) *hello_b = ( void * ) &hello_a->next;
++ } __attribute__ (( packed )) *hello_b = ( void * ) ((uint8_t *)&hello_a->next + slen);
+ void *end = hello_b->next;
+ int rc;
+
diff --git a/sysutils/xentools45/patches/patch-Rules.mk b/sysutils/xentools45/patches/patch-Rules.mk
new file mode 100644
index 00000000000..bb96388705a
--- /dev/null
+++ b/sysutils/xentools45/patches/patch-Rules.mk
@@ -0,0 +1,50 @@
+$NetBSD: patch-Rules.mk,v 1.1 2015/01/29 21:33:47 joerg Exp $
+
+--- Rules.mk.orig 2015-01-12 16:53:24.000000000 +0000
++++ Rules.mk
+@@ -36,30 +36,30 @@ endif
+
+ CFLAGS_libxenctrl = -I$(XEN_LIBXC)/include $(CFLAGS_xeninclude)
+ LDLIBS_libxenctrl = $(XEN_LIBXC)/libxenctrl$(libextension)
+-SHLIB_libxenctrl = -Wl,-rpath-link=$(XEN_LIBXC)
++SHLIB_libxenctrl = -Wl,-rpath-link,$(XEN_LIBXC)
+
+ CFLAGS_libxenguest = -I$(XEN_LIBXC)/include $(CFLAGS_xeninclude)
+ LDLIBS_libxenguest = $(XEN_LIBXC)/libxenguest$(libextension)
+-SHLIB_libxenguest = -Wl,-rpath-link=L$(XEN_LIBXC)
++SHLIB_libxenguest = -Wl,-rpath-link,$(XEN_LIBXC)
+
+ CFLAGS_libxenstore = -I$(XEN_XENSTORE)/include $(CFLAGS_xeninclude)
+ LDLIBS_libxenstore = $(XEN_XENSTORE)/libxenstore$(libextension)
+-SHLIB_libxenstore = -Wl,-rpath-link=$(XEN_XENSTORE)
++SHLIB_libxenstore = -Wl,-rpath-link,$(XEN_XENSTORE)
+
+ CFLAGS_libxenstat = -I$(XEN_LIBXENSTAT)
+ LDLIBS_libxenstat = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(XEN_LIBXENSTAT)/libxenstat$(libextension)
+-SHLIB_libxenstat = -Wl,-rpath-link=$(XEN_LIBXENSTAT)
++SHLIB_libxenstat = -Wl,-rpath-link,$(XEN_LIBXENSTAT)
+
+ CFLAGS_libxenvchan = -I$(XEN_LIBVCHAN)
+ LDLIBS_libxenvchan = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) -L$(XEN_LIBVCHAN) -lxenvchan
+-SHLIB_libxenvchan = -Wl,-rpath-link=$(XEN_LIBVCHAN)
++SHLIB_libxenvchan = -Wl,-rpath-link,$(XEN_LIBVCHAN)
+
+ LIBXL_BLKTAP ?= $(CONFIG_BLKTAP2)
+
+ ifeq ($(LIBXL_BLKTAP),y)
+ CFLAGS_libblktapctl = -I$(XEN_BLKTAP2)/control -I$(XEN_BLKTAP2)/include $(CFLAGS_xeninclude)
+ LDLIBS_libblktapctl = -L$(XEN_BLKTAP2)/control -lblktapctl
+-SHLIB_libblktapctl = -Wl,-rpath-link=$(XEN_BLKTAP2)/control
++SHLIB_libblktapctl = -Wl,-rpath-link,$(XEN_BLKTAP2)/control
+ else
+ CFLAGS_libblktapctl =
+ LDLIBS_libblktapctl =
+@@ -68,7 +68,7 @@ endif
+
+ CFLAGS_libxenlight = -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude)
+ LDLIBS_libxenlight = $(XEN_XENLIGHT)/libxenlight$(libextension) $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libblktapctl)
+-SHLIB_libxenlight = -Wl,-rpath-link=$(XEN_XENLIGHT)
++SHLIB_libxenlight = -Wl,-rpath-link,$(XEN_XENLIGHT)
+
+ CFLAGS += -D__XEN_TOOLS__
+
diff --git a/sysutils/xentools45/patches/patch-libxl_libxl__save__helper.c b/sysutils/xentools45/patches/patch-libxl_libxl__save__helper.c
new file mode 100644
index 00000000000..fc48e91e736
--- /dev/null
+++ b/sysutils/xentools45/patches/patch-libxl_libxl__save__helper.c
@@ -0,0 +1,12 @@
+$NetBSD: patch-libxl_libxl__save__helper.c,v 1.1 2015/01/29 21:33:47 joerg Exp $
+
+--- libxl/libxl_save_helper.c.orig 2015-01-25 21:04:31.000000000 +0000
++++ libxl/libxl_save_helper.c
+@@ -49,6 +49,7 @@
+
+ /*----- logger -----*/
+
++__attribute__((__format__(__printf__, 5, 0)))
+ static void tellparent_vmessage(xentoollog_logger *logger_in,
+ xentoollog_level level,
+ int errnoval,
diff --git a/sysutils/xentools45/patches/patch-qemu-xen_xen-hvm.c b/sysutils/xentools45/patches/patch-qemu-xen_xen-hvm.c
new file mode 100644
index 00000000000..ad9a74a4ce1
--- /dev/null
+++ b/sysutils/xentools45/patches/patch-qemu-xen_xen-hvm.c
@@ -0,0 +1,13 @@
+$NetBSD: patch-qemu-xen_xen-hvm.c,v 1.1 2015/01/29 21:33:47 joerg Exp $
+
+--- qemu-xen/xen-hvm.c.orig 2015-01-25 20:59:13.000000000 +0000
++++ qemu-xen/xen-hvm.c
+@@ -528,7 +528,7 @@ static void xen_sync_dirty_bitmap(XenIOS
+ for (i = 0; i < ARRAY_SIZE(bitmap); i++) {
+ unsigned long map = bitmap[i];
+ while (map != 0) {
+- j = ffsl(map) - 1;
++ j = __builtin_ffsl(map) - 1;
+ map &= ~(1ul << j);
+ memory_region_set_dirty(framebuffer,
+ (i * width + j) * TARGET_PAGE_SIZE,