diff options
Diffstat (limited to 'lib/libcrypto/perlasm')
-rw-r--r-- | lib/libcrypto/perlasm/x86asm.pl | 8 | ||||
-rw-r--r-- | lib/libcrypto/perlasm/x86unix.pl | 35 |
2 files changed, 40 insertions, 3 deletions
diff --git a/lib/libcrypto/perlasm/x86asm.pl b/lib/libcrypto/perlasm/x86asm.pl index 1cb96e914ab..7c675e3ced3 100644 --- a/lib/libcrypto/perlasm/x86asm.pl +++ b/lib/libcrypto/perlasm/x86asm.pl @@ -18,9 +18,13 @@ sub main'asm_init ($type,$fn,$i386)=@_; $filename=$fn; - $elf=$cpp=$sol=$aout=$win32=$gaswin=0; + $elf=$cpp=$sol=$aout=$win32=$gaswin=$openbsd=0; if ( ($type eq "elf")) { $elf=1; require "x86unix.pl"; } + elsif ( ($type eq "openbsd-elf")) + { $openbsd=$elf=1; require "x86unix.pl"; } + elsif ( ($type eq "openbsd-a.out")) + { $openbsd=1; require "x86unix.pl"; } elsif ( ($type eq "a.out")) { $aout=1; require "x86unix.pl"; } elsif ( ($type eq "gaswin")) @@ -43,6 +47,8 @@ Pick one target type from cpp - format so x86unix.cpp can be used win32 - Windows 95/Windows NT win32n - Windows 95/Windows NT NASM format + openbsd-elf - OpenBSD elf + openbsd-a.out - OpenBSD a.out EOF exit(1); } diff --git a/lib/libcrypto/perlasm/x86unix.pl b/lib/libcrypto/perlasm/x86unix.pl index 10b669bf049..53ad5f49279 100644 --- a/lib/libcrypto/perlasm/x86unix.pl +++ b/lib/libcrypto/perlasm/x86unix.pl @@ -15,6 +15,12 @@ sub main'asm_get_output { return(@out); } sub main'get_labels { return(@labels); } sub main'external_label { push(@labels,@_); } +if ($main'openbsd) + { + $com_start='/*'; + $com_end='*/'; + } + if ($main'cpp) { $align="ALIGN"; @@ -276,6 +282,9 @@ sub main'file { local($file)=@_; + if ($main'openbsd) + { push(@out,"#include <machine/asm.h>\n"); return; } + local($tmp)=<<"EOF"; .file "$file.s" .version "01.01" @@ -291,6 +300,9 @@ sub main'function_begin &main'external_label($func); $func=$under.$func; + if ($main'openbsd) + { push (@out, "\nENTRY($func)\n"); goto skip; } + local($tmp)=<<"EOF"; .text .align $align @@ -303,6 +315,7 @@ EOF { $tmp=push(@out,"\t.def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } else { $tmp=push(@out,"\t.type\t$func,\@function\n"); } push(@out,"$func:\n"); +skip: $tmp=<<"EOF"; pushl %ebp pushl %ebx @@ -321,6 +334,9 @@ sub main'function_begin_B &main'external_label($func); $func=$under.$func; + if ($main'openbsd) + { push(@out, "\nENTRY($func)\n"); goto skip; } + local($tmp)=<<"EOF"; .text .align $align @@ -333,6 +349,7 @@ EOF { $tmp=push(@out,"\t.def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } else { push(@out,"\t.type $func,\@function\n"); } push(@out,"$func:\n"); +skip: $stack=4; } @@ -429,7 +446,8 @@ sub main'swtmp sub main'comment { - if ($main'elf) # GNU and SVR4 as'es use different comment delimiters, + if (!$main'openbsd && $main'elf) + # GNU and SVR4 as'es use different comment delimiters, { # so we just skip comments... push(@out,"\n"); return; @@ -460,7 +478,10 @@ sub main'set_label $label{$_[0]}=".${label}${_[0]}"; $label++; } - push(@out,".align $align\n") if ($_[1] != 0); + if ($main'openbsd) + { push(@out,"_ALIGN_TEXT\n") if ($_[1] != 0); } + else + { push(@out,".align $align\n") if ($_[1] != 0); } push(@out,"$label{$_[0]}:\n"); } @@ -569,6 +590,16 @@ sub main'picmeup ___ push(@out,$tmp); } + elsif ($main'openbsd) + { + push(@out, "#ifdef PIC\n"); + push(@out, "\tPIC_PROLOGUE\n"); + &main'mov($dst,"PIC_GOT($sym)"); + push(@out, "\tPIC_EPILOGUE\n"); + push(@out, "#else\n"); + &main'lea($dst,&main'DWP($sym)); + push(@out, "#endif\n"); + } elsif ($main'pic && ($main'elf || $main'aout)) { push(@out,"\t.align\t8\n"); |