[debian-mysql] Bug#754623: NMU defdiff for percona-xtradb-cluster-galera-2.x_175-2.1 archs
Aníbal Monsalve Salazar
anibal at debian.org
Wed Oct 8 09:17:32 UTC 2014
debdiff percona-xtradb-cluster-galera-2.x_175-2.dsc percona-xtradb-cluster-galera-2.x_175-2.1.dsc
diff -Nru percona-xtradb-cluster-galera-2.x-175/debian/changelog percona-xtradb-cluster-galera-2.x-175/debian/changelog
--- percona-xtradb-cluster-galera-2.x-175/debian/changelog 2014-06-18 17:41:42.000000000 +0100
+++ percona-xtradb-cluster-galera-2.x-175/debian/changelog 2014-08-15 11:18:08.000000000 +0100
@@ -1,3 +1,14 @@
+percona-xtradb-cluster-galera-2.x (175-2.1) unstable; urgency=medium
+
+ * Non-maintainer upload.
+ * Fix difference in alignment of long long for MIPS ISA and IA32.
+ Use corresponding __atomic_* from libatomic library.
+ Add fix-mips.patch.
+ Patch by Dejan Latinovic <Dejan.Latinovic at imgtec.com>.
+ Closes: #754623.
+
+ -- Anibal Monsalve Salazar <anibal at debian.org> Fri, 15 Aug 2014 11:18:03 +0100
+
percona-xtradb-cluster-galera-2.x (175-2) unstable; urgency=medium
* d/p/detect-atomic.patch: Add check to determine whether -latomic is required
diff -Nru percona-xtradb-cluster-galera-2.x-175/debian/patches/fix-mips.patch percona-xtradb-cluster-galera-2.x-175/debian/patches/fix-mips.patch
--- percona-xtradb-cluster-galera-2.x-175/debian/patches/fix-mips.patch 1970-01-01 01:00:00.000000000 +0100
+++ percona-xtradb-cluster-galera-2.x-175/debian/patches/fix-mips.patch 2014-08-15 11:11:22.000000000 +0100
@@ -0,0 +1,129 @@
+Date: Wed, 13 Aug 2014 16:30:32 +0100
+From: Dejan Latinovic <Dejan.Latinovic at imgtec.com>
+Subject: fix for percona-xtradb-cluster-galera-2.x
+
+package percona-xtradb-cluster-galera-2.x FTBFS for mips/mipsel with an error:
+
+> galerautils/src/gu_rand.c: In function 'gu_rand_seed_long':
+> galerautils/src/gu_mmh3.h:195:21: error: '*((void *)&rse+23)' is used uninitialized in this function [-Werror=uninitialized]
+> case 8: k1 ^= ((uint64_t)tail[ 7]) << 56;
+
+https://buildd.debian.org/status/fetch.php?pkg=percona-xtradb-cluster-galera-2.x&arch=mipsel&ver=175-2&stamp=1403112913
+
+This problem is reported here:
+https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=754623
+
+The reason for this failure is a difference in alignment of long long for MIPS
+ISA and IA32. This results that size of gu_rse structure on mips is 24,
+instead of expected 20 (on ia32).
+
+As long long is first attribute in structure, so it is safe to use pack(4).
+
+> struct gu_rse
+> {
+> long long time;
+> const void* heap_ptr;
+> const void* stack_ptr;
+> long pid;
+> };
+
+I assume that this fix could be used for other architectures like: armel,
+armhf, powerpc, sparc. I did not have a chance to test it on those
+architectures, so my changes affects only mips and mipsel.
+
+Solving this issue, fallowing error appears:
+
+> gcs/src/gcs.c:1161: undefined reference to `__sync_fetch_and_add_8'
+
+Mips platform does not have 64-bit __sync_* operations. To avoid this
+behaviuor it is needed to use corresponding __atomic_* from libatomic library.
+
+Patch that solves both issues for mips/mipsel is attached.
+
+Index: percona-xtradb-cluster-galera-2.x-175/SConstruct
+===================================================================
+--- percona-xtradb-cluster-galera-2.x-175.orig/SConstruct
++++ percona-xtradb-cluster-galera-2.x-175/SConstruct
+@@ -368,7 +368,7 @@ else:
+ print 'Not using boost'
+
+ # Check to see if -latomic is need for GCC atomic built-ins.
+-if conf.CheckLib(library='atomic', symbol='__sync_fetch_and_add_8'):
++if conf.CheckLib(library='atomic', symbol='__sync_fetch_and_add_8') or conf.CheckLib(library='atomic', symbol='__atomic_fetch_add_8'):
+ conf.env.Append(LIBS=['atomic'])
+
+ # asio
+Index: percona-xtradb-cluster-galera-2.x-175/galerautils/src/gu_atomic.h
+===================================================================
+--- percona-xtradb-cluster-galera-2.x-175.orig/galerautils/src/gu_atomic.h
++++ percona-xtradb-cluster-galera-2.x-175/galerautils/src/gu_atomic.h
+@@ -11,6 +11,8 @@
+
+ #ifdef __GNUC__
+
++#if !defined(__mips__) || defined(__mips64)
++
+ #define gu_sync_fetch_and_add __sync_fetch_and_add
+ #define gu_sync_fetch_and_sub __sync_fetch_and_sub
+ #define gu_sync_fetch_and_or __sync_fetch_and_or
+@@ -26,6 +28,28 @@
+ #define gu_sync_xor_and_fetch __sync_xor_and_fetch
+ #define gu_sync_nand_and_fetch __gu_sync_nand_and_fetch
+
++#else /* __mips__ */
++
++/* Mips platform does not have 64-bit __sync_* operations.
++ * so it is needed to use corresponding __atomic_* operations from libatomic library. */
++
++#define gu_sync_fetch_and_add(value_, x) __atomic_fetch_add(value_, x, __ATOMIC_SEQ_CST)
++#define gu_sync_fetch_and_sub(value_, x) __atomic_fetch_sub(value_, x, __ATOMIC_SEQ_CST)
++#define gu_sync_fetch_and_or(value_, x) __atomic_fetch_or(value_, x, __ATOMIC_SEQ_CST)
++#define gu_sync_fetch_and_and(value_, x) __atomic_fetch_and(value_, x, __ATOMIC_SEQ_CST)
++#define gu_sync_fetch_and_xor(value_, x) __atomic_fetch_xor(value_, x, __ATOMIC_SEQ_CST)
++#define gu_sync_fetch_and_nand(value_, x) __atomic_fetch_nand(value_, x, __ATOMIC_SEQ_CST)
++
++
++#define gu_sync_add_and_fetch(value_, x) __atomic_add_fetch(value_, x, __ATOMIC_SEQ_CST)
++#define gu_sync_sub_and_fetch(value_, x) __atomic_sub_fetch(value_, x, __ATOMIC_SEQ_CST)
++#define gu_sync_or_and_fetch(value_, x) __atomic_or_fetch(value_, x, __ATOMIC_SEQ_CST)
++#define gu_sync_and_and_fetch(value_, x) __atomic_and_fetch(value_, x, __ATOMIC_SEQ_CST)
++#define gu_sync_xor_and_fetch(value_, x) __atomic_xor_fetch(value_, x, __ATOMIC_SEQ_CST)
++#define gu_sync_nand_and_fetch(value_, x) __atomic_nand_fetch(value_, x, __ATOMIC_SEQ_CST)
++
++#endif
++
+ #else /* __GNUC__ */
+ #error "Compiler not supported"
+ #endif
+Index: percona-xtradb-cluster-galera-2.x-175/galerautils/src/gu_rand.c
+===================================================================
+--- percona-xtradb-cluster-galera-2.x-175.orig/galerautils/src/gu_rand.c
++++ percona-xtradb-cluster-galera-2.x-175/galerautils/src/gu_rand.c
+@@ -16,6 +16,16 @@
+
+ /*! Structure to hold entropy data.
+ * Should be at least 20 bytes on 32-bit systems and 28 bytes on 64-bit */
++
++/* Unlike ia32, aligment of long long for MIPS ISA is 8, and size of gu_rse is 24.
++ * As "long long" atribute is first in gu_rse structure there is no harm in use pack(4) to avoid
++ * undexpected behavior while using gu_rse structure. */
++
++#if defined(__mips__) && !defined(__mips64__)
++#pragma pack(push)
++#pragma pack(4)
++#endif
++
+ struct gu_rse
+ {
+ long long time;
+@@ -24,6 +34,10 @@ struct gu_rse
+ long pid;
+ };
+
++#if defined(__mips__) && !defined(__mips64__)
++#pragma pack(pop)
++#endif
++
+ typedef struct gu_rse gu_rse_t;
+
+ long int
diff -Nru percona-xtradb-cluster-galera-2.x-175/debian/patches/series percona-xtradb-cluster-galera-2.x-175/debian/patches/series
--- percona-xtradb-cluster-galera-2.x-175/debian/patches/series 2014-06-18 17:17:46.000000000 +0100
+++ percona-xtradb-cluster-galera-2.x-175/debian/patches/series 2014-08-15 11:10:54.000000000 +0100
@@ -1 +1,2 @@
detect-atomic.patch
+fix-mips.patch
More information about the pkg-mysql-maint
mailing list