Fix for GnuPG 1.4.11 on MIPS using gcc

Werner Koch wk at gnupg.org
Thu Oct 28 11:15:05 CEST 2010


Hi,

While building GnuPG 1.4.11 on MIPS a build problem was encountred.
Please try the patch below which should fix the problem.


Salam-Shalom,

   Werner


2010-10-28  Werner Koch  <wk at g10code.com>

	* longlong.h: Revert last two changes and replace by code from
	libgcrypt 1.4.6.


--- mpi/longlong.h	(revision 5466)
+++ mpi/longlong.h	(working copy)
@@ -710,12 +710,13 @@
  **************  MIPS  *****************
  ***************************************/
 #if defined (__mips__) && W_TYPE_SIZE == 32
-#if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )
-#define umul_ppmm(w1, w0, u, v)                                         \
+#if (__GNUC__ >= 5) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
+#define umul_ppmm(w1, w0, u, v) \
   do {                                                                  \
-    UDItype __ll = (UDItype)(u) * (v);                                  \
-    w1 = __ll >> 32;                                                    \
-    w0 = __ll;                                                          \
+    UDItype _r;                                                         \
+    _r = (UDItype) u * v;                                               \
+    (w1) = _r >> 32;                                                    \
+    (w0) = (USItype) _r;                                                \
   } while (0)
 #elif __GNUC__ > 2 || __GNUC_MINOR__ >= 7
 #define umul_ppmm(w1, w0, u, v)                                         \
@@ -742,14 +743,15 @@
  **************  MIPS/64  **************
  ***************************************/
 #if (defined (__mips) && __mips >= 3) && W_TYPE_SIZE == 64
-# if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )
+# if (__GNUC__ >= 5) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
+   typedef unsigned int UTItype __attribute__ ((mode (TI)));
 #  define umul_ppmm(w1, w0, u, v)                                       \
-     do {                                                               \
-       typedef unsigned int __ll_UTItype __attribute__((mode(TI)));     \
-       __ll_UTItype __ll = (__ll_UTItype)(u) * (v);                     \
-       w1 = __ll >> 64;                                                 \
-       w0 = __ll;                                                       \
-     } while (0)
+  do {                                                                  \
+    UTItype _r;                                                         \
+    _r = (UTItype) u * v;                                               \
+    (w1) = _r >> 64;                                                    \
+    (w0) = (UDItype) _r;                                                \
+  } while (0)
 # elif if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
 #  define umul_ppmm(w1, w0, u, v)                                       \
      __asm__ ("dmultu %2,%3"                                            \



-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.




More information about the Gnupg-devel mailing list