Perlasm update from HEAD addressing build problems on non-ELF platforms

after http://cvs.openssl.org/chngview?cn=14661.
This commit is contained in:
Andy Polyakov 2005-12-06 18:47:18 +00:00
parent 95bffa1a1f
commit 05decf3638
4 changed files with 42 additions and 13 deletions

View file

@ -27,7 +27,13 @@ $label="L000";
sub main'asm_init_output { @out=(); }
sub main'asm_get_output { return(@out); }
sub main'get_labels { return(@labels); }
sub main'external_label { push(@labels,@_); }
sub main'external_label
{
push(@labels,@_);
foreach (@_) {
push(@out, "EXTRN\t_$_:DWORD\n");
}
}
sub main'LB
{
@ -166,6 +172,7 @@ sub main'popf { &out0("popfd"); $stack-=4; }
sub main'bswap { &out1("bswap",@_); &using486(); }
sub main'not { &out1("not",@_); }
sub main'call { &out1("call",($_[0]=~/^\$L/?'':'_').$_[0]); }
sub main'call_ptr { &out1p("call",@_); }
sub main'ret { &out0("ret"); }
sub main'nop { &out0("nop"); }
sub main'test { &out2("test",@_); }
@ -246,7 +253,9 @@ sub main'file
local($tmp)=<<"EOF";
TITLE $file.asm
.386
.model FLAT
.model FLAT
_TEXT\$ SEGMENT PAGE 'CODE'
EOF
push(@out,$tmp);
}
@ -258,7 +267,6 @@ sub main'function_begin
push(@labels,$func);
local($tmp)=<<"EOF";
_TEXT\$ SEGMENT PAGE 'CODE'
PUBLIC _$func
$extra
_$func PROC NEAR
@ -276,7 +284,6 @@ sub main'function_begin_B
local($func,$extra)=@_;
local($tmp)=<<"EOF";
_TEXT\$ SEGMENT PAGE 'CODE'
PUBLIC _$func
$extra
_$func PROC NEAR
@ -296,7 +303,6 @@ sub main'function_end
pop ebp
ret
_$func ENDP
_TEXT\$ ENDS
EOF
push(@out,$tmp);
$stack=0;
@ -309,7 +315,6 @@ sub main'function_end_B
local($tmp)=<<"EOF";
_$func ENDP
_TEXT\$ ENDS
EOF
push(@out,$tmp);
$stack=0;
@ -339,6 +344,7 @@ sub main'file_end
elsif (grep {/mm[0-7]\s*,/i} @out) {
grep {s/\.[3-7]86/\.686\n\t\.MMX/} @out;
}
push(@out,"_TEXT\$ ENDS\n");
push(@out,"END\n");
}
@ -411,6 +417,11 @@ sub main'set_label
}
}
sub main'data_byte
{
push(@out,"\tDB\t".join(',',@_)."\n");
}
sub main'data_word
{
push(@out,"\tDD\t".join(',',@_)."\n");
@ -426,7 +437,7 @@ sub out1p
local($name,$p1)=@_;
local($l,$t);
push(@out,"\t$name\t ".&conv($p1)."\n");
push(@out,"\t$name\t".&conv($p1)."\n");
}
sub main'picmeup
@ -442,10 +453,10 @@ sub main'initseg
local($f)=@_;
local($tmp)=<<___;
OPTION DOTNAME
.CRT\$XIU SEGMENT DWORD PUBLIC 'DATA'
.CRT\$XCU SEGMENT DWORD PUBLIC 'DATA'
EXTRN _$f:NEAR
DD _$f
.CRT\$XIU ENDS
.CRT\$XCU ENDS
___
push(@out,$tmp);
}

View file

@ -184,6 +184,7 @@ sub main'popf { &out0("popfd"); $stack-=4; }
sub main'bswap { &out1("bswap",@_); &using486(); }
sub main'not { &out1("not",@_); }
sub main'call { &out1("call",($_[0]=~/^\@L/?'':$under).$_[0]); }
sub main'call_ptr { &out1p("call",@_); }
sub main'ret { &out0("ret"); }
sub main'nop { &out0("nop"); }
sub main'test { &out2("test",@_); }
@ -401,6 +402,11 @@ sub main'set_label
push(@out,"$label{$_[0]}:\n");
}
sub main'data_byte
{
push(@out,(($main'mwerks)?".byte\t":"DB\t").join(',',@_)."\n");
}
sub main'data_word
{
push(@out,(($main'mwerks)?".long\t":"DD\t").join(',',@_)."\n");
@ -417,7 +423,7 @@ sub out1p
my($name,$p1)=@_;
my($l,$t);
push(@out,"\t$name\t ".&conv($p1)."\n");
push(@out,"\t$name\t".&conv($p1)."\n");
}
sub main'picmeup
@ -434,7 +440,7 @@ sub main'initseg
if ($main'win32)
{
local($tmp)=<<___;
segment .CRT\$XIU data
segment .CRT\$XCU data
extern $under$f
DD $under$f
___

View file

@ -200,6 +200,7 @@ sub main'call { my $pre=$under;
{ if ($label{$i} eq $_[0]) { $pre=''; last; } }
&out1("call",$pre.$_[0]);
}
sub main'call_ptr { &out1p("call",@_); }
sub main'ret { &out0("ret"); }
sub main'nop { &out0("nop"); }
sub main'test { &out2("testl",@_); }
@ -215,7 +216,6 @@ sub main'cld { &out0("cld"); }
# SSE2
sub main'emms { &out0("emms"); }
sub main'movd { &out2("movd",@_); }
sub main'movq { &out2("movq",@_); }
sub main'movdqu { &out2("movdqu",@_); }
sub main'movdqa { &out2("movdqa",@_); }
sub main'movdq2q{ &out2("movdq2q",@_); }
@ -227,6 +227,13 @@ sub main'psllq { &out2("psllq",@_); }
sub main'pxor { &out2("pxor",@_); }
sub main'por { &out2("por",@_); }
sub main'pand { &out2("pand",@_); }
sub main'movq {
local($p1,$p2,$optimize)=@_;
if ($optimize && $p1=~/^mm[0-7]$/ && $p2=~/^mm[0-7]$/)
# movq between mmx registers can sink Intel CPUs
{ push(@out,"\tpshufw\t\$0xe4,%$p2,%$p1\n"); }
else { &out2("movq",@_); }
}
# The bswapl instruction is new for the 486. Emulate if i386.
sub main'bswap
@ -588,6 +595,11 @@ ___
}
}
sub main'data_byte
{
push(@out,"\t.byte\t".join(',',@_)."\n");
}
sub main'data_word
{
push(@out,"\t.long\t".join(',',@_)."\n");

View file

@ -183,7 +183,7 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
&mov ("eax",&DWP(12+$i*4,"ebp"));
&mov (&DWP(0+$i*4,"esp"),"eax");
}
&call (&DWP(8,"ebp"));# make the call...
&call_ptr (&DWP(8,"ebp"));# make the call...
&mov ("esp","ebp"); # ... and just restore the stack pointer
# without paying attention to what we called,
# (__cdecl *func) or (__stdcall *one).