db: fix thumb uclibc operation in 4.3.29
authorJohn Bowler <jbowler@nslu2-linux.org>
Tue, 15 Nov 2005 17:16:26 +0000 (17:16 +0000)
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>
Tue, 15 Nov 2005 17:16:26 +0000 (17:16 +0000)
  - uclibc thumb builds were using libpthread to implement mutexes, the
  - uclibc version seems to be a stub (at least on thumb).  This commit
  - fixes the ARM/gcc-assembly mutex implementation so that it has thumb
  - support and the resultant db4 works (tested on LE Thumb uclibc)

packages/db/db-4.3.29/.mtn2git_empty [new file with mode: 0644]
packages/db/db-4.3.29/arm-thumb-mutex.patch [new file with mode: 0644]
packages/db/db_4.3.29.bb

diff --git a/packages/db/db-4.3.29/.mtn2git_empty b/packages/db/db-4.3.29/.mtn2git_empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/packages/db/db-4.3.29/arm-thumb-mutex.patch b/packages/db/db-4.3.29/arm-thumb-mutex.patch
new file mode 100644 (file)
index 0000000..acd446f
--- /dev/null
@@ -0,0 +1,36 @@
+--- db-4.3.29-dist/../dbinc/mutex.h    2005-11-15 07:33:27.761042518 -0800
++++ db-4.3.29-dist/../dbinc/mutex.h    2005-11-15 07:55:24.823920060 -0800
+@@ -470,6 +470,25 @@
+ #ifdef LOAD_ACTUAL_MUTEX_CODE
+ #define       MUTEX_SET_TEST  1               /* gcc/arm: 0 is clear, 1 is set. */
++#if defined __thumb__
++#define       MUTEX_SET(tsl) ({                                               \
++      int __r, __p;                                                   \
++      asm volatile(                                                   \
++              ".align 2\n\t"                                          \
++              "bx     pc\n\t"                                         \
++              "nop\n\t"                                               \
++              ".arm\n\t"                                              \
++              "swpb   %0, %2, [%3]\n\t"                               \
++              "eor    %0, %0, #1\n\t"                                 \
++              "orr    %1, pc, #1\n\t"                                 \
++              "bx     %1\n\t"                                         \
++              ".force_thumb"                                          \
++          : "=&r" (__r), "=r" (__p)                                   \
++          : "r" (1), "r" (tsl)                                        \
++          );                                                          \
++      __r & 1;                                                        \
++})
++#else
+ #define       MUTEX_SET(tsl) ({                                               \
+       int __r;                                                        \
+       asm volatile(                                                   \
+@@ -480,6 +499,7 @@
+           );                                                          \
+       __r & 1;                                                        \
+ })
++#endif
+ #define       MUTEX_UNSET(tsl)        (*(volatile tsl_t *)(tsl) = 0)
+ #define       MUTEX_INIT(tsl)         MUTEX_UNSET(tsl)
index ba11e12..31b0b91 100644 (file)
@@ -14,10 +14,11 @@ HOMEPAGE = "http://www.sleepycat.com"
 LICENSE = "BSD Sleepycat"
 VIRTUAL_NAME ?= "virtual/db"
 CONFLICTS = "db3"
-PR = "r0"
+PR = "r1"
 
 SRC_URI = "http://downloads.sleepycat.com/db-${PV}.tar.gz"
 #SRC_URI_MD5 = "http://downloads.sleepycat.com/db-${PV}.tar.gz.md5"
+SRC_URI += "file://arm-thumb-mutex.patch;patch=1"
 
 inherit autotools
 
@@ -60,7 +61,6 @@ EXTRA_OECONF = "${DB4_CONFIG}"
 # These enable the ARM assembler mutex code, this won't
 # work with thumb compilation...
 ARM_MUTEX = "--with-mutex=ARM/gcc-assembly"
-ARM_MUTEX_thumb = ""
 MUTEX = ""
 MUTEX_arm = "${ARM_MUTEX}"
 MUTEX_armeb = "${ARM_MUTEX}"