Comment 38 for bug 6942

Revision history for this message
In , Andreas Barth (aba) wrote : db4.2: problems for mips(el) fixed

Hi,

I fixed this bug for unstable. I did only minimal changes, so that
this fix would also be ok for testing. I (or more correct: Frank)
tested this package on a mips-machine, and installation of slapd works
now. Thanks for Thiemo for the fix.

Cheers,
Andi

diff -Nur db4.2-4.2.52-prev/dbinc/mutex.h db4.2-4.2.52/dbinc/mutex.h
--- db4.2-4.2.52-prev/dbinc/mutex.h 2003-09-20 23:40:49.000000000 +0200
+++ db4.2-4.2.52/dbinc/mutex.h 2004-08-20 16:08:45.000000000 +0200
@@ -487,6 +487,48 @@
 #endif

 /*********************************************************************
+ * MIPS/gcc assembly.
+ *********************************************************************/
+#ifdef HAVE_MUTEX_MIPS_GCC_ASSEMBLY
+typedef u_int32_t tsl_t;
+
+#ifndef MUTEX_ALIGN
+#define MUTEX_ALIGN 4
+#endif
+
+#ifdef LOAD_ACTUAL_MUTEX_CODE
+/*
+ * For gcc/mips. Should return 0 if could not acquire the lock, 1 if
+ * lock was acquired properly.
+ */
+static inline int
+MUTEX_SET(tsl_t *tsl) {
+ register tsl_t *__l = tsl;
+ register tsl_t __r;
+ asm volatile(
+ " .set push \n"
+ " .set mips2 \n"
+ " .set noreorder \n"
+ "1: ll %0, %1 \n"
+ " bnez %0, 1f \n"
+ " nop \n"
+ " addu %0, 1 \n"
+ " sc %0, %1 \n"
+ " beqz %0, 1b \n"
+ " move %0, $0 \n"
+ " sync \n"
+ "1: .set pop \n"
+ : "=&r" (__r), "+m" (*__l)
+ : : "memory");
+ return __r ^ 1;
+}
+
+#define MUTEX_UNSET(tsl) (*(volatile tsl_t *)(tsl) = 0)
+#define MUTEX_INIT(tsl) MUTEX_UNSET(tsl)
+#endif
+#endif
+
+/*********************************************************************
  * HPPA/gcc assembly.
  *********************************************************************/
 #ifdef HAVE_MUTEX_HPPA_GCC_ASSEMBLY
diff -Nur db4.2-4.2.52-prev/debian/changelog db4.2-4.2.52/debian/changelog
--- db4.2-4.2.52-prev/debian/changelog 2004-08-20 15:00:15.000000000 +0200
+++ db4.2-4.2.52/debian/changelog 2004-08-21 05:57:19.000000000 +0200
@@ -1,3 +1,11 @@
+db4.2 (4.2.52-17) unstable; urgency=medium
+
+ * add mutex support for mips/mipsel. Closes: #257513
+ * added myself to the uploaders.
+ * add warning about configure
+
+ -- Andreas Barth <email address hidden> Fri, 20 Aug 2004 16:10:43 +0200
+
 db4.2 (4.2.52-16) unstable; urgency=medium

   * Change maintainer address to Alioth mailing list, and add
diff -Nur db4.2-4.2.52-prev/debian/control db4.2-4.2.52/debian/control
--- db4.2-4.2.52-prev/debian/control 2004-08-20 15:00:15.000000000 +0200
+++ db4.2-4.2.52/debian/control 2004-08-20 16:09:57.000000000 +0200
@@ -2,7 +2,7 @@
 Section: libs
 Priority: standard
 Maintainer: Debian Berkeley DB Maintainers <email address hidden>
-Uploaders: Clint Adams <email address hidden>, Matthew Wilcox <email address hidden>
+Uploaders: Clint Adams <email address hidden>, Matthew Wilcox <email address hidden>, Andreas Barth <email address hidden>
 Standards-Version: 3.6.1
 Build-Depends: tcl8.4-dev, procps [!hurd-i386], gcj (>= 3:3.2.2-0) [!hppa !mips !mipsel !hurd-i386], fastjar [!hppa !mips !mipsel !hurd-i386], sablevm [!hppa !mips !mipsel !hurd-i386], libgcj4-dev [!hppa !mips !mipsel !hurd-i386]

