diff options
| author | djm <> | 2012-10-13 21:23:50 +0000 |
|---|---|---|
| committer | djm <> | 2012-10-13 21:23:50 +0000 |
| commit | 228cae30b117c2493f69ad3c195341cd6ec8d430 (patch) | |
| tree | 29ff00b10d52c0978077c4fd83c33b065bade73e /src/lib/libcrypto/perlasm/x86gas.pl | |
| parent | 731838c66b52c0ae5888333005b74115a620aa96 (diff) | |
| download | openbsd-228cae30b117c2493f69ad3c195341cd6ec8d430.tar.gz openbsd-228cae30b117c2493f69ad3c195341cd6ec8d430.tar.bz2 openbsd-228cae30b117c2493f69ad3c195341cd6ec8d430.zip | |
import OpenSSL-1.0.1c
Diffstat (limited to 'src/lib/libcrypto/perlasm/x86gas.pl')
| -rw-r--r-- | src/lib/libcrypto/perlasm/x86gas.pl | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/lib/libcrypto/perlasm/x86gas.pl b/src/lib/libcrypto/perlasm/x86gas.pl index 6eab727fd4..682a3a3163 100644 --- a/src/lib/libcrypto/perlasm/x86gas.pl +++ b/src/lib/libcrypto/perlasm/x86gas.pl | |||
| @@ -45,9 +45,8 @@ sub ::generic | |||
| 45 | undef $suffix if ($dst =~ m/^%[xm]/o || $src =~ m/^%[xm]/o); | 45 | undef $suffix if ($dst =~ m/^%[xm]/o || $src =~ m/^%[xm]/o); |
| 46 | 46 | ||
| 47 | if ($#_==0) { &::emit($opcode); } | 47 | if ($#_==0) { &::emit($opcode); } |
| 48 | elsif ($opcode =~ m/^j/o && $#_==1) { &::emit($opcode,@arg); } | 48 | elsif ($#_==1 && $opcode =~ m/^(call|clflush|j|loop|set)/o) |
| 49 | elsif ($opcode eq "call" && $#_==1) { &::emit($opcode,@arg); } | 49 | { &::emit($opcode,@arg); } |
| 50 | elsif ($opcode =~ m/^set/&& $#_==1) { &::emit($opcode,@arg); } | ||
| 51 | else { &::emit($opcode.$suffix,@arg);} | 50 | else { &::emit($opcode.$suffix,@arg);} |
| 52 | 51 | ||
| 53 | 1; | 52 | 1; |
| @@ -91,6 +90,7 @@ sub ::DWP | |||
| 91 | } | 90 | } |
| 92 | sub ::QWP { &::DWP(@_); } | 91 | sub ::QWP { &::DWP(@_); } |
| 93 | sub ::BP { &::DWP(@_); } | 92 | sub ::BP { &::DWP(@_); } |
| 93 | sub ::WP { &::DWP(@_); } | ||
| 94 | sub ::BC { @_; } | 94 | sub ::BC { @_; } |
| 95 | sub ::DWC { @_; } | 95 | sub ::DWC { @_; } |
| 96 | 96 | ||
| @@ -149,22 +149,24 @@ sub ::public_label | |||
| 149 | { push(@out,".globl\t".&::LABEL($_[0],$nmdecor.$_[0])."\n"); } | 149 | { push(@out,".globl\t".&::LABEL($_[0],$nmdecor.$_[0])."\n"); } |
| 150 | 150 | ||
| 151 | sub ::file_end | 151 | sub ::file_end |
| 152 | { if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out) { | 152 | { if ($::macosx) |
| 153 | my $tmp=".comm\t${nmdecor}OPENSSL_ia32cap_P,4"; | ||
| 154 | if ($::elf) { push (@out,"$tmp,4\n"); } | ||
| 155 | else { push (@out,"$tmp\n"); } | ||
| 156 | } | ||
| 157 | if ($::macosx) | ||
| 158 | { if (%non_lazy_ptr) | 153 | { if (%non_lazy_ptr) |
| 159 | { push(@out,".section __IMPORT,__pointers,non_lazy_symbol_pointers\n"); | 154 | { push(@out,".section __IMPORT,__pointers,non_lazy_symbol_pointers\n"); |
| 160 | foreach $i (keys %non_lazy_ptr) | 155 | foreach $i (keys %non_lazy_ptr) |
| 161 | { push(@out,"$non_lazy_ptr{$i}:\n.indirect_symbol\t$i\n.long\t0\n"); } | 156 | { push(@out,"$non_lazy_ptr{$i}:\n.indirect_symbol\t$i\n.long\t0\n"); } |
| 162 | } | 157 | } |
| 163 | } | 158 | } |
| 159 | if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out) { | ||
| 160 | my $tmp=".comm\t${nmdecor}OPENSSL_ia32cap_P,8"; | ||
| 161 | if ($::macosx) { push (@out,"$tmp,2\n"); } | ||
| 162 | elsif ($::elf) { push (@out,"$tmp,4\n"); } | ||
| 163 | else { push (@out,"$tmp\n"); } | ||
| 164 | } | ||
| 164 | push(@out,$initseg) if ($initseg); | 165 | push(@out,$initseg) if ($initseg); |
| 165 | } | 166 | } |
| 166 | 167 | ||
| 167 | sub ::data_byte { push(@out,".byte\t".join(',',@_)."\n"); } | 168 | sub ::data_byte { push(@out,".byte\t".join(',',@_)."\n"); } |
| 169 | sub ::data_short{ push(@out,".value\t".join(',',@_)."\n"); } | ||
| 168 | sub ::data_word { push(@out,".long\t".join(',',@_)."\n"); } | 170 | sub ::data_word { push(@out,".long\t".join(',',@_)."\n"); } |
| 169 | 171 | ||
| 170 | sub ::align | 172 | sub ::align |
| @@ -180,7 +182,7 @@ sub ::align | |||
| 180 | sub ::picmeup | 182 | sub ::picmeup |
| 181 | { my($dst,$sym,$base,$reflabel)=@_; | 183 | { my($dst,$sym,$base,$reflabel)=@_; |
| 182 | 184 | ||
| 183 | if ($::pic && ($::elf || $::aout)) | 185 | if (($::pic && ($::elf || $::aout)) || $::macosx) |
| 184 | { if (!defined($base)) | 186 | { if (!defined($base)) |
| 185 | { &::call(&::label("PIC_me_up")); | 187 | { &::call(&::label("PIC_me_up")); |
| 186 | &::set_label("PIC_me_up"); | 188 | &::set_label("PIC_me_up"); |
| @@ -206,13 +208,17 @@ sub ::picmeup | |||
| 206 | sub ::initseg | 208 | sub ::initseg |
| 207 | { my $f=$nmdecor.shift; | 209 | { my $f=$nmdecor.shift; |
| 208 | 210 | ||
| 209 | if ($::elf) | 211 | if ($::android) |
| 212 | { $initseg.=<<___; | ||
| 213 | .section .init_array | ||
| 214 | .align 4 | ||
| 215 | .long $f | ||
| 216 | ___ | ||
| 217 | } | ||
| 218 | elsif ($::elf) | ||
| 210 | { $initseg.=<<___; | 219 | { $initseg.=<<___; |
| 211 | .section .init | 220 | .section .init |
| 212 | call $f | 221 | call $f |
| 213 | jmp .Linitalign | ||
| 214 | .align $align | ||
| 215 | .Linitalign: | ||
| 216 | ___ | 222 | ___ |
| 217 | } | 223 | } |
| 218 | elsif ($::coff) | 224 | elsif ($::coff) |
