Subject: Re: egcs and ssh (Was: Re: link.h)
To: Ignatios Souvatzis <ignatios@cs.uni-bonn.de>
From: Richard Earnshaw <rearnsha@arm.com>
List: port-arm32
Date: 02/26/1999 15:48:30
This is a multipart MIME message.

--==_Exmh_-9323342330
Content-Type: text/plain; charset=us-ascii

> Uhm, I always forget to mention this... did anynody tell you that
> sshd loops endlessly on its initial key generation, if compiled with egcs?
> 

I found that the following patches were needed to the gmp library to make 
the ssh client run correctly.  They may well fix your problem on the 
daemon (sorry, I can't set one of those up to test that directly).  With 
these patches, running "make check" in the gmp library now completes 
without errors.

Perhaps this should be PR'ed.

Richard.



--==_Exmh_-9323342330
Content-Type: text/plain ; name="ssh.diff"; charset=us-ascii
Content-Description: ssh.diff
Content-Disposition: attachment; filename="ssh.diff"

--- longlong.h.keep	Fri Feb 26 15:12:00 1999
+++ longlong.h	Fri Feb 26 11:48:34 1999
@@ -190,26 +190,40 @@ extern UDItype __udiv_qrnnd ();
 	     "rI" ((USItype)(bh)),					\
 	     "r" ((USItype)(al)),					\
 	     "rI" ((USItype)(bl)))
+#if defined(__ARM_ARCH_3M__) || defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
+/* Use umull if available */
 #define umul_ppmm(xh, xl, a, b) \
   __asm__ ("%@ Inlined umul_ppmm
-	mov	%|r0, %2, lsr #16
-	mov	%|r2, %3, lsr #16
-	bic	%|r1, %2, %|r0, lsl #16
-	bic	%|r2, %3, %|r2, lsl #16
-	mul	%1, %|r1, %|r2
-	mul	%|r2, %|r0, %|r2
-	mul	%|r1, %0, %|r1
-	mul	%0, %|r0, %0
-	adds	%|r1, %|r2, %|r1
+	umull	%0, %1, %2, %3"						\
+	   : "=&r" ((USItype) (xl)),					\
+	     "=&r" ((USItype) (xh))					\
+	   : "r" ((USItype) (a)),					\
+	     "r" ((USItype) (b)))
+#define UMUL_TIME 4
+#else /* umull */
+#define umul_ppmm(xh, xl, a, b) \
+do {register USItype __t0, __t1, __t2;					\
+  __asm__ ("%@ Inlined umul_ppmm
+	mov	%2, %5, lsr #16
+	mov	%0, %6, lsr #16
+	bic	%3, %5, %2, lsl #16
+	bic	%4, %6, %0, lsl #16
+	mul	%1, %3, %4
+	mul	%4, %2, %4
+	mul	%3, %0, %3
+	mul	%0, %2, %0
+	adds	%3, %4, %3
 	addcs	%0, %0, #65536
-	adds	%1, %1, %|r1, lsl #16
-	adc	%0, %0, %|r1, lsr #16"					\
-	   : "=&r" ((USItype)(xh)),					\
-	     "=r" ((USItype)(xl))					\
-	   : "r" ((USItype)(a)),					\
-	     "r" ((USItype)(b))						\
-	   : "r0", "r1", "r2")
+	adds	%1, %1, %3, lsl #16
+	adc	%0, %0, %3, lsr #16"					\
+           : "=&r" ((USItype) (xh)),					\
+             "=r" ((USItype) (xl)),					\
+             "=&r" (__t0), "=&r" (__t1), "=r" (__t2)			\
+           : "r" ((USItype) (a)),					\
+             "r" ((USItype) (b)));} while (0)
+
 #define UMUL_TIME 20
+#endif /* umull */
 #define UDIV_TIME 100
 #endif /* __arm__ */
 
--- gmp-impl.h.keep	Fri Feb 26 15:10:27 1999
+++ gmp-impl.h	Fri Feb 26 15:10:35 1999
@@ -281,7 +281,6 @@ typedef unsigned int UHWtype;
 
 #if SIZEOF_INT >= 4 /* otherwise fails on 16-bit machines */
 #if defined (__alpha)							\
- || (defined (__arm__) && defined (__ARMWEL__))				\
  || defined (__clipper__)						\
  || defined (__cris)							\
  || defined (__i386__)							\
@@ -304,7 +303,7 @@ union ieee_double_extract
 };
 #else /* Need this as an #else since the tests aren't made exclusive.  */
 #if defined (__a29k__) || defined (_AM29K)				\
- || defined (__arm__)							\
+ || (defined (__arm__) && defined (__ARMEB__))				\
  || (defined (__convex__) && defined (_IEEE_FLOAT_))			\
  || defined (__i370__) || defined (__mvs__)				\
  || defined (__mc68000__) || defined (__mc68020__) || defined (__NeXT__)\
@@ -330,6 +329,21 @@ union ieee_double_extract
     } s;
   double d;
 };
+#define _GMP_IEEE_FLOATS 1
+#else
+#if defined (__arm__)
+union ieee_double_extract
+{
+  struct
+    {
+      unsigned int manh:20;
+      unsigned int exp:11;
+      unsigned int sig:1;
+      unsigned int manl:32;
+    } s;
+  double d;
+};
+#endif
 #endif
 #endif
 #endif /* SIZEOF_INT >= 4 */

--==_Exmh_-9323342330--