[package] fix the removal of the h constraint in gcc4.4 with libgcrypt
[openwrt/svn-archive/archive.git] / libs / libgcrypt / patches / 001-mips-h-constraint.patch
1 The MIPS port for GCC-4.4 no longer recognizes the h asm constraint.
2 Patch from: https://forum.openwrt.org/viewtopic.php?id=20520
3
4 --- libgcrypt/mpi/longlong.h-asdf 2009-08-04 09:58:51.000000000 +0930
5 +++ libgcrypt/mpi/longlong.h 2009-08-04 10:10:27.000000000 +0930
6 @@ -710,18 +710,35 @@
7 #endif /* __m88110__ */
8 #endif /* __m88000__ */
9
10 +/* Test for gcc >= maj.min, as per __GNUC_PREREQ in glibc */
11 +#if defined (__GNUC__) && defined (__GNUC_MINOR__)
12 +#define __GNUC_PREREQ(maj, min) \
13 + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
14 +#else
15 +#define __GNUC_PREREQ(maj, min) 0
16 +#endif
17 +
18 /***************************************
19 ************** MIPS *****************
20 ***************************************/
21 #if defined (__mips__) && W_TYPE_SIZE == 32
22 -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
23 +#if __GNUC_PREREQ (4,4)
24 +#define umul_ppmm(w1, w0, u, v) \
25 + do { \
26 + UDItype __ll = (UDItype)(u) * (v); \
27 + w1 = __ll >> 32; \
28 + w0 = __ll; \
29 + } while (0)
30 +#endif
31 +#if !defined (umul_ppmm) && __GNUC_PREREQ (2,7)
32 #define umul_ppmm(w1, w0, u, v) \
33 __asm__ ("multu %2,%3" \
34 : "=l" ((USItype)(w0)), \
35 "=h" ((USItype)(w1)) \
36 : "d" ((USItype)(u)), \
37 "d" ((USItype)(v)))
38 -#else
39 +#endif
40 +#if !defined (umul_ppmm)
41 #define umul_ppmm(w1, w0, u, v) \
42 __asm__ ("multu %2,%3 \n" \
43 "mflo %0 \n" \
44 @@ -739,14 +756,24 @@
45 ************** MIPS/64 **************
46 ***************************************/
47 #if (defined (__mips) && __mips >= 3) && W_TYPE_SIZE == 64
48 -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
49 +#if __GNUC_PREREQ (4,4)
50 +#define umul_ppmm(w1, w0, u, v) \
51 + do { \
52 + typedef unsigned int __ll_UTItype __attribute__((mode(TI))); \
53 + __ll_UTItype __ll = (__ll_UTItype)(u) * (v); \
54 + w1 = __ll >> 64; \
55 + w0 = __ll; \
56 + } while (0)
57 +#endif
58 +#if !defined (umul_ppmm) && __GNUC_PREREQ (2,7)
59 #define umul_ppmm(w1, w0, u, v) \
60 __asm__ ("dmultu %2,%3" \
61 : "=l" ((UDItype)(w0)), \
62 "=h" ((UDItype)(w1)) \
63 : "d" ((UDItype)(u)), \
64 "d" ((UDItype)(v)))
65 -#else
66 +#endif
67 +#if !defined (umul_ppmm)
68 #define umul_ppmm(w1, w0, u, v) \
69 __asm__ ("dmultu %2,%3 \n" \
70 "mflo %0 \n" \