]> granicus.if.org Git - openssl/commitdiff
perlasm update from HEAD.
authorAndy Polyakov <appro@openssl.org>
Mon, 14 Nov 2011 20:44:20 +0000 (20:44 +0000)
committerAndy Polyakov <appro@openssl.org>
Mon, 14 Nov 2011 20:44:20 +0000 (20:44 +0000)
crypto/perlasm/ppc-xlate.pl
crypto/perlasm/x86_64-xlate.pl
crypto/perlasm/x86asm.pl
crypto/perlasm/x86gas.pl
crypto/perlasm/x86masm.pl
crypto/perlasm/x86nasm.pl

index 4579671c9701107d0bf04c59a81fc3fde010d01b..a3edd982b664778e17b89b45f644e6133451744e 100755 (executable)
@@ -31,10 +31,9 @@ my $globl = sub {
                                $ret .= ".type  $name,\@function";
                                last;
                              };
-       /linux.*64/     && do { $ret .= ".globl .$name\n";
-                               $ret .= ".type  .$name,\@function\n";
+       /linux.*64/     && do { $ret .= ".globl $name\n";
+                               $ret .= ".type  $name,\@function\n";
                                $ret .= ".section       \".opd\",\"aw\"\n";
-                               $ret .= ".globl $name\n";
                                $ret .= ".align 3\n";
                                $ret .= "$name:\n";
                                $ret .= ".quad  .$name,.TOC.\@tocbase,0\n";
@@ -62,6 +61,14 @@ my $machine = sub {
     }
     ".machine  $arch";
 };
+my $size = sub {
+    if ($flavour =~ /linux.*32/)
+    {  shift;
+       ".size  " . join(",",@_);
+    }
+    else
+    {  "";     }
+};
 my $asciz = sub {
     shift;
     my $line = join(",",@_);
index fcb0ce0251a3a36e61b9c500ab3dc1a8844f4884..1f4ce0a84e664233c00333630bf01db05ac679bb 100755 (executable)
@@ -276,6 +276,7 @@ my %globals;
            $self->{label} =~ s/(?<![\w\$\.])0x([0-9a-f]+)/0$1h/ig;
            $self->{label} = "($self->{label})" if ($self->{label} =~ /[\*\+\-\/]/);
            $sz="q" if ($self->{asterisk} || opcode->mnemonic() eq "movq");
+           $sz="l" if (opcode->mnemonic() eq "movd");
 
            if (defined($self->{index})) {
                sprintf "%s[%s%s*%d%s]",$szmap{$sz},
@@ -518,6 +519,7 @@ my %globals;
                    elsif ($flavour eq "mingw64") { $self->{value} = ""; }
                } elsif ($dir =~ /\.comm/) {
                    $self->{value} = "$dir\t$prefix$line";
+                   $self->{value} =~ s|,([0-9]+),([0-9]+)$|",$1,".log($2)/log(2)|e if ($flavour eq "macosx");
                }
                $line = "";
                return $self;
@@ -567,7 +569,7 @@ my %globals;
                                            $v.=" READONLY";
                                            $v.=" ALIGN(".($1 eq "p" ? 4 : 8).")" if ($masm>=$masmref);
                                        } elsif ($line=~/\.CRT\$/i) {
-                                           $v.=" READONLY DWORD";
+                                           $v.=" READONLY ALIGN(8)";
                                        }
                                    }
                                    $current_segment = $line;
@@ -589,7 +591,7 @@ my %globals;
                                            $self->{value}="${decor}SEH_end_$current_function->{name}:";
                                            $self->{value}.=":\n" if($masm);
                                        }
-                                       $self->{value}.="$current_function->{name}\tENDP" if($masm);
+                                       $self->{value}.="$current_function->{name}\tENDP" if($masm && $current_function->{name});
                                        undef $current_function;
                                    }
                                    last;
