diff options
Diffstat (limited to 'src/lib/libcrypto/perlasm/x86unix.pl')
-rw-r--r-- | src/lib/libcrypto/perlasm/x86unix.pl | 53 |
1 files changed, 47 insertions, 6 deletions
diff --git a/src/lib/libcrypto/perlasm/x86unix.pl b/src/lib/libcrypto/perlasm/x86unix.pl index 9ceabf0705..72bde061c5 100644 --- a/src/lib/libcrypto/perlasm/x86unix.pl +++ b/src/lib/libcrypto/perlasm/x86unix.pl | |||
@@ -87,12 +87,12 @@ sub main'DWP | |||
87 | $ret.=$addr if ($addr ne "") && ($addr ne 0); | 87 | $ret.=$addr if ($addr ne "") && ($addr ne 0); |
88 | if ($reg2 ne "") | 88 | if ($reg2 ne "") |
89 | { | 89 | { |
90 | if($idx ne "") | 90 | if($idx ne "" && $idx != 0) |
91 | { $ret.="($reg1,$reg2,$idx)"; } | 91 | { $ret.="($reg1,$reg2,$idx)"; } |
92 | else | 92 | else |
93 | { $ret.="($reg1,$reg2)"; } | 93 | { $ret.="($reg1,$reg2)"; } |
94 | } | 94 | } |
95 | else | 95 | elsif ($reg1 ne "") |
96 | { $ret.="($reg1)" } | 96 | { $ret.="($reg1)" } |
97 | return($ret); | 97 | return($ret); |
98 | } | 98 | } |
@@ -167,7 +167,7 @@ sub main'pop { &out1("popl",@_); $stack-=4; } | |||
167 | sub main'pushf { &out0("pushf"); $stack+=4; } | 167 | sub main'pushf { &out0("pushf"); $stack+=4; } |
168 | sub main'popf { &out0("popf"); $stack-=4; } | 168 | sub main'popf { &out0("popf"); $stack-=4; } |
169 | sub main'not { &out1("notl",@_); } | 169 | sub main'not { &out1("notl",@_); } |
170 | sub main'call { &out1("call",$under.$_[0]); } | 170 | sub main'call { &out1("call",($_[0]=~/^\.L/?'':$under).$_[0]); } |
171 | sub main'ret { &out0("ret"); } | 171 | sub main'ret { &out0("ret"); } |
172 | sub main'nop { &out0("nop"); } | 172 | sub main'nop { &out0("nop"); } |
173 | 173 | ||
@@ -345,15 +345,15 @@ sub main'function_end | |||
345 | popl %ebx | 345 | popl %ebx |
346 | popl %ebp | 346 | popl %ebp |
347 | ret | 347 | ret |
348 | .${func}_end: | 348 | .L_${func}_end: |
349 | EOF | 349 | EOF |
350 | push(@out,$tmp); | 350 | push(@out,$tmp); |
351 | 351 | ||
352 | if ($main'cpp) | 352 | if ($main'cpp) |
353 | { push(@out,"\tSIZE($func,.${func}_end-$func)\n"); } | 353 | { push(@out,"\tSIZE($func,.L_${func}_end-$func)\n"); } |
354 | elsif ($main'gaswin) | 354 | elsif ($main'gaswin) |
355 | { $tmp=push(@out,"\t.align 4\n"); } | 355 | { $tmp=push(@out,"\t.align 4\n"); } |
356 | else { push(@out,"\t.size\t$func,.${func}_end-$func\n"); } | 356 | else { push(@out,"\t.size\t$func,.L_${func}_end-$func\n"); } |
357 | push(@out,".ident \"$func\"\n"); | 357 | push(@out,".ident \"$func\"\n"); |
358 | $stack=0; | 358 | $stack=0; |
359 | %label=(); | 359 | %label=(); |
@@ -426,6 +426,11 @@ sub main'swtmp | |||
426 | 426 | ||
427 | sub main'comment | 427 | sub main'comment |
428 | { | 428 | { |
429 | if ($main'elf) # GNU and SVR4 as'es use different comment delimiters, | ||
430 | { # so we just skip comments... | ||
431 | push(@out,"\n"); | ||
432 | return; | ||
433 | } | ||
429 | foreach (@_) | 434 | foreach (@_) |
430 | { | 435 | { |
431 | if (/^\s*$/) | 436 | if (/^\s*$/) |
@@ -542,3 +547,39 @@ sub popvars | |||
542 | &main'pop("edx"); | 547 | &main'pop("edx"); |
543 | &main'popf(); | 548 | &main'popf(); |
544 | } | 549 | } |
550 | |||
551 | sub main'picmeup | ||
552 | { | ||
553 | local($dst,$sym)=@_; | ||
554 | if ($main'cpp) | ||
555 | { | ||
556 | local($tmp)=<<___; | ||
557 | #if (defined(ELF) || defined(SOL)) && defined(PIC) | ||
558 | .align 8 | ||
559 | call 1f | ||
560 | 1: popl $regs{$dst} | ||
561 | addl \$_GLOBAL_OFFSET_TABLE_+[.-1b],$regs{$dst} | ||
562 | movl $sym\@GOT($regs{$dst}),$regs{$dst} | ||
563 | #else | ||
564 | leal $sym,$regs{$dst} | ||
565 | #endif | ||
566 | ___ | ||
567 | push(@out,$tmp); | ||
568 | } | ||
569 | elsif ($main'pic && ($main'elf || $main'aout)) | ||
570 | { | ||
571 | push(@out,"\t.align\t8\n"); | ||
572 | &main'call(&main'label("PIC_me_up")); | ||
573 | &main'set_label("PIC_me_up"); | ||
574 | &main'blindpop($dst); | ||
575 | &main'add($dst,"\$$under"."_GLOBAL_OFFSET_TABLE_+[.-". | ||
576 | &main'label("PIC_me_up") . "]"); | ||
577 | &main'mov($dst,&main'DWP($sym."\@GOT",$dst)); | ||
578 | } | ||
579 | else | ||
580 | { | ||
581 | &main'lea($dst,&main'DWP($sym)); | ||
582 | } | ||
583 | } | ||
584 | |||
585 | sub main'blindpop { &out1("popl",@_); } | ||