Package: libgii
Version: 1.0.2-4
Severity: important
Tags: patch
Hi,
libgii fails on armhf, because of thumb2 problems:
http://buildd.debian-ports.org/status/fetch.php?pkg=libgii&arch=armhf&ver=1%3A1.0.2-4&stamp=1300235163
(armel passes because it does not use thumb2). However, I added a
patch which uses the gcc atomics intrinsics, which should work on all
platforms where asm routines are not available. It passes the
regression tests in libgii and I've tested it with libggi (and vlc)
and it worked. I've only enabled it for armhf in the rules file, but
if you think it should apply to other arches, it might be worth it.
Regards
Konstantinos
diff -ruN libgii-1.0.2/debian/rules libgii-1.0.2.armhf/debian/rules
--- libgii-1.0.2/debian/rules 2011-11-03 17:58:44.000000000 +0200
+++ libgii-1.0.2.armhf/debian/rules 2011-10-01 19:52:39.000000000 +0300
@@ -2,6 +2,7 @@
include /usr/share/quilt/quilt.make
+DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
@@ -17,6 +18,10 @@
CXXFLAGS += -O2
endif
+ifneq (,$(findstring armhf,$(DEB_HOST_ARCH)))
+ CFLAGS += -DHAVE_GCC_ATOMICS
+endif
+
configure: patch configure-stamp
configure-stamp:
dh_testdir
diff -ruN libgii-1.0.2/gg/gglock.c libgii-1.0.2.armhf/gg/gglock.c
--- libgii-1.0.2/gg/gglock.c 2004-03-08 08:36:28.000000000 +0200
+++ libgii-1.0.2.armhf/gg/gglock.c 2011-10-31 17:51:32.829637818 +0200
@@ -90,7 +90,8 @@
void ggUnlock(void *lock)
{
- *((int*)lock) = 0;
+ int *lck = lock;
+ lockrelease(lck);
return;
}
diff -ruN libgii-1.0.2/gg/gglock.h libgii-1.0.2.armhf/gg/gglock.h
--- libgii-1.0.2/gg/gglock.h 2005-07-31 18:31:10.000000000 +0300
+++ libgii-1.0.2.armhf/gg/gglock.h 2011-10-31 17:51:23.719633940 +0200
@@ -32,6 +32,33 @@
#ifdef __GNUC__
+#ifdef HAVE_GCC_ATOMICS
+
+static inline int
+testandset(int *lock)
+{
+ int ret;
+
+ ret = __sync_lock_test_and_set(lock, 1);
+
+ return ret;
+}
+
+static inline int
+lockrelease(int *lock)
+{
+ __sync_lock_release(lock);
+}
+#define HAVE_TESTANDSET
+
+#else // HAVE_GCC_ATOMICS
+
+static inline int
+lockrelease(int *lock)
+{
+ *lock = 0;
+}
+
#if defined(__i386__) || defined(__i386) || defined(i386) || \
defined(__i486__) || defined(__i486) || defined(i486) || \
defined(__i586__) || defined(__i586) || defined(i586) || \
@@ -185,7 +212,7 @@
}
#define HAVE_TESTANDSET
#endif /* Supported platforms */
-
+#endif /* HAVE_GCC_ATOMICS */
#endif /* __GNUC__ */