summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2008-11-14 16:40:37 +0000
committerAndy Polyakov <appro@openssl.org>2008-11-14 16:40:37 +0000
commit93c4ba07d715fc8e3bad982ef4ea33e90d6a344e (patch)
tree2b03f4c8c66004f46214db4e5511b04040370b50
parent36d46234c77f11d246309332d08eebe37eb4458f (diff)
x86_64-xlate.pl update, engage x86_64 assembler in mingw64.
-rwxr-xr-xConfigure9
-rw-r--r--TABLE16
-rw-r--r--crypto/bn/asm/x86_64-gcc.c6
-rwxr-xr-xcrypto/perlasm/x86_64-xlate.pl32
4 files changed, 39 insertions, 24 deletions
diff --git a/Configure b/Configure
index d3a8b1fae1..5d4bf0e20d 100755
--- a/Configure
+++ b/Configure
@@ -492,7 +492,14 @@ my %table=(
# MinGW
"mingw", "gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::MINGW32:-lws2_32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_asm}:coff:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin:.dll.a",
-"mingw64", "gcc:-mno-cygwin -DL_ENDIAN -O3 -Wall -DWIN32_LEAN_AND_MEAN -DUNICODE -D_UNICODE:::MINGW64:-lws2_32 -lgdi32:SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:${no_asm}:win32:cygwin-shared:-D_WINDLL:-mno-cygwin:.dll.a",
+# As for OPENSSL_USE_APPLINK. Applink makes it possible to use .dll
+# compiled with one compiler with application compiled with another
+# compiler. It's possible to engage Applink support in mingw64 build,
+# but it's not done, because till mingw64 supports structured exception
+# handling, one can't seriously consider its binaries for using with
+# non-mingw64 run-time environment. And as mingw64 is always consistent
+# with itself, Applink is never engaged and can as well be omitted.
+"mingw64", "gcc:-mno-cygwin -DL_ENDIAN -O3 -Wall -DWIN32_LEAN_AND_MEAN -DUNICODE -D_UNICODE:::MINGW64:-lws2_32 -lgdi32:SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:${x86_64_asm}:mingw64:win32:cygwin-shared:-D_WINDLL:-mno-cygwin:.dll.a",
# UWIN
"UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
diff --git a/TABLE b/TABLE
index 2388e02556..bc4a0f7c46 100644
--- a/TABLE
+++ b/TABLE
@@ -3608,20 +3608,20 @@ $thread_cflag =
$sys_id = MINGW64
$lflags = -lws2_32 -lgdi32
$bn_ops = SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN
-$cpuid_obj =
-$bn_obj =
+$cpuid_obj = x86_64cpuid.o
+$bn_obj = x86_64-gcc.o x86_64-mont.o
$des_obj =
-$aes_obj =
+$aes_obj = aes-x86_64.o
$bf_obj =
-$md5_obj =
-$sha1_obj =
+$md5_obj = md5-x86_64.o
+$sha1_obj = sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o
$cast_obj =
-$rc4_obj =
+$rc4_obj = rc4-x86_64.o
$rmd160_obj =
$rc5_obj =
-$wp_obj =
+$wp_obj = wp-x86_64.o
$cmll_obj =
-$perlasm_scheme = void
+$perlasm_scheme = mingw64
$dso_scheme = win32
$shared_target= cygwin-shared
$shared_cflag = -D_WINDLL
diff --git a/crypto/bn/asm/x86_64-gcc.c b/crypto/bn/asm/x86_64-gcc.c
index c4d941d0b4..825f947e3e 100644
--- a/crypto/bn/asm/x86_64-gcc.c
+++ b/crypto/bn/asm/x86_64-gcc.c
@@ -1,4 +1,4 @@
-#ifdef __SUNPRO_C
+#if !(defined(__GNUC__) && __GNUC__>=2)
# include "../bn_asm.c" /* kind of dirty hack for Sun Studio */
#else
/*
@@ -54,7 +54,11 @@
* machine.
*/
+#ifdef _WIN64
+#define BN_ULONG unsigned long long
+#else
#define BN_ULONG unsigned long
+#endif
/*
* "m"(a), "+m"(r) is the way to favor DirectPath µ-code;
diff --git a/crypto/perlasm/x86_64-xlate.pl b/crypto/perlasm/x86_64-xlate.pl
index 1f13850824..7194b29257 100755
--- a/crypto/perlasm/x86_64-xlate.pl
+++ b/crypto/perlasm/x86_64-xlate.pl
@@ -71,6 +71,7 @@ my $gas=1; $gas=0 if ($output =~ /\.asm$/);
my $elf=1; $elf=0 if (!$gas);
my $win64=0;
my $prefix="";
+my $decor=".L";
my $masmref=8 + 50727*2**-32; # 8.00.50727 shipped with VS2005
my $masm=0;
@@ -80,9 +81,9 @@ my $nasmref=2.03;
my $nasm=0;
if ($flavour eq "mingw64") { $gas=1; $elf=0; $win64=1; $prefix="_"; }
-elsif ($flavour eq "macosx") { $gas=1; $elf=0; $prefix="_"; }
-elsif ($flavour eq "masm") { $gas=0; $elf=0; $masm=$masmref; $win64=1; }
-elsif ($flavour eq "nasm") { $gas=0; $elf=0; $nasm=$nasmref; $win64=1; $PTR=""; }
+elsif ($flavour eq "macosx") { $gas=1; $elf=0; $prefix="_"; $decor="L\$"; }
+elsif ($flavour eq "masm") { $gas=0; $elf=0; $masm=$masmref; $win64=1; $decor="\$L\$"; }
+elsif ($flavour eq "nasm") { $gas=0; $elf=0; $nasm=$nasmref; $win64=1; $decor="\$L\$"; $PTR=""; }
elsif (!$gas)
{ if ($ENV{ASM} =~ m/nasm/ && `nasm -v` =~ m/version ([0-9]+)\.([0-9]+)/i)
{ $nasm = $1 + $2*0.01; $PTR=""; }
@@ -91,6 +92,7 @@ elsif (!$gas)
die "no assembler found on %PATH" if (!($nasm || $masm));
$win64=1;
$elf=0;
+ $decor="\$L\$";
}
my $current_segment;
@@ -228,6 +230,7 @@ my %globals;
my $sz = shift;
$self->{label} =~ s/([_a-z][_a-z0-9]*)/$globals{$1} or $1/gei;
+ $self->{label} =~ s/\.L/$decor/g;
# Silently convert all EAs to 64-bit. This is required for
# elder GNU assembler and results in more compact code,
@@ -240,7 +243,7 @@ my %globals;
# in $self->{label}
$self->{label} =~ s/(?<![0-9a-f])(0[x0-9a-f]+)/oct($1)/egi;
$self->{label} =~ s/([0-9]+\s*[\*\/\%]\s*[0-9]+)/eval($1)/eg;
- $self->{label} =~ s/\.L/L\$/g if (!$elf);
+ $self->{label} =~ s/^___imp_/__imp__/ if ($flavour eq "mingw64");
if (defined($self->{index})) {
sprintf "%s%s(%%%s,%%%s,%d)",$self->{asterisk},
@@ -252,7 +255,6 @@ my %globals;
} else {
%szmap = ( b=>"BYTE$PTR", w=>"WORD$PTR", l=>"DWORD$PTR", q=>"QWORD$PTR" );
- $self->{label} =~ s/\.L/\$L\$/g;
$self->{label} =~ s/\./\$/g;
$self->{label} =~ s/0x([0-9a-f]+)/0$1h/ig;
$self->{label} = "($self->{label})" if ($self->{label} =~ /[\*\+\-\/]/);
@@ -322,8 +324,7 @@ my %globals;
$ret = $self;
$line = substr($line,@+[0]); $line =~ s/^\s+//;
- $self->{value} =~ s/\.L/\$L\$/ if (!$gas);
- $self->{value} =~ s/\.L/L\$/ if (!$elf);
+ $self->{value} =~ s/^\.L/$decor/;
}
$ret;
}
@@ -339,7 +340,7 @@ my %globals;
$func .= " movq %rdi,8(%rsp)\n";
$func .= " movq %rsi,16(%rsp)\n";
$func .= " movq %rsp,%rax\n";
- $func .= ".LSEH_begin_$current_function->{name}:\n";
+ $func .= "${decor}SEH_begin_$current_function->{name}:\n";
my $narg = $current_function->{narg};
$narg=6 if (!defined($narg));
$func .= " movq %rcx,%rdi\n" if ($narg>0);
@@ -360,7 +361,7 @@ my %globals;
$func .= " mov QWORD${PTR}[8+rsp],rdi\t;WIN64 prologue\n";
$func .= " mov QWORD${PTR}[16+rsp],rsi\n";
$func .= " mov rax,rsp\n";
- $func .= "\$L\$SEH_begin_$current_function->{name}:";
+ $func .= "${decor}SEH_begin_$current_function->{name}:";
$func .= ":" if ($masm);
$func .= "\n";
my $narg = $current_function->{narg};
@@ -391,8 +392,7 @@ my %globals;
$self->{value} =~ s/\@PLT// if (!$elf);
$self->{value} =~ s/([_a-z][_a-z0-9]*)/$globals{$1} or $1/gei;
- $self->{value} =~ s/\.L/\$L\$/g if (!$gas);
- $self->{value} =~ s/\.L/L\$/g if (!$elf);
+ $self->{value} =~ s/\.L/$decor/g;
}
$ret;
}
@@ -461,6 +461,11 @@ my %globals;
}
last;
};
+ /\.rva|\.long|\.quad/
+ && do { $line =~ s/([_a-z][_a-z0-9]*)/$globals{$1} or $1/gei;
+ $line =~ s/\.L/$decor/g;
+ last;
+ };
}
if ($gas) {
@@ -477,7 +482,7 @@ my %globals;
} elsif (!$elf && $dir =~ /\.size/) {
$self->{value} = "";
if (defined($current_function)) {
- $self->{value} .= ".LSEH_end_$current_function->{name}:"
+ $self->{value} .= "${decor}SEH_end_$current_function->{name}:"
if ($win64 && $current_function->{abi} eq "svr4");
undef $current_function;
}
@@ -555,7 +560,7 @@ my %globals;
/\.size/ && do { if (defined($current_function)) {
undef $self->{value};
if ($current_function->{abi} eq "svr4") {
- $self->{value}="\$L\$SEH_end_$current_function->{name}:";
+ $self->{value}="${decor}SEH_end_$current_function->{name}:";
$self->{value}.=":\n" if($masm);
}
$self->{value}.="$current_function->{name}\tENDP" if($masm);
@@ -570,7 +575,6 @@ my %globals;
my $last = pop(@arr);
my $conv = sub { my $var=shift;
$var=~s/0x([0-9a-f]+)/0$1h/ig;
- $var=~s/\.L/\$L\$/g;
if ($sz eq "D" && ($current_segment=~/.[px]data/ || $dir eq ".rva"))
{ $var=~s/([_a-z\$\@][_a-z0-9\$\@]*)/$nasm?"$1 wrt ..imagebase":"imagerel $1"/egi; }
$var;