summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomáš Mózes <hydrapolic@gmail.com>2021-10-20 12:40:08 +0000
committerSam James <sam@gentoo.org>2021-10-21 04:19:53 +0000
commitfcdbfdb8dd89d3b47067b235218955a15c0dd2ed (patch)
treeb000abd0c309cb2d1e8583a1f0ac2ae858183daa /app-emulation/xen-tools/files
parentsci-geosciences/mapserver: added patch to find oracle libnnz21 library (diff)
downloadgentoo-fcdbfdb8dd89d3b47067b235218955a15c0dd2ed.tar.gz
gentoo-fcdbfdb8dd89d3b47067b235218955a15c0dd2ed.tar.bz2
gentoo-fcdbfdb8dd89d3b47067b235218955a15c0dd2ed.zip
app-emulation/xen-tools: fix building with ocaml-4.12
Closes: https://bugs.gentoo.org/818100 Signed-off-by: Tomáš Mózes <hydrapolic@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'app-emulation/xen-tools/files')
-rw-r--r--app-emulation/xen-tools/files/xen-tools-4.15.1-ocaml-4.12.patch101
1 files changed, 101 insertions, 0 deletions
diff --git a/app-emulation/xen-tools/files/xen-tools-4.15.1-ocaml-4.12.patch b/app-emulation/xen-tools/files/xen-tools-4.15.1-ocaml-4.12.patch
new file mode 100644
index 000000000000..b06a7f195bfa
--- /dev/null
+++ b/app-emulation/xen-tools/files/xen-tools-4.15.1-ocaml-4.12.patch
@@ -0,0 +1,101 @@
+From 2d1a35f1e6c2113a6322fdb758a198608c90e4bd Mon Sep 17 00:00:00 2001
+From: Costin Lupu <costin.lupu@cs.pub.ro>
+Date: Tue, 8 Jun 2021 15:35:29 +0300
+Subject: [PATCH] tools/ocaml: Fix redefinition errors
+
+If PAGE_SIZE is already defined in the system (e.g. in /usr/include/limits.h
+header) then gcc will trigger a redefinition error because of -Werror. This
+patch replaces usage of PAGE_* macros with XC_PAGE_* macros in order to avoid
+confusion between control domain page granularity (PAGE_* definitions) and
+guest domain page granularity (which is what we are dealing with here).
+
+Same issue applies for redefinitions of Val_none and Some_val macros which
+can be already define in the OCaml system headers (e.g.
+/usr/lib/ocaml/caml/mlvalues.h).
+
+Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
+Reviewed-by: Julien Grall <jgrall@amazon.com>
+Acked-by: Ian Jackson <iwj@xenproject.org>
+Tested-by: Dario Faggioli <dfaggioli@suse.com>
+---
+ tools/ocaml/libs/xc/xenctrl_stubs.c | 10 ++++------
+ tools/ocaml/libs/xentoollog/xentoollog_stubs.c | 4 ++++
+ tools/ocaml/libs/xl/xenlight_stubs.c | 4 ++++
+ 3 files changed, 12 insertions(+), 6 deletions(-)
+
+diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
+index 6e4bc567f5..a6756c4a8c 100644
+--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
++++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
+@@ -37,14 +37,12 @@
+
+ #include "mmap_stubs.h"
+
+-#define PAGE_SHIFT 12
+-#define PAGE_SIZE (1UL << PAGE_SHIFT)
+-#define PAGE_MASK (~(PAGE_SIZE-1))
+-
+ #define _H(__h) ((xc_interface *)(__h))
+ #define _D(__d) ((uint32_t)Int_val(__d))
+
++#ifndef Val_none
+ #define Val_none (Val_int(0))
++#endif
+
+ #define string_of_option_array(array, index) \
+ ((Field(array, index) == Val_none) ? NULL : String_val(Field(Field(array, index), 0)))
+@@ -819,7 +817,7 @@ CAMLprim value stub_xc_domain_memory_increase_reservation(value xch,
+ CAMLparam3(xch, domid, mem_kb);
+ int retval;
+
+- unsigned long nr_extents = ((unsigned long)(Int64_val(mem_kb))) >> (PAGE_SHIFT - 10);
++ unsigned long nr_extents = ((unsigned long)(Int64_val(mem_kb))) >> (XC_PAGE_SHIFT - 10);
+
+ uint32_t c_domid = _D(domid);
+ caml_enter_blocking_section();
+@@ -925,7 +923,7 @@ CAMLprim value stub_pages_to_kib(value pages)
+ {
+ CAMLparam1(pages);
+
+- CAMLreturn(caml_copy_int64(Int64_val(pages) << (PAGE_SHIFT - 10)));
++ CAMLreturn(caml_copy_int64(Int64_val(pages) << (XC_PAGE_SHIFT - 10)));
+ }
+
+
+diff --git a/tools/ocaml/libs/xentoollog/xentoollog_stubs.c b/tools/ocaml/libs/xentoollog/xentoollog_stubs.c
+index bf64b211c2..e4306a0c2f 100644
+--- a/tools/ocaml/libs/xentoollog/xentoollog_stubs.c
++++ b/tools/ocaml/libs/xentoollog/xentoollog_stubs.c
+@@ -53,8 +53,12 @@ static char * dup_String_val(value s)
+ #include "_xtl_levels.inc"
+
+ /* Option type support as per http://www.linux-nantes.org/~fmonnier/ocaml/ocaml-wrapping-c.php */
++#ifndef Val_none
+ #define Val_none Val_int(0)
++#endif
++#ifndef Some_val
+ #define Some_val(v) Field(v,0)
++#endif
+
+ static value Val_some(value v)
+ {
+diff --git a/tools/ocaml/libs/xl/xenlight_stubs.c b/tools/ocaml/libs/xl/xenlight_stubs.c
+index 352a00134d..45b8af61c7 100644
+--- a/tools/ocaml/libs/xl/xenlight_stubs.c
++++ b/tools/ocaml/libs/xl/xenlight_stubs.c
+@@ -227,8 +227,12 @@ static value Val_string_list(libxl_string_list *c_val)
+ }
+
+ /* Option type support as per http://www.linux-nantes.org/~fmonnier/ocaml/ocaml-wrapping-c.php */
++#ifndef Val_none
+ #define Val_none Val_int(0)
++#endif
++#ifndef Some_val
+ #define Some_val(v) Field(v,0)
++#endif
+
+ static value Val_some(value v)
+ {
+--
+2.30.2
+