I got GnuPG 1.0.6 to compile on Solaris 2.7 Intel

Mark Pettit pettit at yahoo-inc.com
Fri Apr 12 14:19:02 CEST 2002


After quite a few hours of mucking around inside of the assembly code in
gnupg-1.0.6/mpi/*.S, I finally got GnuPG 1.0.6 to compile under Solaris 2.7
(Intel).

I thought this would be a good thing to post to the gnupg-devel list in case
anyone else ever needs to accomplish this.  All of the changes I came up
with resulted from comparing gmp-2.0.2 (which is apparently what the mpi/
directory in gnupg-1.0.6 was based on) to later revisions of gmp, which got
better and better as time went on.

I'd like to highly recommend that gmp-4.0.1 be integrated into the gnupg
tree again, to bring things up to modern standards.  This would require some
work, but I think it'd be worth it.  I'd be glad to help out if needed.

There are certain idiosyncracies to the Solaris x86 assembler, and the gmp
folks have apparently gone to great lengths to figure all of them out,
because gmp-4.0.1 compiles cleanly right out of the box on Solaris x86,
which couldn't be said for previous (3.x and before) versions of gmp.

Anyway, enough rambling.  Here's the patch.  I'll also include it as a
uuencoded file at the end of the email, so as to not lose the tabs (which
tend to get lost in email translation):

============================================================================
diff -ur gnupg-1.0.6.orig/mpi/i386/mpih-add1.S gnupg-1.0.6/mpi/i386/mpih-add1.S
--- gnupg-1.0.6.orig/mpi/i386/mpih-add1.S	Sun Apr 29 06:04:57 2001
+++ gnupg-1.0.6/mpi/i386/mpih-add1.S	Fri Apr 12 03:45:49 2002
@@ -75,7 +75,7 @@
 	addl	$4,%esp
 #else
 /* Calculate start address in loop for non-PIC.  */
-	leal	(Loop - 3)(%eax,%eax,8),%eax
+	leal	Loop-3(%eax,%eax,8),%eax
 #endif
 	jmp	*%eax			/* jump into loop */
 	ALIGN (3)
diff -ur gnupg-1.0.6.orig/mpi/i386/mpih-lshift.S gnupg-1.0.6/mpi/i386/mpih-lshift.S
--- gnupg-1.0.6.orig/mpi/i386/mpih-lshift.S	Sun Apr 29 06:05:07 2001
+++ gnupg-1.0.6/mpi/i386/mpih-lshift.S	Fri Apr 12 03:48:55 2002
@@ -57,21 +57,21 @@
 
 	movl	(%esi,%edx,4),%ebx	/* read most significant limb */
 	xorl	%eax,%eax
-	shldl	%cl,%ebx,%eax		/* compute carry limb */
+	shldl	%ebx,%eax		/* compute carry limb */
 	decl	%edx
 	jz	Lend
 	pushl	%eax			/* push carry limb onto stack */
-	testb	$1,%edx
+	testb	$1,%dl
 	jnz	L1			/* enter loop in the middle */
 	movl	%ebx,%eax
 
 	ALIGN (3)
 Loop:	movl	(%esi,%edx,4),%ebx	/* load next lower limb */
-	shldl	%cl,%ebx,%eax		/* compute result limb */
+	shldl	%ebx,%eax		/* compute result limb */
 	movl	%eax,(%edi,%edx,4)	/* store it */
 	decl	%edx
 L1:	movl	(%esi,%edx,4),%eax
-	shldl	%cl,%eax,%ebx
+	shldl	%eax,%ebx
 	movl	%ebx,(%edi,%edx,4)
 	decl	%edx
 	jnz	Loop
diff -ur gnupg-1.0.6.orig/mpi/i386/mpih-rshift.S gnupg-1.0.6/mpi/i386/mpih-rshift.S
--- gnupg-1.0.6.orig/mpi/i386/mpih-rshift.S	Sun Apr 29 06:06:44 2001
+++ gnupg-1.0.6/mpi/i386/mpih-rshift.S	Fri Apr 12 03:49:09 2002
@@ -60,21 +60,21 @@
 
 	movl	(%esi,%edx,4),%ebx	/* read least significant limb */
 	xorl	%eax,%eax
-	shrdl	%cl,%ebx,%eax		/* compute carry limb */
+	shrdl	%ebx,%eax		/* compute carry limb */
 	incl	%edx
 	jz	Lend2
 	pushl	%eax			/* push carry limb onto stack */
-	testb	$1,%edx
+	testb	$1,%dl
 	jnz	L2			/* enter loop in the middle */
 	movl	%ebx,%eax
 
 	ALIGN (3)
 Loop2:	 movl	 (%esi,%edx,4),%ebx	 /* load next higher limb */
-	shrdl	%cl,%ebx,%eax		/* compute result limb */
+	shrdl	%ebx,%eax		/* compute result limb */
 	movl	%eax,(%edi,%edx,4)	/* store it */
 	incl	%edx
 L2:	movl	(%esi,%edx,4),%eax
