Automate assembler support for Win64 targets (more work is needed).

This commit is contained in:
Andy Polyakov 2008-01-13 17:56:02 +00:00
parent ca55d11f84
commit f63e4be392
4 changed files with 56 additions and 66 deletions

View File

@ -178,7 +178,7 @@ my %table=(
"debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentiumpro -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
"debug-linux-elf","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=i486 -Wall::-D_REENTRANT::-lefence -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-linux-ia32-aes", "gcc:-DAES_EXPERIMENTAL -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:x86cpuid.o:bn-586.o co-586.o x86-mont.o:des-586.o crypt586.o:aes_x86core.o aes_cbc.o:bf-586.o:md5-586.o:sha1-586.o sha256-586.o sha512-586.o:cast-586.o:rc4-586.o:rmd-586.o:rc5-586.o:wp_block.o wp-mmx.o:elf:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-linux-ia32-aes", "gcc:-DAES_EXPERIMENTAL -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:x86cpuid.o:bn-586.o co-586.o x86-mont.o:des-586.o crypt586.o:aes_x86core.o aes_cbc.o:bf-586.o:md5-586.o:sha1-586.o sha256-586.o sha512-586.o:cast-586.o:rc4-586.o:rmd-586.o:rc5-586.o:wp_block.o wp-mmx.o::elf:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"dist", "cc:-O::(unknown)::::::",
# Basic configs that should work on any (32 and less bit) box
@ -476,14 +476,16 @@ my %table=(
#
"OS390-Unix","c89.sh:-O -DB_ENDIAN -DCHARSET_EBCDIC -DNO_SYS_PARAM_H -D_ALL_SOURCE::(unknown):::THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
# Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64
"VC-WIN64I","cl::::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:${no_asm}:win32",
"VC-WIN64A","cl::::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:${no_asm}:win32",
# Visual C targets
"VC-NT","cl::::WINNT::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32",
"VC-CE","cl::::WINCE::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32",
#
# Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64
"VC-WIN64I","cl:-W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE:::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:ia64cpuid.o:ia64.o::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o:::::::ias:win32",
"VC-WIN64A","cl:-W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE:::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:x86_64cpuid.o:bn_asm.o x86_64-mont.o::aes-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o::rc4-x86_64.o:::wp-x86_64.o::ml64:win32",
# x86 Win32 target defaults to ANSI API, if you want UNICODE, complement
# 'perl Configure VC-WIN32' with '-DUNICODE -D_UNICODE'
"VC-WIN32","cl:-W3 -WX -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_win32_asm}:win32",
# Unified CE target
"VC-CE","cl::::WINCE::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32",
# Borland C++ 4.5
"BC-32","bcc32::::WIN32::BN_LLONG DES_PTR RC4_INDEX EXPORT_VAR_AS_FN:${no_asm}:win32",

66
TABLE
View File

@ -630,36 +630,6 @@ $shared_extension =
$ranlib =
$arflags =
*** VC-NT
$cc = cl
$cflags =
$unistd =
$thread_cflag =
$sys_id = WINNT
$lflags =
$bn_ops = BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN RC4_INDEX MD2_INT
$cpuid_obj =
$bn_obj =
$des_obj =
$aes_obj =
$bf_obj =
$md5_obj =
$sha1_obj =
$cast_obj =
$rc4_obj =
$rmd160_obj =
$rc5_obj =
$wp_obj =
$cmll_obj =
$perlasm_scheme = void
$dso_scheme = win32
$shared_target=
$shared_cflag =
$shared_ldflag =
$shared_extension =
$ranlib =
$arflags =
*** VC-WIN32
$cc = cl
$cflags = -W3 -WX -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
@ -681,7 +651,7 @@ $rmd160_obj = rmd-586.o
$rc5_obj = rc5-586.o
$wp_obj = wp_block.o wp-mmx.o
$cmll_obj =
$perlasm_scheme = win32
$perlasm_scheme = win32n
$dso_scheme = win32
$shared_target=
$shared_cflag =
@ -692,26 +662,26 @@ $arflags =
*** VC-WIN64A
$cc = cl
$cflags =
$cflags = -W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
$unistd =
$thread_cflag =
$sys_id = WIN64A
$lflags =
$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 = bn_asm.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 = ml64
$dso_scheme = win32
$shared_target=
$shared_cflag =
@ -722,26 +692,26 @@ $arflags =
*** VC-WIN64I
$cc = cl
$cflags =
$cflags = -W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
$unistd =
$thread_cflag =
$sys_id = WIN64I
$lflags =
$bn_ops = SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN
$cpuid_obj =
$bn_obj =
$cpuid_obj = ia64cpuid.o
$bn_obj = ia64.o
$des_obj =
$aes_obj =
$aes_obj = aes_core.o aes_cbc.o aes-ia64.o
$bf_obj =
$md5_obj =
$sha1_obj =
$md5_obj = md5-ia64.o
$sha1_obj = sha1-ia64.o sha256-ia64.o sha512-ia64.o
$cast_obj =
$rc4_obj =
$rmd160_obj =
$rc5_obj =
$wp_obj =
$cmll_obj =
$perlasm_scheme = void
$perlasm_scheme = ias
$dso_scheme = win32
$shared_target=
$shared_cflag =
@ -1751,7 +1721,7 @@ $bn_ops = BN_LLONG DES_PTR DES_RISC1 DES_UNROLL RC4_INDEX MD2_INT
$cpuid_obj = x86cpuid.o
$bn_obj = bn-586.o co-586.o x86-mont.o
$des_obj = des-586.o crypt586.o
$aes_obj = aes-586.o
$aes_obj = aes_x86core.o aes_cbc.o
$bf_obj = bf-586.o
$md5_obj = md5-586.o
$sha1_obj = sha1-586.o sha256-586.o sha512-586.o

View File

@ -871,6 +871,7 @@ sub do_compile_rule
$ret.=&cc_compile_target("$to${o}$n$obj","${_}.c",$ex)
}
elsif (-f ($s="${d}${o}asm${o}${n}.pl") or
($s=~s/sha256/sha512/ and -f $s) or
-f ($s="${d}${o}${n}.pl"))
{
$ret.=&perlasm_compile_target("$to${o}$n$obj",$s,$n);

View File

@ -28,14 +28,27 @@ if ($FLAVOR =~ /WIN64/)
# per 0.9.8 release remaining warnings were explicitly examined and
# considered safe to ignore.
#
$base_cflags=' /W3 /Gs0 /GF /Gy /nologo -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DOPENSSL_SYSNAME_WIN32 -DOPENSSL_SYSNAME_WINNT -DUNICODE -D_UNICODE';
$base_cflags.=' -D_CRT_SECURE_NO_DEPRECATE'; # shut up VC8
$base_cflags.=' -D_CRT_NONSTDC_NO_DEPRECATE'; # shut up VC8
$base_cflags= " $mf_cflag";
my $f = $shlib?' /MD':' /MT';
$lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib
$opt_cflags=$f.' /Ox';
$dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG';
$lflags="/nologo /subsystem:console /opt:ref";
*::perlasm_compile_target = sub {
my ($target,$source,$bname)=@_;
my $ret;
$bname =~ s/(.*)\.[^\.]$/$1/;
$ret=<<___;
\$(TMP_D)$o$bname.asm: $source
\$(PERL) $source \$\@
$target: \$(TMP_D)$o$bname.asm
\$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm
___
}
}
elsif ($FLAVOR =~ /CE/)
{
@ -142,15 +155,11 @@ else
{
$ex_libs.=' gdi32.lib advapi32.lib user32.lib';
$ex_libs.=' bufferoverflowu.lib' if ($FLAVOR =~ /WIN64/);
# WIN32 UNICODE build gets linked with unicows.lib for
# backward compatibility with Win9x.
$ex_libs="unicows.lib $ex_libs" if ($FLAVOR =~ /WIN32/ and $cflags =~ /\-DUNICODE/);
}
# As native NT API is pure UNICODE, our WIN-NT build defaults to UNICODE,
# but gets linked with unicows.lib to ensure backward compatibility.
if ($FLAVOR =~ /NT/)
{
$cflags.=" -DOPENSSL_SYSNAME_WINNT -DUNICODE -D_UNICODE";
$ex_libs="unicows.lib $ex_libs";
}
# static library stuff
$mklib='lib';
$ranlib='';
@ -161,7 +170,15 @@ $lfile='/out:';
$shlib_ex_obj="";
$app_ex_obj="setargv.obj" if ($FLAVOR !~ /CE/);
if ($nasm) {
if ($FLAVOR =~ /WIN64A/) {
$asm='ml64 /c /Cp /Cx';
$asm.=" /Zi" if $debug;
$afile='/Fo';
} elsif ($FLAVOR =~ /WIN64I/) {
$asm='ias';
$asm.=" -d debug" if $debug;
$afile="-o ";
} elsif ($nasm) {
my $ver=`nasm -v 2>NUL`;
my $vew=`nasmw -v 2>NUL`;
# pick newest version