[Pkg-ocaml-maint-commits] [SCM] bin-prot packaging branch, master, updated. debian/1.2.24-1-17-ga2c5a54

Stephane Glondu steph at glondu.net
Wed Jul 13 21:17:48 UTC 2011


The following commit has been merged in the master branch:
commit 51e0f46c4068b918f796e2150670f1ea8f0b55bc
Author: Stephane Glondu <steph at glondu.net>
Date:   Wed Jul 13 21:09:35 2011 +0200

    Fix alignment issues (e.g. mipsel)

diff --git a/debian/patches/0003-Fix-alignment.patch b/debian/patches/0003-Fix-alignment.patch
new file mode 100644
index 0000000..e178ef3
--- /dev/null
+++ b/debian/patches/0003-Fix-alignment.patch
@@ -0,0 +1,46 @@
+From: Stephane Glondu <steph at glondu.net>
+Date: Wed, 13 Jul 2011 21:02:17 +0200
+Subject: Fix alignment
+
+This patch fixes FTBFS on architectures that need aligned double
+access (e.g. mipsel).
+
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=631829
+---
+ lib/read_stubs.c  |    4 +++-
+ lib/write_stubs.c |    3 ++-
+ 2 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/lib/read_stubs.c b/lib/read_stubs.c
+index dfdef9e..c8dac01 100644
+--- a/lib/read_stubs.c
++++ b/lib/read_stubs.c
+@@ -399,9 +399,11 @@ CAMLprim inline value read_float_stub(char **sptr_ptr, char *eptr)
+ {
+   char *sptr = *sptr_ptr;
+   char *next = sptr + sizeof(double);
++  double tmp;
+   if (unlikely(next > eptr)) caml_raise_constant(*v_bin_prot_exc_Buffer_short);
+   *sptr_ptr = next;
+-  return caml_copy_double(*(double *) sptr);
++  memcpy(&tmp, sptr, sizeof(double));
++  return caml_copy_double(tmp);
+ }
+ 
+ MK_ML_READER(float)
+diff --git a/lib/write_stubs.c b/lib/write_stubs.c
+index 68970ec..1cd94c4 100644
+--- a/lib/write_stubs.c
++++ b/lib/write_stubs.c
+@@ -311,8 +311,9 @@ CAMLprim value write_string_stub(char *sptr, char *eptr, value v_str)
+ CAMLprim inline value write_float_stub(char *sptr, char *eptr, value v_n)
+ {
+   char *next = sptr + sizeof(double);
++  double tmp = Double_val(v_n);
+   if (unlikely(next > eptr)) caml_raise_constant(*v_bin_prot_exc_Buffer_short);
+-  *(double *) sptr = Double_val(v_n);
++  memcpy(sptr, &tmp, sizeof(double));
+   return (value) next;
+ }
+ 
+-- 
diff --git a/debian/patches/series b/debian/patches/series
index 2788b22..4367494 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 0001-Fix-bigstring-layout-bug.patch
 0002-Use-cpp-as-default-preprocessor-on-unknown-OS.patch
+0003-Fix-alignment.patch

-- 
bin-prot packaging



More information about the Pkg-ocaml-maint-commits mailing list