X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fperlasm%2Fx86_64-xlate.pl;h=d112cf2056fc36302a36b44257564c7c745890d0;hp=7487249c7922fef0380d49b17054ab151aca0e07;hb=d256b95768ae01baba1915c802e2ba05c25348cc;hpb=5d0d60e2f59d48c579379d927eaaeb0fa5d5500a diff --git a/crypto/perlasm/x86_64-xlate.pl b/crypto/perlasm/x86_64-xlate.pl index 7487249c79..d112cf2056 100755 --- a/crypto/perlasm/x86_64-xlate.pl +++ b/crypto/perlasm/x86_64-xlate.pl @@ -133,6 +133,10 @@ my $current_function; my $self = shift; if (!$masm) { + # Solaris /usr/ccs/bin/as can't handle multiplications + # in $self->{value} + $self->{value} =~ s/(?{value} =~ s/([0-9]+\s*[\*\/\%]\s*[0-9]+)/eval($1)/eg; sprintf "\$%s",$self->{value}; } else { $self->{value} =~ s/0x([0-9a-f]+)/0$1h/ig; @@ -163,11 +167,17 @@ my $current_function; my $self = shift; my $sz = shift; + # Silently convert all EAs to 64-bit. This is required for + # elder GNU assembler and results in more compact code, + # *but* most importantly AES module depends on this feature! + $self->{index} =~ s/^[er](.?[0-9xpi])[d]?$/r\1/; + $self->{base} =~ s/^[er](.?[0-9xpi])[d]?$/r\1/; + if (!$masm) { - # elder GNU assembler insists on 64-bit EAs:-( - # on pros side, this results in more compact code:-) - $self->{index} =~ s/^[er](.?[0-9xp])[d]?$/r\1/; - $self->{base} =~ s/^[er](.?[0-9xp])[d]?$/r\1/; + # Solaris /usr/ccs/bin/as can't handle multiplications + # in $self->{label} + $self->{label} =~ s/(?{label} =~ s/([0-9]+\s*[\*\/\%]\s*[0-9]+)/eval($1)/eg; if (defined($self->{index})) { sprintf "%s(%%%s,%%%s,%d)", @@ -325,12 +335,12 @@ my $current_function; undef $self->{value}; $line = substr($line,@+[0]); $line =~ s/^\s+//; SWITCH: for ($dir) { - /\.(text|data)/ + /\.(text)/ && do { my $v=undef; $v="$current_segment\tENDS\n" if ($current_segment); - $current_segment = "_$1"; + $current_segment = "_$1\$"; $current_segment =~ tr/[a-z]/[A-Z]/; - $v.="$current_segment\tSEGMENT PARA"; + $v.="$current_segment\tSEGMENT ALIGN(64) 'CODE'"; $self->{value} = $v; last; }; @@ -476,7 +486,10 @@ close STDOUT; # arguments passed to callee, *but* not less than 4! This means that # upon function entry point 5th argument resides at 40(%rsp), as well # as that 32 bytes from 8(%rsp) can always be used as temporal -# storage [without allocating a frame]. +# storage [without allocating a frame]. One can actually argue that +# one can assume a "red zone" above stack pointer under Win64 as well. +# Point is that at apparently no accasion Windows would alter the area +# above stack pointer in true asynchronous manner... # # All the above means that if assembler programmer adheres to Unix # register and stack layout, but disregards the "red zone" existense,