summaryrefslogtreecommitdiffstats
path: root/recipes-connectivity/openssl/openssl-qoriq/crypto_use_bigint_in_x86-64_perl.patch
blob: 99c94337a042c0cbf280c5af2736ee1a38349cd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From ac052c0b383dd6db4cb514a193ba44647504687f Mon Sep 17 00:00:00 2001
From: Cristian Stoica <cristian.stoica@nxp.com>
Date: Thu, 5 May 2016 11:55:46 +0300
Subject: [PATCH] use 64bit integers on x32 systems

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>
URL: https://bugs.gentoo.org/542618

Signed-off-By: Armin Kuster <akuster@mvista.com>
---
 crypto/perlasm/x86_64-xlate.pl | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/crypto/perlasm/x86_64-xlate.pl b/crypto/perlasm/x86_64-xlate.pl
index 7a3dd04..fc6105d 100755
--- a/crypto/perlasm/x86_64-xlate.pl
+++ b/crypto/perlasm/x86_64-xlate.pl
@@ -195,6 +195,11 @@ my %globals;
     sub out {
     	my $self = shift;
 
+	# 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;
+
 	$self->{value} =~ s/\b(0b[0-1]+)/oct($1)/eig;
 	if ($gas) {
 	    # Solaris /usr/ccs/bin/as can't handle multiplications
-- 
2.7.0