summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/perlasm/x86unix.pl
diff options
context:
space:
mode:
authorotto <>2008-09-19 06:09:01 +0000
committerotto <>2008-09-19 06:09:01 +0000
commitd8a728372d924a59e821c02139ecd7915c848b4d (patch)
tree4bd0fad7309fd9e5917f84ba519345a74823bc67 /src/lib/libcrypto/perlasm/x86unix.pl
parent404f42e023f74f798d3e32269dc691e855f21e4c (diff)
downloadopenbsd-d8a728372d924a59e821c02139ecd7915c848b4d.tar.gz
openbsd-d8a728372d924a59e821c02139ecd7915c848b4d.tar.bz2
openbsd-d8a728372d924a59e821c02139ecd7915c848b4d.zip
fix some cause of bad TEXTREL on i386 and amd64
- global function calls in .init sections (diff makes them via PLT) - calls to global functions in aes-586.S (made static or local) - global variable accesses in rc4-x86_64.S (now made via GOT) from djm@large; ok miod@
Diffstat (limited to 'src/lib/libcrypto/perlasm/x86unix.pl')
-rw-r--r--src/lib/libcrypto/perlasm/x86unix.pl56
1 files changed, 51 insertions, 5 deletions
diff --git a/src/lib/libcrypto/perlasm/x86unix.pl b/src/lib/libcrypto/perlasm/x86unix.pl
index 02d72a32bc..ae8f0964dc 100644
--- a/src/lib/libcrypto/perlasm/x86unix.pl
+++ b/src/lib/libcrypto/perlasm/x86unix.pl
@@ -345,7 +345,7 @@ sub main'file
345 local($file)=@_; 345 local($file)=@_;
346 346
347 if ($main'openbsd) 347 if ($main'openbsd)
348 { push(@out,"#include <machine/asm.h>\n"); return; } 348 { push(@out,"#include <machine/asm.h>\n"); }
349 349
350 local($tmp)=<<"EOF"; 350 local($tmp)=<<"EOF";
351 .file "$file.s" 351 .file "$file.s"
@@ -355,13 +355,17 @@ EOF
355 355
356sub main'function_begin 356sub main'function_begin
357 { 357 {
358 local($func)=@_; 358 local($func,$junk,$llabel)=@_;
359 359
360 &main'external_label($func); 360 &main'external_label($func);
361 $func=$under.$func; 361 $func=$under.$func;
362 362
363 if ($main'openbsd) 363 if ($main'openbsd)
364 { push (@out, "\nENTRY($func)\n"); goto skip; } 364 {
365 push (@out, "\nENTRY($func)\n");
366 push (@out, "$llabel:\n") if $llabel;
367 goto skip;
368 }
365 369
366 local($tmp)=<<"EOF"; 370 local($tmp)=<<"EOF";
367.text 371.text
@@ -417,6 +421,44 @@ skip:
417 $stack=4; 421 $stack=4;
418 } 422 }
419 423
424# Like function_begin_B but with static linkage
425sub main'function_begin_C
426 {
427 local($func,$extra)=@_;
428
429 &main'external_label($func);
430 $func=$under.$func;
431
432 if ($main'openbsd)
433 {
434 local($tmp)=<<"EOF";
435.text
436_ALIGN_TEXT
437.type $func,\@function
438$func:
439EOF
440 push(@out, $tmp);
441 goto skip;
442 }
443
444 local($tmp)=<<"EOF";
445.text
446.globl $func
447EOF
448 push(@out,$tmp);
449 if ($main'cpp)
450 { push(@out,"TYPE($func,\@function)\n"); }
451 elsif ($main'coff)
452 { $tmp=push(@out,".def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); }
453 elsif ($main'aout and !$main'pic)
454 { }
455 else { push(@out,".type $func,\@function\n"); }
456 push(@out,".align\t$align\n");
457 push(@out,"$func:\n");
458skip:
459 $stack=4;
460 }
461
420sub main'function_end 462sub main'function_end
421 { 463 {
422 local($func)=@_; 464 local($func)=@_;
@@ -474,6 +516,8 @@ sub main'function_end_B
474 %label=(); 516 %label=();
475 } 517 }
476 518
519sub main'function_end_C { function_end_B(@_); }
520
477sub main'wparam 521sub main'wparam
478 { 522 {
479 local($num)=@_; 523 local($num)=@_;
@@ -510,7 +554,7 @@ sub main'swtmp
510 554
511sub main'comment 555sub main'comment
512 { 556 {
513 if (!defined($com_start) or $main'elf) 557 if (!defined($com_start) or (!$main'openbsd && $main'elf))
514 { # Regarding $main'elf above... 558 { # Regarding $main'elf above...
515 # GNU and SVR4 as'es use different comment delimiters, 559 # GNU and SVR4 as'es use different comment delimiters,
516 push(@out,"\n"); # so we just skip ELF comments... 560 push(@out,"\n"); # so we just skip ELF comments...
@@ -731,7 +775,9 @@ sub main'initseg
731 { 775 {
732 $tmp=<<___; 776 $tmp=<<___;
733.section .init 777.section .init
734 call $under$f 778 PIC_PROLOGUE
779 call PIC_PLT($under$f)
780 PIC_EPILOGUE
735 jmp .Linitalign 781 jmp .Linitalign
736.align $align 782.align $align
737.Linitalign: 783.Linitalign: