diff options
author | Andy Polyakov <appro@openssl.org> | 2003-01-03 17:37:53 +0000 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2003-01-03 17:37:53 +0000 |
commit | 3cc9a89dda7165f9363f06db3559c5dea043bb73 (patch) | |
tree | 0920468b8b2b0a951d32107856055d6007ff6875 /crypto/perlasm | |
parent | 46a0d4fbcb7577dd97e223e90d0a34044d4595d6 (diff) |
Unified targets for ELF assembler modules. Tested on Linux, Solaris and
FreeBSD. Goal is to extend support even to SCO5, UnixWare/OpenUnix...
Diffstat (limited to 'crypto/perlasm')
-rw-r--r-- | crypto/perlasm/x86asm.pl | 7 | ||||
-rw-r--r-- | crypto/perlasm/x86unix.pl | 26 |
2 files changed, 29 insertions, 4 deletions
diff --git a/crypto/perlasm/x86asm.pl b/crypto/perlasm/x86asm.pl index 9a3d85b098..888c656f93 100644 --- a/crypto/perlasm/x86asm.pl +++ b/crypto/perlasm/x86asm.pl @@ -18,9 +18,9 @@ sub main'asm_init ($type,$fn,$i386)=@_; $filename=$fn; - $cpp=$sol=$aout=$win32=$gaswin=0; + $elf=$cpp=$sol=$aout=$win32=$gaswin=0; if ( ($type eq "elf")) - { require "x86unix.pl"; } + { $elf=1; require "x86unix.pl"; } elsif ( ($type eq "a.out")) { $aout=1; require "x86unix.pl"; } elsif ( ($type eq "gaswin")) @@ -47,6 +47,9 @@ EOF exit(1); } + $pic=0; + for (@ARGV) { $pic=1 if (/\-[fK]PIC/i); } + &asm_init_output(); &comment("Don't even think of reading this code"); diff --git a/crypto/perlasm/x86unix.pl b/crypto/perlasm/x86unix.pl index 3ad889ffd6..b1c87037dd 100644 --- a/crypto/perlasm/x86unix.pl +++ b/crypto/perlasm/x86unix.pl @@ -426,6 +426,11 @@ sub main'swtmp sub main'comment { + if ($main'elf) # GNU and SVR4 as'es use different comment delimiters, + { # so we just skip comments... + push(@out,"\n"); + return; + } foreach (@_) { if (/^\s*$/) @@ -546,7 +551,9 @@ sub popvars sub main'picmeup { local($dst,$sym)=@_; - local($tmp)=<<___; + if ($main'cpp) + { + local($tmp)=<<___; #if (defined(ELF) || defined(SOL)) && defined(PIC) .align 8 call 1f @@ -557,7 +564,22 @@ sub main'picmeup leal $sym,$regs{$dst} #endif ___ - push(@out,$tmp); + push(@out,$tmp); + } + elsif ($main'pic && $main'elf) + { + push(@out,"\t.align\t8\n"); + &main'call(&main'label("PIC_me_up")); + &main'set_label("PIC_me_up"); + &main'blindpop($dst); + &main'add($dst,"\$_GLOBAL_OFFSET_TABLE_+[.-" . + &main'label("PIC_me_up") . "]"); + &main'mov($dst,&main'DWP("$under$sym\@GOT",$dst)); + } + else + { + &main'lea($dst,&main'DWP("$under$sym")); + } } sub main'blindpop { &out1("popl",@_); } |