mirror of
https://github.com/openssl/openssl.git
synced 2025-04-06 20:20:50 +08:00
Finishing touch to perlasm update to make it work on OpenBSD
This changeset brings a finishing touch to stuff we got from botovoq@ Changes to `crypto/perlasm/arm-xlate.pl` deal with verious assembler flavours to keep various assembler compilers happy. We also need to keep original code for 32-bit flavour in `crypto/aes/asm/aesv8-armx.pl`. Reviewed-by: Hugo Landau <hlandau@devever.net> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/24137)
This commit is contained in:
parent
c6e65c1f8e
commit
8e69c18828
@ -106,14 +106,21 @@ my ($zero,$rcon,$mask,$in0,$in1,$tmp,$key)=
|
||||
$flavour=~/64/? map("q$_",(0..6)) : map("q$_",(0..3,8..10));
|
||||
|
||||
|
||||
#
|
||||
# This file generates .s file for 64-bit and 32-bit CPUs.
|
||||
# We don't implement .rodata on 32-bit CPUs yet.
|
||||
#
|
||||
$code.=".rodata\n" if ($flavour =~ /64/);
|
||||
$code.=<<___;
|
||||
.rodata
|
||||
.align 5
|
||||
.Lrcon:
|
||||
.long 0x01,0x01,0x01,0x01
|
||||
.long 0x0c0f0e0d,0x0c0f0e0d,0x0c0f0e0d,0x0c0f0e0d // rotate-n-splat
|
||||
.long 0x1b,0x1b,0x1b,0x1b
|
||||
.previous
|
||||
___
|
||||
$code.=".previous\n" if ($flavour =~ /64/);
|
||||
|
||||
$code.=<<___;
|
||||
.globl ${prefix}_set_encrypt_key
|
||||
.type ${prefix}_set_encrypt_key,%function
|
||||
.align 5
|
||||
@ -140,8 +147,15 @@ $code.=<<___;
|
||||
tst $bits,#0x3f
|
||||
b.ne .Lenc_key_abort
|
||||
|
||||
___
|
||||
$code.=<<___ if ($flavour =~ /64/);
|
||||
adrp $ptr,.Lrcon
|
||||
add $ptr,$ptr,:lo12:.Lrcon
|
||||
___
|
||||
$code.=<<___ if ($flavour =~ /32/);
|
||||
adr $ptr,.Lrcon
|
||||
___
|
||||
$code.=<<___;
|
||||
cmp $bits,#192
|
||||
|
||||
veor $zero,$zero,$zero
|
||||
|
@ -116,9 +116,26 @@ my $asciz = sub {
|
||||
|
||||
my $adrp = sub {
|
||||
my ($args,$comment) = split(m|\s*//|,shift);
|
||||
"\tadrp\t$args\@PAGE";
|
||||
} if ($flavour =~ /ios64/);
|
||||
|
||||
if ($flavour =~ /ios64/) {
|
||||
"\tadrp\t$args\@PAGE";
|
||||
} elsif ($flavour =~ /linux/) {
|
||||
#
|
||||
# there seem to be two forms of 'addrp' instruction
|
||||
# to calculate offset:
|
||||
# addrp x3,x3,:lo12:Lrcon
|
||||
# and alternate form:
|
||||
# addrp x3,x3,:#lo12:Lrcon
|
||||
# the '#' is mandatory for some compilers
|
||||
# so make sure our asm always uses '#' here.
|
||||
#
|
||||
$args =~ s/(\w+)#?:lo2:(\.?\w+)/$1#:lo2:$2/;
|
||||
if ($flavour =~ /linux32/) {
|
||||
"\tadr\t$args";
|
||||
} else {
|
||||
"\tadrp\t$args";
|
||||
}
|
||||
}
|
||||
} if (($flavour =~ /ios64/) || ($flavour =~ /linux/));
|
||||
|
||||
sub range {
|
||||
my ($r,$sfx,$start,$end) = @_;
|
||||
@ -150,7 +167,12 @@ sub expand_line {
|
||||
$line =~ s/\b(\w+)/$GLOBALS{$1} or $1/ge;
|
||||
|
||||
if ($flavour =~ /ios64/) {
|
||||
$line =~ s/#:lo12:(\w+)/$1\@PAGEOFF/;
|
||||
$line =~ s/#?:lo12:(\w+)/$1\@PAGEOFF/;
|
||||
} elsif($flavour =~ /linux/) {
|
||||
#
|
||||
# make '#' mandatory for :lo12: (similar to adrp above)
|
||||
#
|
||||
$line =~ s/#?:lo12:(\.?\w+)/\#:lo12:$1/;
|
||||
}
|
||||
|
||||
return $line;
|
||||
|
Loading…
x
Reference in New Issue
Block a user