@@ -666,14 +668,14 @@ my %regrm = (     "%eax"=>0, "%ecx"=>1, "%edx"=>2, "%ebx"=>3,
 my $movq = sub {       # elderly gas can't handle inter-register movq
   my $arg = shift;
   my @opcode=(0x66);
-    if ($arg =~ /%xmm([0-9]+),%r(\w+)/) {
+    if ($arg =~ /%xmm([0-9]+),\s*%r(\w+)/) {
        my ($src,$dst)=($1,$2);
        if ($dst !~ /[0-9]+/)   { $dst = $regrm{"%e$dst"}; }
        rex(\@opcode,$src,$dst,0x8);
        push @opcode,0x0f,0x7e;
        push @opcode,0xc0|(($src&7)<<3)|($dst&7);       # ModR/M
        @opcode;
-    } elsif ($arg =~ /%r(\w+),%xmm([0-9]+)/) {
+    } elsif ($arg =~ /%r(\w+),\s*%xmm([0-9]+)/) {
        my ($src,$dst)=($2,$1);
        if ($dst !~ /[0-9]+/)   { $dst = $regrm{"%e$dst"}; }
        rex(\@opcode,$src,$dst,0x8);
@@ -686,7 +688,7 @@ my $movq = sub {    # elderly gas can't handle inter-register movq
 };
 
 my $pextrd = sub {
-    if (shift =~ /\$([0-9]+),%xmm([0-9]+),(%\w+)/) {
+    if (shift =~ /\$([0-9]+),\s*%xmm([0-9]+),\s*(%\w+)/) {
       my @opcode=(0x66);
        $imm=$1;
        $src=$2;
@@ -704,7 +706,7 @@ my $pextrd = sub {
 };
 
 my $pinsrd = sub {
-    if (shift =~ /\$([0-9]+),(%\w+),%xmm([0-9]+)/) {
+    if (shift =~ /\$([0-9]+),\s*(%\w+),\s*%xmm([0-9]+)/) {
       my @opcode=(0x66);
        $imm=$1;
        $src=$2;
@@ -722,7 +724,7 @@ my $pinsrd = sub {
 };
 
 my $pshufb = sub {
-    if (shift =~ /%xmm([0-9]+),%xmm([0-9]+)/) {
+    if (shift =~ /%xmm([0-9]+),\s*%xmm([0-9]+)/) {
       my @opcode=(0x66);
        rex(\@opcode,$2,$1);
        push @opcode,0x0f,0x38,0x00;
@@ -734,7 +736,7 @@ my $pshufb = sub {
 };
 
 my $palignr = sub {
-    if (shift =~ /\$([0-9]+),%xmm([0-9]+),%xmm([0-9]+)/) {
+    if (shift =~ /\$([0-9]+),\s*%xmm([0-9]+),\s*%xmm([0-9]+)/) {
       my @opcode=(0x66);
        rex(\@opcode,$3,$2);
        push @opcode,0x0f,0x3a,0x0f;
index b7ddb8137f306011dfe327e3d431c3d213b437f4..eb543db2f66eb979371d67e2e25f4e6a5cc861cd 100644 (file)
@@ -218,7 +218,7 @@ sub ::asm_init
     $filename=$fn;
     $i386=$cpu;
 
-    $elf=$cpp=$coff=$aout=$macosx=$win32=$netware=$mwerks=0;
+    $elf=$cpp=$coff=$aout=$macosx=$win32=$netware=$mwerks=$android=0;
     if    (($type eq "elf"))
     {  $elf=1;                 require "x86gas.pl";    }
     elsif (($type eq "a\.out"))
@@ -235,6 +235,8 @@ sub ::asm_init
     {  $win32=1;               require "x86masm.pl";   }
     elsif (($type eq "macosx"))
     {  $aout=1; $macosx=1;     require "x86gas.pl";    }
+    elsif (($type eq "android"))
+    {  $elf=1; $android=1;     require "x86gas.pl";    }
     else
     {  print STDERR <<"EOF";
 Pick one target type from
index 3a791062983558935d6239d1858b2666acab2ac7..4af871889a756cb38c2eb0d985dea30928ea2279 100644 (file)
@@ -160,7 +160,8 @@ sub ::file_end
     }
     if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out) {
        my $tmp=".comm\t${nmdecor}OPENSSL_ia32cap_P,8";
-       if ($::elf)     { push (@out,"$tmp,4\n"); }
+       if ($::macosx)  { push (@out,"$tmp,2\n"); }
+       elsif ($::elf)  { push (@out,"$tmp,4\n"); }
        else            { push (@out,"$tmp\n"); }
     }
     push(@out,$initseg) if ($initseg);
@@ -183,7 +184,7 @@ sub ::align
 sub ::picmeup
 { my($dst,$sym,$base,$reflabel)=@_;
 
-    if ($::pic && ($::elf || $::aout))
+    if (($::pic && ($::elf || $::aout)) || $::macosx)
     {  if (!defined($base))
        {   &::call(&::label("PIC_me_up"));
            &::set_label("PIC_me_up");
@@ -209,13 +210,17 @@ sub ::picmeup
 sub ::initseg
 { my $f=$nmdecor.shift;
 
-    if ($::elf)
+    if ($::android)
+    {  $initseg.=<<___;
+.section       .init_array
+.align 4
+.long  $f
+___
+    }
+    elsif ($::elf)
     {  $initseg.=<<___;
 .section       .init
        call    $f
-       jmp     .Linitalign
-.align $align
-.Linitalign:
 ___
     }
     elsif ($::coff)
index 279ab29b8c352277372d0e2850c0f534a20a47e2..188b393c76eadc89a093fff7555635d9938d73b3 100644 (file)
@@ -185,4 +185,11 @@ ___
 sub ::dataseg
 {   push(@out,"$segment\tENDS\n_DATA\tSEGMENT\n"); $segment="_DATA";   }
 
+sub ::safeseh
+{ my $nm=shift;
+    push(@out,"IF \@Version GE 710\n");
+    push(@out,".SAFESEH        ".&::LABEL($nm,$nmdecor.$nm)."\n");
+    push(@out,"ENDIF\n");
+}
+
 1;
index 23a84ba56355ce0559f93f288fefabfabe6ca94f..ca2511c9eb916538618151fee8c514fbccb704de 100644 (file)
@@ -167,4 +167,11 @@ sub ::dataseg
     else               { push(@out,"section\t.data align=4\n"); }
 }
 
+sub ::safeseh
+{ my $nm=shift;
+    push(@out,"%if     __NASM_VERSION_ID__ >= 0x02030000\n");
+    push(@out,"safeseh ".&::LABEL($nm,$nmdecor.$nm)."\n");
+    push(@out,"%endif\n");
+}
+
 1;