diff options
Diffstat (limited to 'src/lib/libcrypto/perlasm/x86gas.pl')
| -rw-r--r-- | src/lib/libcrypto/perlasm/x86gas.pl | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/src/lib/libcrypto/perlasm/x86gas.pl b/src/lib/libcrypto/perlasm/x86gas.pl index 682a3a3163..9a1cce026e 100644 --- a/src/lib/libcrypto/perlasm/x86gas.pl +++ b/src/lib/libcrypto/perlasm/x86gas.pl | |||
| @@ -45,8 +45,9 @@ 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 ($#_==1 && $opcode =~ m/^(call|clflush|j|loop|set)/o) | 48 | elsif ($opcode =~ m/^j/o && $#_==1) { &::emit($opcode,@arg); } |
| 49 | { &::emit($opcode,@arg); } | 49 | elsif ($opcode eq "call" && $#_==1) { &::emit($opcode,@arg); } |
| 50 | elsif ($opcode =~ m/^set/&& $#_==1) { &::emit($opcode,@arg); } | ||
| 50 | else { &::emit($opcode.$suffix,@arg);} | 51 | else { &::emit($opcode.$suffix,@arg);} |
| 51 | 52 | ||
| 52 | 1; | 53 | 1; |
| @@ -90,7 +91,6 @@ sub ::DWP | |||
| 90 | } | 91 | } |
| 91 | sub ::QWP { &::DWP(@_); } | 92 | sub ::QWP { &::DWP(@_); } |
| 92 | sub ::BP { &::DWP(@_); } | 93 | sub ::BP { &::DWP(@_); } |
| 93 | sub ::WP { &::DWP(@_); } | ||
| 94 | sub ::BC { @_; } | 94 | sub ::BC { @_; } |
| 95 | sub ::DWC { @_; } | 95 | sub ::DWC { @_; } |
| 96 | 96 | ||
| @@ -149,24 +149,22 @@ 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 ($::macosx) | 152 | { if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out) { |
| 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) | ||
| 153 | { if (%non_lazy_ptr) | 158 | { if (%non_lazy_ptr) |
| 154 | { push(@out,".section __IMPORT,__pointers,non_lazy_symbol_pointers\n"); | 159 | { push(@out,".section __IMPORT,__pointers,non_lazy_symbol_pointers\n"); |
| 155 | foreach $i (keys %non_lazy_ptr) | 160 | foreach $i (keys %non_lazy_ptr) |
| 156 | { push(@out,"$non_lazy_ptr{$i}:\n.indirect_symbol\t$i\n.long\t0\n"); } | 161 | { push(@out,"$non_lazy_ptr{$i}:\n.indirect_symbol\t$i\n.long\t0\n"); } |
| 157 | } | 162 | } |
| 158 | } | 163 | } |
| 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 | } | ||
| 165 | push(@out,$initseg) if ($initseg); | 164 | push(@out,$initseg) if ($initseg); |
| 166 | } | 165 | } |
| 167 | 166 | ||
| 168 | sub ::data_byte { push(@out,".byte\t".join(',',@_)."\n"); } | 167 | sub ::data_byte { push(@out,".byte\t".join(',',@_)."\n"); } |
| 169 | sub ::data_short{ push(@out,".value\t".join(',',@_)."\n"); } | ||
| 170 | sub ::data_word { push(@out,".long\t".join(',',@_)."\n"); } | 168 | sub ::data_word { push(@out,".long\t".join(',',@_)."\n"); } |
| 171 | 169 | ||
| 172 | sub ::align | 170 | sub ::align |
| @@ -182,7 +180,16 @@ sub ::align | |||
| 182 | sub ::picmeup | 180 | sub ::picmeup |
| 183 | { my($dst,$sym,$base,$reflabel)=@_; | 181 | { my($dst,$sym,$base,$reflabel)=@_; |
| 184 | 182 | ||
| 185 | if (($::pic && ($::elf || $::aout)) || $::macosx) | 183 | if ($::openbsd) |
| 184 | { &::emitraw("#if defined(PIC) || defined(__PIC__)"); | ||
| 185 | &::emitraw("PIC_PROLOGUE"); | ||
| 186 | &::mov($dst, &::DWP("PIC_GOT($sym)")); | ||
| 187 | &::emitraw("PIC_EPILOGUE"); | ||
| 188 | &::emitraw("#else /* PIC */"); | ||
| 189 | &::lea($dst,&::DWP($sym)); | ||
| 190 | &::emitraw("#endif /* PIC */"); | ||
| 191 | } | ||
| 192 | elsif ($::pic && ($::elf || $::aout)) | ||
| 186 | { if (!defined($base)) | 193 | { if (!defined($base)) |
| 187 | { &::call(&::label("PIC_me_up")); | 194 | { &::call(&::label("PIC_me_up")); |
| 188 | &::set_label("PIC_me_up"); | 195 | &::set_label("PIC_me_up"); |
| @@ -208,17 +215,24 @@ sub ::picmeup | |||
| 208 | sub ::initseg | 215 | sub ::initseg |
| 209 | { my $f=$nmdecor.shift; | 216 | { my $f=$nmdecor.shift; |
| 210 | 217 | ||
| 211 | if ($::android) | 218 | if ($::openbsd) |
| 212 | { $initseg.=<<___; | 219 | { $initseg.=<<___; |
| 213 | .section .init_array | 220 | .section .init |
| 214 | .align 4 | 221 | PIC_PROLOGUE |
| 215 | .long $f | 222 | call PIC_PLT($f) |
| 223 | PIC_EPILOGUE | ||
| 224 | jmp .Linitalign | ||
| 225 | .align $align | ||
| 226 | .Linitalign: | ||
| 216 | ___ | 227 | ___ |
| 217 | } | 228 | } |
| 218 | elsif ($::elf) | 229 | elsif ($::elf) |
| 219 | { $initseg.=<<___; | 230 | { $initseg.=<<___; |
| 220 | .section .init | 231 | .section .init |
| 221 | call $f | 232 | call $f |
| 233 | jmp .Linitalign | ||
| 234 | .align $align | ||
| 235 | .Linitalign: | ||
| 222 | ___ | 236 | ___ |
| 223 | } | 237 | } |
| 224 | elsif ($::coff) | 238 | elsif ($::coff) |
