Source: openssl
Version: 1.0.1c-4
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: port-x32 ftbfs-x32

Here's the patch I'm using to compile openssl on the Debian x32 port, heavily 
based on the patch at <URL:https://sites.google.com/site/x32abi/x32-
patches/openssl_fix_for_x32.patch?attredirects=0&d=1>.
-- 
Daniel Schepler
diff -Nru openssl-1.0.1c/debian/changelog openssl-1.0.1c/debian/changelog
--- openssl-1.0.1c/debian/changelog	2012-07-29 05:33:38.000000000 -0700
+++ openssl-1.0.1c/debian/changelog	2013-01-17 20:26:16.000000000 -0800
@@ -1,3 +1,10 @@
+openssl (1.0.1c-4+x32) unreleased; urgency=low
+
+  * Apply patch from H.J. Lu for x32 support.
+  * Also add debian-x32 target accordingly.
+
+ -- Daniel Schepler <[email protected]>  Thu, 17 Jan 2013 20:26:08 -0800
+
 openssl (1.0.1c-4) unstable; urgency=low
 
   * Fix the configure rules for alpha (Closes: #672710)
diff -Nru openssl-1.0.1c/debian/patches/debian-target-x32.patch openssl-1.0.1c/debian/patches/debian-target-x32.patch
--- openssl-1.0.1c/debian/patches/debian-target-x32.patch	1969-12-31 16:00:00.000000000 -0800
+++ openssl-1.0.1c/debian/patches/debian-target-x32.patch	2013-01-17 20:21:07.000000000 -0800
@@ -0,0 +1,12 @@
+Index: openssl-1.0.1c/Configure
+===================================================================
+--- openssl-1.0.1c.orig/Configure	2013-01-17 20:15:21.000000000 -0800
++++ openssl-1.0.1c/Configure	2013-01-17 20:21:05.000000000 -0800
+@@ -383,6 +383,7 @@
+ "debian-sparc-v8","gcc:-DB_ENDIAN -DTERMIO ${debian_cflags} -mcpu=v8 -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+ "debian-sparc-v9","gcc:-DB_ENDIAN -DTERMIO ${debian_cflags} -mcpu=v9 -Wa,-Av8plus -DULTRASPARC -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+ "debian-sparc64","gcc:-m64 -DB_ENDIAN -DTERMIO ${debian_cflags} -DULTRASPARC -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
++"debian-x32","gcc:-mx32 -DL_ENDIAN -DTERMIO ${debian_cflags} -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-mx32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::x32",
+ 
+ ####
+ #### Variety of LINUX:-)
diff -Nru openssl-1.0.1c/debian/patches/openssl_fix_for_x32.patch openssl-1.0.1c/debian/patches/openssl_fix_for_x32.patch
--- openssl-1.0.1c/debian/patches/openssl_fix_for_x32.patch	1969-12-31 16:00:00.000000000 -0800
+++ openssl-1.0.1c/debian/patches/openssl_fix_for_x32.patch	2013-01-17 20:17:53.000000000 -0800
@@ -0,0 +1,51 @@
+Index: openssl-1.0.1c/Configure
+===================================================================
+--- openssl-1.0.1c.orig/Configure	2013-01-17 20:14:24.000000000 -0800
++++ openssl-1.0.1c/Configure	2013-01-17 20:15:21.000000000 -0800
+@@ -405,6 +405,7 @@
+ "linux-ia64-ecc","ecc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+ "linux-ia64-icc","icc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+ "linux-x86_64",	"gcc:-m64 -DL_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
++"linux-x32", "gcc:-mx32 -DL_ENDIAN -DTERMIO -O3 -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-mx32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::x32",
+ "linux64-s390x",	"gcc:-m64 -DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:${s390x_asm}:64:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
+ #### So called "highgprs" target for z/Architecture CPUs
+ # "Highgprs" is kernel feature first implemented in Linux 2.6.32, see
+Index: openssl-1.0.1c/crypto/bn/asm/x86_64-gcc.c
+===================================================================
+--- openssl-1.0.1c.orig/crypto/bn/asm/x86_64-gcc.c	2010-02-28 05:38:16.000000000 -0800
++++ openssl-1.0.1c/crypto/bn/asm/x86_64-gcc.c	2013-01-17 20:16:12.000000000 -0800
+@@ -55,7 +55,7 @@
+  *    machine.
+  */
+ 
+-#ifdef _WIN64
++#if defined _WIN64 || !defined __LP64__
+ #define BN_ULONG unsigned long long
+ #else
+ #define BN_ULONG unsigned long
+@@ -192,9 +192,9 @@
+ 	asm (
+ 	"	subq	%2,%2		\n"
+ 	".p2align 4			\n"
+-	"1:	movq	(%4,%2,8),%0	\n"
+-	"	adcq	(%5,%2,8),%0	\n"
+-	"	movq	%0,(%3,%2,8)	\n"
++	"1:	movq	(%q4,%2,8),%0	\n"
++	"	adcq	(%q5,%2,8),%0	\n"
++	"	movq	%0,(%q3,%2,8)	\n"
+ 	"	leaq	1(%2),%2	\n"
+ 	"	loop	1b		\n"
+ 	"	sbbq	%0,%0		\n"
+@@ -215,9 +215,9 @@
+ 	asm (
+ 	"	subq	%2,%2		\n"
+ 	".p2align 4			\n"
+-	"1:	movq	(%4,%2,8),%0	\n"
+-	"	sbbq	(%5,%2,8),%0	\n"
+-	"	movq	%0,(%3,%2,8)	\n"
++	"1:	movq	(%q4,%2,8),%0	\n"
++	"	sbbq	(%q5,%2,8),%0	\n"
++	"	movq	%0,(%q3,%2,8)	\n"
+ 	"	leaq	1(%2),%2	\n"
+ 	"	loop	1b		\n"
+ 	"	sbbq	%0,%0		\n"
diff -Nru openssl-1.0.1c/debian/patches/series openssl-1.0.1c/debian/patches/series
--- openssl-1.0.1c/debian/patches/series	2012-06-06 09:30:13.000000000 -0700
+++ openssl-1.0.1c/debian/patches/series	2013-01-17 20:18:43.000000000 -0800
@@ -32,3 +32,5 @@
 renegiotate_tls.patch
 #padlock_conf.patch
 default_bits.patch
+openssl_fix_for_x32.patch
+debian-target-x32.patch

Reply via email to