-	shrdl	%cl,%eax,%ebx
+	shrdl	%eax,%ebx
 	movl	%ebx,(%edi,%edx,4)
 	incl	%edx
 	jnz	Loop2
diff -ur gnupg-1.0.6.orig/mpi/i386/mpih-sub1.S gnupg-1.0.6/mpi/i386/mpih-sub1.S
--- gnupg-1.0.6.orig/mpi/i386/mpih-sub1.S	Sun Apr 29 06:06:53 2001
+++ gnupg-1.0.6/mpi/i386/mpih-sub1.S	Fri Apr 12 03:45:59 2002
@@ -76,7 +76,7 @@
 	addl	$4,%esp
 #else
 /* Calculate start address in loop for non-PIC.  */
-	leal	(Loop - 3)(%eax,%eax,8),%eax
+	leal	Loop-3(%eax,%eax,8),%eax
 #endif
 	jmp	*%eax			/* jump into loop */
 	ALIGN (3)
diff -ur gnupg-1.0.6.orig/mpi/i386/syntax.h gnupg-1.0.6/mpi/i386/syntax.h
--- gnupg-1.0.6.orig/mpi/i386/syntax.h	Tue May  1 10:40:53 2001
+++ gnupg-1.0.6/mpi/i386/syntax.h	Fri Apr 12 03:46:43 2002
@@ -45,7 +45,7 @@
 #define ALIGN(log) .align log
 #endif
 #if defined (ELF_SYNTAX)
-#define ALIGN(log) .align 1<<(log)
+#define ALIGN(log) .align 1<<log
 #endif
 #define GLOBL .globl
 #endif
============================================================================

These patches, if applied *before* the configure is run, will allow
gnupg-1.0.6 to be compiled totally cleanly on a Solaris Intel system,
assuming you use the same compiler I use: gcc-3.0.4 (the latest 3.x version
of gcc).  I had a much harder time using gcc-2.95.3, but after I upgraded to
3.0.4, it wasn't too hard to figure out what to fix.

I make no claim about applying this patch to any other OS (Linux, FreeBSD,
etc.).

Hope this is helpful to someone.  The uuencoded patch is at the end of this
email.

-- 
Mark K. Pettit          "Ragged lines of ragged grey
pettit at yahoo-inc.com     Skeletons they shuffle away"
Technical Yahoo
Yahoo!, Inc., 701 First Avenue, Sunnyvale, CA 94089

============================================================================

begin 644 gnupg-1.0.6-solaris27-intel.patch
M9&EF9B`M=7(@9VYU<&<M,2XP+C8N;W)I9R]M<&DO:3,X-B]M<&EH+6%D9#$N
M4R!G;G5P9RTQ+C`N-B]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S(#(P
M,#$**RLK(&=N=7!G+3$N,"XV+VUP:2]I,S at V+VUP:6 at M<W5B,2Y3"49R:2!!
M<'(@,3(@,#,Z-#4Z-3D@,C`P, at I`0"`M-S8L-R`K-S8L-R!`0`H@"6%D9&P)
M)#0L)65S<`H@(V5L<V4*("\J($-A;&-U;&%T92!S=&%R="!A9&1R97-S(&EN
M(&QO;W`@9F]R(&YO;BU024,N("`J+PHM"6QE86P)*$QO;W`@+2`S*2 at E96%X
M+"5E87 at L."DL)65A>`HK"6QE86P)3&]O<"TS*"5E87 at L)65A>"PX*2PE96%X
M"B`C96YD:68*(`EJ;7`)*B5E87@)"0DO*B!J=6UP(&EN=&\@;&]O<"`J+PH@
M"4%,24=.("@S*0ID:69F("UU<B!G;G5P9RTQ+C`N-BYO<FEG+VUP:2]I,S at V
M+W-Y;G1A>"YH(&=N=7!G+3$N,"XV+VUP:2]I,S at V+W-Y;G1A>"YH"BTM+2!G
M;G5P9RTQ+C`N-BYO<FEG+VUP:2]I,S at V+W-Y;G1A>"YH"51U92!-87D@(#$@
M,3`Z-#`Z-3,@,C`P,0HK*RL at 9VYU<&<M,2XP+C8O;7!I+VDS.#8O<WEN=&%X
M+F@)1G)I($%P<B`Q,B`P,SHT-CHT,R`R,#`R"D!`("TT-2PW("LT-2PW($!`
M"B`C9&5F:6YE($%,24=.*&QO9RD at +F%L:6=N(&QO9PH@(V5N9&EF"B`C:68@
M9&5F:6YE9"`H14Q&7U-93E1!6"D*+2-D969I;F4 at 04Q)1TXH;&]G*2`N86QI
M9VX@,3P\*&QO9RD**R-D969I;F4 at 04Q)1TXH;&]G*2`N86QI9VX@,3P\;&]G
G"B`C96YD:68*("-D969I;F4 at 1TQ/0DP at +F=L;V)L"B`C96YD:68*
`
end




More information about the Gnupg-devel mailing list