From: Mike Frysinger <vapier@gentoo.org>
Date: Sat, 21 Mar 2015 06:01:25 -0400
Subject: crypto: use bigint in x86-64 perl

When building on x32 systems where the default type is 32bit, make sure
we can transparently represent 64bit integers.  Otherwise we end up with
build errors like:
/usr/bin/perl asm/ghash-x86_64.pl elf > ghash-x86_64.s
Integer overflow in hexadecimal number at asm/../../perlasm/x86_64-xlate.pl line 201, <> line 890.
...
ghash-x86_64.s: Assembler messages:
ghash-x86_64.s:890: Error: junk '.15473355479995e+19' after expression

We don't enable this globally as there are some cases where we'd get
32bit values interpreted as unsigned when we need them as signed.

Reported-by: Bertrand Jacquin <bertrand@jacquin.bzh>
Bug: https://bugs.gentoo.org/542618
Upstream-Bug: https://rt.openssl.org/Ticket/Display.html?id=3759&user=guest&pass=guest
---
 crypto/perlasm/x86_64-xlate.pl | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/crypto/perlasm/x86_64-xlate.pl b/crypto/perlasm/x86_64-xlate.pl
index d19195e..96d9edd 100755
--- a/crypto/perlasm/x86_64-xlate.pl
+++ b/crypto/perlasm/x86_64-xlate.pl
@@ -269,6 +269,10 @@ my %globals;
 		$self->{base} = $self->{index}; $self->{index} = $1;
 	}
 
+	# When building on x32 ABIs, the expanded hex value might be too
+	# big to fit into 32bits.  Enable transparent 64bit support here
+	# so we can safely print it out.
+	use bigint;
 	if ($gas) {
 	    $self->{label} =~ s/^___imp_/__imp__/   if ($flavour eq "mingw64");
 
-- 
2.15.1

