Package: db4.2
Version: 4.2.52+dfsg-5.1
Severity: important
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu karmic ubuntu-patch

In Ubuntu, we've applied the attached patch to achieve the following:

  * dbinc/mutex.h: fix armel ftbfs by moving ARM atomic macros to gcc
    atomic instrinsics

We thought you might be interested in doing the same. 

Rational: FTBFS in karmic/lucid:
  
http://launchpadlibrarian.net/36567479/buildlog_ubuntu-lucid-armel.db4.2_4.2.52%2Bdfsg-5.1_FAILEDTOBUILD.txt.gz

...
make[1]: Entering directory `/build/buildd/db4.2-4.2.52+dfsg/obj'
/bin/sh ./libtool --mode=compile cc -c -I. -I../dist/.. -I/usr/include/tcl8.5 
-D_GNU_SOURCE -D_REENTRANT -Wall -g -O2 ../dist/../mutex/mut_tas.c
mkdir .libs
 cc -c -I. -I../dist/.. -I/usr/include/tcl8.5 -D_GNU_SOURCE -D_REENTRANT -Wall 
-g -O2 ../dist/../mutex/mut_tas.c  -fPIC -DPIC -o .libs/mut_tas.o
/tmp/ccZTuYQ9.s: Assembler messages:
/tmp/ccZTuYQ9.s:143: Error: selected processor does not support `swpb 
r2,r7,[r4]'
make[1]: *** [mut_tas.lo] Error 1


-- System Information:
Debian Release: squeeze/sid
  APT prefers karmic-updates
  APT policy: (500, 'karmic-updates'), (500, 'karmic-security'), (500, 'karmic')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-02063202-generic (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -u db4.2-4.2.52+dfsg/dbinc/mutex.h db4.2-4.2.52+dfsg/dbinc/mutex.h
--- db4.2-4.2.52+dfsg/dbinc/mutex.h
+++ db4.2-4.2.52+dfsg/dbinc/mutex.h
@@ -470,18 +470,18 @@
 /*
  * For arm/gcc, 0 is clear, 1 is set.
  */
-#define	MUTEX_SET(tsl) ({						\
-	int __r;							\
-	asm volatile(							\
-		"swpb	%0, %1, [%2]\n\t"				\
-		"eor	%0, %0, #1\n\t"					\
-	    : "=&r" (__r)						\
-	    : "r" (1), "r" (tsl)					\
-	    );								\
-	__r & 1;							\
-})
+static inline int
+MUTEX_SET(tsl_t *tsl) { 
+	tsl_t __r = __sync_lock_test_and_set (tsl, 1);
+	return __r == 0;
+}
+
+static inline int
+MUTEX_UNSET(tsl_t *tsl) {
+	__sync_lock_release(tsl);
+	return *tsl == 0;
+}
 
-#define	MUTEX_UNSET(tsl)	(*(volatile tsl_t *)(tsl) = 0)
 #define	MUTEX_INIT(tsl)		MUTEX_UNSET(tsl)
 #endif
 #endif

Reply via email to