diff -Nur db4.2-4.2.52-prev/dist/README db4.2-4.2.52/dist/README
--- db4.2-4.2.52-prev/dist/README 1970-01-01 01:00:00.000000000 +0100
+++ db4.2-4.2.52/dist/README 2004-08-21 05:58:00.000000000 +0200
@@ -0,0 +1,2 @@
+If you want to update any of the files here, please see s_* (these are
+scripts).
diff -Nur db4.2-4.2.52-prev/dist/aclocal/mutex.ac db4.2-4.2.52/dist/aclocal/mutex.ac
--- db4.2-4.2.52-prev/dist/aclocal/mutex.ac 2003-06-16 16:54:39.000000000 +0200
+++ db4.2-4.2.52/dist/aclocal/mutex.ac 2004-08-20 16:08:45.000000000 +0200
@@ -373,6 +373,17 @@
 ], [db_cv_mutex="ARM/gcc-assembly"])
 fi

+# MIPS/gcc: Linux
+if test "$db_cv_mutex" = no; then
+AC_TRY_COMPILE(,[
+#if defined(__mips__) && defined(__GNUC__)
+ exit(0);
+#else
+ FAIL TO COMPILE/LINK
+#endif
+], [db_cv_mutex="MIPS/gcc-assembly"])
+fi
+
 # PaRisc/gcc: HP/UX
 if test "$db_cv_mutex" = no; then
 AC_TRY_COMPILE(,[
@@ -499,6 +510,10 @@
    AC_DEFINE(HAVE_MUTEX_ARM_GCC_ASSEMBLY)
    AH_TEMPLATE(HAVE_MUTEX_ARM_GCC_ASSEMBLY,
        [Define to 1 to use the GCC compiler and ARM assembly language mutexes.]);;
+MIPS/gcc-assembly) ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
+ AC_DEFINE(HAVE_MUTEX_MIPS_GCC_ASSEMBLY)
+ AH_TEMPLATE(HAVE_MUTEX_MIPS_GCC_ASSEMBLY,
+ [Define to 1 to use the GCC compiler and MIPS assembly language mutexes.]);;
 HP/msem_init) ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
    AC_DEFINE(HAVE_MUTEX_HPPA_MSEM_INIT)
    AH_TEMPLATE(HAVE_MUTEX_HPPA_MSEM_INIT,
diff -Nur db4.2-4.2.52-prev/dist/config.hin db4.2-4.2.52/dist/config.hin
--- db4.2-4.2.52-prev/dist/config.hin 2003-12-03 22:10:00.000000000 +0100
+++ db4.2-4.2.52/dist/config.hin 2004-08-21 07:05:03.000000000 +0200
@@ -106,6 +106,9 @@
 /* Define to 1 to use the GCC compiler and ARM assembly language mutexes. */
 #undef HAVE_MUTEX_ARM_GCC_ASSEMBLY

+/* Define to 1 to use the GCC compiler and MIPS assembly language mutexes. */
+#undef HAVE_MUTEX_MIPS_GCC_ASSEMBLY
+
 /* Define to 1 to use the Apple/Darwin _spin_lock_try mutexes. */
 #undef HAVE_MUTEX_DARWIN_SPIN_LOCK_TRY

diff -Nur db4.2-4.2.52-prev/dist/configure.mutexes-disabled db4.2-4.2.52/dist/configure.mutexes-disabled
--- db4.2-4.2.52-prev/dist/configure.mutexes-disabled 2004-08-20 15:00:15.000000000 +0200
+++ db4.2-4.2.52/dist/configure.mutexes-disabled 2004-08-21 06:03:24.000000000 +0200
@@ -28427,6 +28427,51 @@
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi

+# MIPS/gcc: Linux
+if test "$db_cv_mutex" = no; then
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+#if defined(__mips__) && defined(__GNUC__)
+ exit(0);
+#else
+ FAIL TO COMPILE/LINK
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ db_cv_mutex="MIPS/gcc-assembly"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+
 # PaRisc/gcc: HP/UX
 if test "$db_cv_mutex" = no; then
 cat >conftest.$ac_ext <<_ACEOF
@@ -28870,6 +28915,12 @@

 ;;
+MIPS/gcc-assembly) ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_MUTEX_MIPS_GCC_ASSEMBLY 1
+_ACEOF
+
+;;
 ARM/gcc-assembly) ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
    cat >>confdefs.h <<\_ACEOF
 #define HAVE_MUTEX_ARM_GCC_ASSEMBLY 1
--
   http://home.arcor.de/andreas-barth/
   PGP 1024/89FB5CE5 DC F1 85 6D A6 45 9C 0F 3B BE F1 D0 C5 D1 D9 0C