Hello,

Please review && apply attached patch.

Jean-Mickael
>From f317d77e262dda0d835ae910c615b9b94773b433 Mon Sep 17 00:00:00 2001
From: Jean-Mickael Guerin <jean-mickael.gue...@6wind.com>
Date: Wed, 29 Aug 2012 21:18:01 +0200
Subject: [PATCH] bn: fix mips "impossible constraint in 'asm'" with gcc >= 4.4

The MIPS port for GCC-4.4 no longer recognizes the h asm constraint.

bn_div.c: In function 'BN_div':
bn_div.c:377: error: impossible constraint in 'asm'
make[5]: *** [bn_div.o] Error 1

See http://gcc.gnu.org/gcc-4.4/changes.html

Signed-off-by: Jean-Mickael Guerin <jean-mickael.gue...@6wind.com>
---
 crypto/bn/bn_lcl.h |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/crypto/bn/bn_lcl.h b/crypto/bn/bn_lcl.h
index 74cea91..360bbf6 100644
--- a/crypto/bn/bn_lcl.h
+++ b/crypto/bn/bn_lcl.h
@@ -306,10 +306,24 @@ extern "C" {
             : "=h"(ret)                \
             : "r"(a), "r"(b) : "l");   \
        ret;                    })
+#if defined(__GNUC__) && __GNUC_PREREQ (4,4)
+/*
+ * The MIPS port for GCC-4.4 no longer recognizes the h asm constraint.
+ * See http://gcc.gnu.org/gcc-4.4/changes.html
+ */
+#   define BN_UMULT_LOHI(low,high,a,b) \
+       ({ \
+               typedef unsigned int uint128_t __attribute__((mode(TI))); \
+               uint128_t __ll = (uint128_t)(a) * (b); \
+               high= __ll >> 64; \
+               low= __ll; \
+       })
+#else
 #   define BN_UMULT_LOHI(low,high,a,b) \
        asm ("dmultu    %2,%3"          \
             : "=l"(low),"=h"(high)     \
             : "r"(a), "r"(b));
+#endif
 #  endif
 # endif                /* cpu */
 #endif         /* OPENSSL_NO_ASM */
-- 
1.7.3.2

Reply via email to