1From 07a0bbdd179a52907485fd793f0df31c097447af Mon Sep 17 00:00:00 2001
2From: Andy Polyakov <appro@openssl.org>
3Date: Sun, 5 May 2019 18:25:50 +0200
4Subject: [PATCH] crypto/perlasm/ppc-xlate.pl: add linux64v2 flavour
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9This is a big endian ELFv2 configuration. ELFv2 was already being
10used for little endian, and big endian was traditionally ELFv1
11but there are practical configurations that use ELFv2 with big
12endian nowadays (Adélie Linux, Void Linux, possibly Gentoo, etc.)
13
14Reviewed-by: Paul Dale <paul.dale@oracle.com>
15Reviewed-by: Richard Levitte <levitte@openssl.org>
16(Merged from https://github.com/openssl/openssl/pull/8883)
17Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
18---
19 crypto/perlasm/ppc-xlate.pl | 8 ++++----
20 1 file changed, 4 insertions(+), 4 deletions(-)
21
22diff --git a/crypto/perlasm/ppc-xlate.pl b/crypto/perlasm/ppc-xlate.pl
23index d220c6245b..eec82b8d48 100755
24--- a/crypto/perlasm/ppc-xlate.pl
25+++ b/crypto/perlasm/ppc-xlate.pl
26@@ -49,7 +49,7 @@ my $globl = sub {
27 	/osx/		&& do { $name = "_$name";
28 				last;
29 			      };
30-	/linux.*(32|64le)/
31+	/linux.*(32|64(le|v2))/
32 			&& do {	$ret .= ".globl	$name";
33 				if (!$$type) {
34 				    $ret .= "\n.type	$name,\@function";
35@@ -80,7 +80,7 @@ my $globl = sub {
36 };
37 my $text = sub {
38     my $ret = ($flavour =~ /aix/) ? ".csect\t.text[PR],7" : ".text";
39-    $ret = ".abiversion	2\n".$ret	if ($flavour =~ /linux.*64le/);
40+    $ret = ".abiversion	2\n".$ret	if ($flavour =~ /linux.*64(le|v2)/);
41     $ret;
42 };
43 my $machine = sub {
44@@ -186,7 +186,7 @@ my $vmr = sub {
45
46 # Some ABIs specify vrsave, special-purpose register #256, as reserved
47 # for system use.
48-my $no_vrsave = ($flavour =~ /aix|linux64le/);
49+my $no_vrsave = ($flavour =~ /aix|linux64(le|v2)/);
50 my $mtspr = sub {
51     my ($f,$idx,$ra) = @_;
52     if ($idx == 256 && $no_vrsave) {
53@@ -318,7 +318,7 @@ while($line=<>) {
54 	if ($label) {
55 	    my $xlated = ($GLOBALS{$label} or $label);
56 	    print "$xlated:";
57-	    if ($flavour =~ /linux.*64le/) {
58+	    if ($flavour =~ /linux.*64(le|v2)/) {
59 		if ($TYPES{$label} =~ /function/) {
60 		    printf "\n.localentry	%s,0\n",$xlated;
61 		}
62--
632.25.0
64
65