diff options
Diffstat (limited to 'src/lib/libcrypto/perlasm/x86unix.pl')
-rw-r--r-- | src/lib/libcrypto/perlasm/x86unix.pl | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/lib/libcrypto/perlasm/x86unix.pl b/src/lib/libcrypto/perlasm/x86unix.pl index 10b669bf04..53ad5f4927 100644 --- a/src/lib/libcrypto/perlasm/x86unix.pl +++ b/src/lib/libcrypto/perlasm/x86unix.pl | |||
@@ -15,6 +15,12 @@ sub main'asm_get_output { return(@out); } | |||
15 | sub main'get_labels { return(@labels); } | 15 | sub main'get_labels { return(@labels); } |
16 | sub main'external_label { push(@labels,@_); } | 16 | sub main'external_label { push(@labels,@_); } |
17 | 17 | ||
18 | if ($main'openbsd) | ||
19 | { | ||
20 | $com_start='/*'; | ||
21 | $com_end='*/'; | ||
22 | } | ||
23 | |||
18 | if ($main'cpp) | 24 | if ($main'cpp) |
19 | { | 25 | { |
20 | $align="ALIGN"; | 26 | $align="ALIGN"; |
@@ -276,6 +282,9 @@ sub main'file | |||
276 | { | 282 | { |
277 | local($file)=@_; | 283 | local($file)=@_; |
278 | 284 | ||
285 | if ($main'openbsd) | ||
286 | { push(@out,"#include <machine/asm.h>\n"); return; } | ||
287 | |||
279 | local($tmp)=<<"EOF"; | 288 | local($tmp)=<<"EOF"; |
280 | .file "$file.s" | 289 | .file "$file.s" |
281 | .version "01.01" | 290 | .version "01.01" |
@@ -291,6 +300,9 @@ sub main'function_begin | |||
291 | &main'external_label($func); | 300 | &main'external_label($func); |
292 | $func=$under.$func; | 301 | $func=$under.$func; |
293 | 302 | ||
303 | if ($main'openbsd) | ||
304 | { push (@out, "\nENTRY($func)\n"); goto skip; } | ||
305 | |||
294 | local($tmp)=<<"EOF"; | 306 | local($tmp)=<<"EOF"; |
295 | .text | 307 | .text |
296 | .align $align | 308 | .align $align |
@@ -303,6 +315,7 @@ EOF | |||
303 | { $tmp=push(@out,"\t.def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } | 315 | { $tmp=push(@out,"\t.def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } |
304 | else { $tmp=push(@out,"\t.type\t$func,\@function\n"); } | 316 | else { $tmp=push(@out,"\t.type\t$func,\@function\n"); } |
305 | push(@out,"$func:\n"); | 317 | push(@out,"$func:\n"); |
318 | skip: | ||
306 | $tmp=<<"EOF"; | 319 | $tmp=<<"EOF"; |
307 | pushl %ebp | 320 | pushl %ebp |
308 | pushl %ebx | 321 | pushl %ebx |
@@ -321,6 +334,9 @@ sub main'function_begin_B | |||
321 | &main'external_label($func); | 334 | &main'external_label($func); |
322 | $func=$under.$func; | 335 | $func=$under.$func; |
323 | 336 | ||
337 | if ($main'openbsd) | ||
338 | { push(@out, "\nENTRY($func)\n"); goto skip; } | ||
339 | |||
324 | local($tmp)=<<"EOF"; | 340 | local($tmp)=<<"EOF"; |
325 | .text | 341 | .text |
326 | .align $align | 342 | .align $align |
@@ -333,6 +349,7 @@ EOF | |||
333 | { $tmp=push(@out,"\t.def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } | 349 | { $tmp=push(@out,"\t.def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } |
334 | else { push(@out,"\t.type $func,\@function\n"); } | 350 | else { push(@out,"\t.type $func,\@function\n"); } |
335 | push(@out,"$func:\n"); | 351 | push(@out,"$func:\n"); |
352 | skip: | ||
336 | $stack=4; | 353 | $stack=4; |
337 | } | 354 | } |
338 | 355 | ||
@@ -429,7 +446,8 @@ sub main'swtmp | |||
429 | 446 | ||
430 | sub main'comment | 447 | sub main'comment |
431 | { | 448 | { |
432 | if ($main'elf) # GNU and SVR4 as'es use different comment delimiters, | 449 | if (!$main'openbsd && $main'elf) |
450 | # GNU and SVR4 as'es use different comment delimiters, | ||
433 | { # so we just skip comments... | 451 | { # so we just skip comments... |
434 | push(@out,"\n"); | 452 | push(@out,"\n"); |
435 | return; | 453 | return; |
@@ -460,7 +478,10 @@ sub main'set_label | |||
460 | $label{$_[0]}=".${label}${_[0]}"; | 478 | $label{$_[0]}=".${label}${_[0]}"; |
461 | $label++; | 479 | $label++; |
462 | } | 480 | } |
463 | push(@out,".align $align\n") if ($_[1] != 0); | 481 | if ($main'openbsd) |
482 | { push(@out,"_ALIGN_TEXT\n") if ($_[1] != 0); } | ||
483 | else | ||
484 | { push(@out,".align $align\n") if ($_[1] != 0); } | ||
464 | push(@out,"$label{$_[0]}:\n"); | 485 | push(@out,"$label{$_[0]}:\n"); |
465 | } | 486 | } |
466 | 487 | ||
@@ -569,6 +590,16 @@ sub main'picmeup | |||
569 | ___ | 590 | ___ |
570 | push(@out,$tmp); | 591 | push(@out,$tmp); |
571 | } | 592 | } |
593 | elsif ($main'openbsd) | ||
594 | { | ||
595 | push(@out, "#ifdef PIC\n"); | ||
596 | push(@out, "\tPIC_PROLOGUE\n"); | ||
597 | &main'mov($dst,"PIC_GOT($sym)"); | ||
598 | push(@out, "\tPIC_EPILOGUE\n"); | ||
599 | push(@out, "#else\n"); | ||
600 | &main'lea($dst,&main'DWP($sym)); | ||
601 | push(@out, "#endif\n"); | ||
602 | } | ||
572 | elsif ($main'pic && ($main'elf || $main'aout)) | 603 | elsif ($main'pic && ($main'elf || $main'aout)) |
573 | { | 604 | { |
574 | push(@out,"\t.align\t8\n"); | 605 | push(@out,"\t.align\t8\n"); |