[openssl-dev] [openssl.org #3859] [PATCH] Define GCC_VERSION macro to cover upto gcc-5

Khem Raj via RT rt at openssl.org
Sat May 23 08:34:47 UTC 2015


Current check is limited to gcc 4 with minor versions
but when we use gcc 5.1, then minor version check fails
with current setup and we end up with build errors like

| In file included from bn_div.c:62:0:
| bn_div.c: In function 'BN_div':
| bn_lcl.h:311:9: error: impossible constraint in 'asm'
|          asm ("dmultu    %2,%3"          \
|          ^
| bn_div.c:402:13: note: in expansion of macro 'BN_UMULT_LOHI'
|              BN_UMULT_LOHI(t2l, t2h, d1, q);
|              ^
| <builtin>: recipe for target 'bn_div.o' failed
| make[2]: *** [bn_div.o] Error 1

Signed-off-by: Khem Raj <raj.khem at gmail.com>
---
 crypto/bn/bn_lcl.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/crypto/bn/bn_lcl.h b/crypto/bn/bn_lcl.h
index 196df7e..e801ba7 100644
--- a/crypto/bn/bn_lcl.h
+++ b/crypto/bn/bn_lcl.h
@@ -118,6 +118,9 @@
 extern "C" {
 #endif
 
+#define GCC_VERSION (__GNUC__ * 10000 \
+                     + __GNUC_MINOR__ * 100 \
+                     + __GNUC_PATCHLEVEL__)
 /*-
  * Bignum consistency macros
  * There is one "API" macro, bn_fix_top(), for stripping leading zeroes from
@@ -443,7 +446,7 @@ unsigned __int64 _umul128(unsigned __int64 a, unsigned __int64 b,
 #   endif
 #  elif defined(__mips) && (defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG))
 #   if defined(__GNUC__) && __GNUC__>=2
-#    if __GNUC__>=4 && __GNUC_MINOR__>=4
+#    if GCC_VERSION > 40400
                                      /* "h" constraint is no more since 4.4 */
 #     define BN_UMULT_HIGH(a,b)          (((__uint128_t)(a)*(b))>>64)
 #     define BN_UMULT_LOHI(low,high,a,b) ({     \
-- 
2.1.4




More information about the openssl-dev mailing list