Commit ec38ddc7 authored by Andy Polyakov's avatar Andy Polyakov
Browse files

Clean-up GAS targets: get rid of "cpp" stuff and replace it with "purified"

COFF and a.out targets [similar to ELF targets]. You might notice some
rudementary support for shared mingw builds under cygwin. It works (it
produces cryptoeay32.dll and ssleay32.dll with everything exported by
name), but it's primarily for testing/debugging purposes, at least for
now...
parent 8aae01e2
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -115,8 +115,8 @@ my $bits1="THIRTY_TWO_BIT ";
my $bits2="SIXTY_FOUR_BIT ";

my $x86_elf_asm="x86cpuid-elf.o:asm/bn86-elf.o asm/co86-elf.o:asm/dx86-elf.o asm/yx86-elf.o::asm/bx86-elf.o:asm/mx86-elf.o:asm/sx86-elf.o asm/s512sse2-elf.o:asm/cx86-elf.o:asm/rx86-elf.o:asm/rm86-elf.o:asm/r586-elf.o";
my $x86_out_asm=":asm/bn86-out.o asm/co86-out.o:asm/dx86-out.o asm/yx86-out.o::asm/bx86-out.o:asm/mx86-out.o:asm/sx86-out.o:asm/cx86-out.o:asm/rx86-out.o:asm/rm86-out.o:asm/r586-out.o";
my $x86_bsdi_asm=":asm/bn86bsdi.o asm/co86bsdi.o:asm/dx86bsdi.o asm/yx86bsdi.o::asm/bx86bsdi.o:asm/mx86bsdi.o:asm/sx86bsdi.o:asm/cx86bsdi.o:asm/rx86bsdi.o:asm/rm86bsdi.o:asm/r586bsdi.o";
my $x86_coff_asm="x86cpuid-cof.o:asm/bn86-cof.o asm/co86-cof.o:asm/dx86-cof.o asm/yx86-cof.o::asm/bx86-cof.o:asm/mx86-cof.o:asm/sx86-cof.o asm/s512sse2-cof.o:asm/cx86-cof.o:asm/rx86-cof.o:asm/rm86-cof.o:asm/r586-cof.o";
my $x86_out_asm="x86cpuid-out.o:asm/bn86-out.o asm/co86-out.o:asm/dx86-out.o asm/yx86-out.o::asm/bx86-out.o:asm/mx86-out.o:asm/sx86-out.o asm/s512sse2-out.o:asm/cx86-out.o:asm/rx86-out.o:asm/rm86-out.o:asm/r586-out.o";
my $no_asm="::::::::::";

# -DB_ENDIAN slows things down on a sparc for md5, but helps sha1.
@@ -373,7 +373,6 @@ my %table=(
"OpenBSD-vax",		"gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer::(unknown):::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"OpenBSD-hppa",		"gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown):::BN_LLONG RC2_CHAR RC4_INDEX DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",

"bsdi-gcc",     "gcc:-O3 -ffast-math -DL_ENDIAN -DPERL5 -m486::(unknown):::RSA_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_bsdi_asm}",
"bsdi-elf-gcc",     "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown)::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",

"nextstep",	"cc:-O -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
@@ -481,14 +480,14 @@ my %table=(
"BC-16","bcc:::(unknown):WIN16::BN_LLONG DES_PTR RC4_INDEX SIXTEEN_BIT:::",

# MinGW
"mingw", "gcc:-DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -mno-cygwin -Wall:::MINGW32:-mno-cygwin -lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:win32::::.dll",
"mingw", "gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::MINGW32:-mno-cygwin -lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_coff_asm}:win32:cygwin-shared:-D_DLL:-shared:.dll",

# UWIN 
"UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",

# Cygwin
"Cygwin-pre1.3", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown):CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
"Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:win32:cygwin-shared:::.dll",
"Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_coff_asm}:win32:cygwin-shared:-D_DLL:-shared:.dll",
"debug-Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror:::CYGWIN32:::${no_asm}:win32:cygwin-shared:::.dll",

# NetWare from David Ward (dsward@novell.com) - requires MetroWerks NLM development tools
@@ -499,7 +498,7 @@ my %table=(
"netware-libc-gcc", "i586-netware-gcc:-nostdinc -I/ndk/libc/include -I/ndk/libc/include/winsock -DL_ENDIAN -DNETWARE_LIBC -DOPENSSL_SYSNAME_NETWARE -DTERMIO -O2 -Wall::::${x86_gcc_opts}:::",

# DJGPP
"DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:",
"DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:",

# Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at>
"ultrix-cc","cc:-std1 -O -Olimit 2500 -DL_ENDIAN::(unknown):::::::",
@@ -909,6 +908,8 @@ print "Configuring for $target\n";

my $IsMK1MF=scalar grep /^$target$/,@MK1MF_Builds;

$IsMK1MF=1 if ($target eq "mingw" && $^O ne "cygwin");

$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target eq "mingw");
$exe_ext=".pm"  if ($target =~ /vos/);
$openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq "");
+8 −6
Original line number Diff line number Diff line
@@ -211,31 +211,33 @@ link_o.cygwin:
	@ $(CALC_VERSIONS); \
	INHIBIT_SYMLINKS=yes; \
	SHLIB=cyg$(LIBNAME); \
	expr $(PLATFORM) : 'mingw' > /dev/null && SHLIB=$(LIBNAME)eay32; \
	SHLIB_SUFFIX=.dll; \
	LIBDEPS="$(LIBDEPS) -lc"; \
	LIBDEPS="$(LIBDEPS)"; \
	SHLIB_SOVER=-$(LIBVERSION); \
	ALLSYMSFLAGS='-Wl,--whole-archive'; \
	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
	SHAREDFLAGS="-shared -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a"; \
	SHAREDFLAGS="-Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a"; \
	SHAREDCMD='${CC}'; \
	$(LINK_SO_O)
link_a.cygwin:
	@ $(CALC_VERSIONS); \
	INHIBIT_SYMLINKS=yes; \
	SHLIB=cyg$(LIBNAME); \
	expr $(PLATFORM) : 'mingw' > /dev/null && SHLIB=$(LIBNAME)eay32; \
	SHLIB_SUFFIX=.dll; \
	LIBDEPS="$(LIBDEPS) -lc"; \
	LIBDEPS="$(LIBDEPS)"; \
	SHLIB_SOVER=; \
	ALLSYMSFLAGS='-Wl,--whole-archive'; \
	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
	SHAREDFLAGS="-shared -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a"; \
	SHAREDFLAGS="-Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a"; \
	SHAREDCMD='${CC}'; \
	$(LINK_SO_A)
link_app.cygwin:
	LDCMD=$(CC);\
	LDFLAGS=""; \
	LIBDEPS="$(LIBDEPS) -lc"; \
	APPNAME="$(APPNAME).exe"
	LIBDEPS="$(LIBDEPS)"; \
	APPNAME="$(APPNAME)"; \
	$(LINK_APP)

link_o.alpha-osf1:
+44 −71
Original line number Diff line number Diff line
@@ -89,21 +89,21 @@ $thread_cflag =
$sys_id       = CYGWIN32
$lflags       = 
$bn_ops       = BN_LLONG DES_PTR DES_RISC1 DES_UNROLL RC4_INDEX MD2_INT
$cpuid_obj    = 
$bn_obj       = asm/bn86-out.o asm/co86-out.o
$des_obj      = asm/dx86-out.o asm/yx86-out.o
$aes_obj      = 
$bf_obj       = asm/bx86-out.o
$md5_obj      = asm/mx86-out.o
$sha1_obj     = asm/sx86-out.o
$cast_obj     = asm/cx86-out.o
$rc4_obj      = asm/rx86-out.o
$rmd160_obj   = asm/rm86-out.o
$rc5_obj      = asm/r586-out.o
$cpuid_obj    = x86cpuid-cof.o
$bn_obj       = asm/bn86-cof.o asm/co86-cof.o
$des_obj      = asm/dx86-cof.o asm/yx86-cof.o
$aes_obj      = 
$bf_obj       = asm/bx86-cof.o
$md5_obj      = asm/mx86-cof.o
$sha1_obj     = asm/sx86-cof.o asm/s512sse2-cof.o
$cast_obj     = asm/cx86-cof.o
$rc4_obj      = asm/rx86-cof.o
$rmd160_obj   = asm/rm86-cof.o
$rc5_obj      = asm/r586-cof.o
$dso_scheme   = win32
$shared_target= cygwin-shared
$shared_cflag = 
$shared_ldflag = 
$shared_cflag = -D_DLL
$shared_ldflag = -shared
$shared_extension = .dll
$ranlib       = 
$arflags      = 
@@ -143,17 +143,17 @@ $thread_cflag =
$sys_id       = MSDOS
$lflags       = -L/dev/env/WATT_ROOT/lib -lwatt
$bn_ops       = BN_LLONG DES_PTR DES_RISC1 DES_UNROLL RC4_INDEX MD2_INT
$cpuid_obj    = 
$bn_obj       = 
$des_obj      = 
$cpuid_obj    = x86cpuid-out.o
$bn_obj       = asm/bn86-out.o asm/co86-out.o
$des_obj      = asm/dx86-out.o asm/yx86-out.o
$aes_obj      = 
$bf_obj       = 
$md5_obj      = 
$sha1_obj     = 
$cast_obj     = 
$rc4_obj      = 
$rmd160_obj   = 
$rc5_obj      = 
$bf_obj       = asm/bx86-out.o
$md5_obj      = asm/mx86-out.o
$sha1_obj     = asm/sx86-out.o asm/s512sse2-out.o
$cast_obj     = asm/cx86-out.o
$rc4_obj      = asm/rx86-out.o
$rmd160_obj   = asm/rm86-out.o
$rc5_obj      = asm/r586-out.o
$dso_scheme   = 
$shared_target= 
$shared_cflag = 
@@ -170,13 +170,13 @@ $thread_cflag = (unknown)
$sys_id       = 
$lflags       = 
$bn_ops       = BN_LLONG DES_PTR DES_RISC1 DES_UNROLL RC4_INDEX MD2_INT
$cpuid_obj    = 
$cpuid_obj    = x86cpuid-out.o
$bn_obj       = asm/bn86-out.o asm/co86-out.o
$des_obj      = asm/dx86-out.o asm/yx86-out.o
$aes_obj      = 
$bf_obj       = asm/bx86-out.o
$md5_obj      = asm/mx86-out.o
$sha1_obj     = asm/sx86-out.o
$sha1_obj     = asm/sx86-out.o asm/s512sse2-out.o
$cast_obj     = asm/cx86-out.o
$rc4_obj      = asm/rx86-out.o
$rmd160_obj   = asm/rm86-out.o
@@ -548,13 +548,13 @@ $thread_cflag = (unknown)
$sys_id       = 
$lflags       = 
$bn_ops       = BN_LLONG DES_PTR DES_RISC1 DES_UNROLL RC4_INDEX MD2_INT
$cpuid_obj    = 
$cpuid_obj    = x86cpuid-out.o
$bn_obj       = asm/bn86-out.o asm/co86-out.o
$des_obj      = asm/dx86-out.o asm/yx86-out.o
$aes_obj      = 
$bf_obj       = asm/bx86-out.o
$md5_obj      = asm/mx86-out.o
$sha1_obj     = asm/sx86-out.o
$sha1_obj     = asm/sx86-out.o asm/s512sse2-out.o
$cast_obj     = asm/cx86-out.o
$rc4_obj      = asm/rx86-out.o
$rmd160_obj   = asm/rm86-out.o
@@ -1350,33 +1350,6 @@ $shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
$ranlib       = 
$arflags      = 

*** bsdi-gcc
$cc           = gcc
$cflags       = -O3 -ffast-math -DL_ENDIAN -DPERL5 -m486
$unistd       = 
$thread_cflag = (unknown)
$sys_id       = 
$lflags       = 
$bn_ops       = RSA_LLONG DES_PTR DES_RISC1 DES_UNROLL RC4_INDEX MD2_INT
$cpuid_obj    = 
$bn_obj       = asm/bn86bsdi.o asm/co86bsdi.o
$des_obj      = asm/dx86bsdi.o asm/yx86bsdi.o
$aes_obj      = 
$bf_obj       = asm/bx86bsdi.o
$md5_obj      = asm/mx86bsdi.o
$sha1_obj     = asm/sx86bsdi.o
$cast_obj     = asm/cx86bsdi.o
$rc4_obj      = asm/rx86bsdi.o
$rmd160_obj   = asm/rm86bsdi.o
$rc5_obj      = asm/r586bsdi.o
$dso_scheme   = 
$shared_target= 
$shared_cflag = 
$shared_ldflag = 
$shared_extension = 
$ranlib       = 
$arflags      = 

*** cc
$cc           = cc
$cflags       = -O
@@ -3059,13 +3032,13 @@ $thread_cflag = (unknown)
$sys_id       = 
$lflags       = 
$bn_ops       = BN_LLONG DES_PTR DES_RISC1 DES_UNROLL RC4_INDEX MD2_INT
$cpuid_obj    = 
$cpuid_obj    = x86cpuid-out.o
$bn_obj       = asm/bn86-out.o asm/co86-out.o
$des_obj      = asm/dx86-out.o asm/yx86-out.o
$aes_obj      = 
$bf_obj       = asm/bx86-out.o
$md5_obj      = asm/mx86-out.o
$sha1_obj     = asm/sx86-out.o
$sha1_obj     = asm/sx86-out.o asm/s512sse2-out.o
$cast_obj     = asm/cx86-out.o
$rc4_obj      = asm/rx86-out.o
$rmd160_obj   = asm/rm86-out.o
@@ -3647,27 +3620,27 @@ $arflags =

*** mingw
$cc           = gcc
$cflags       = -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -mno-cygwin -Wall
$cflags       = -mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall
$unistd       = 
$thread_cflag = 
$sys_id       = MINGW32
$lflags       = -mno-cygwin -lwsock32 -lgdi32
$bn_ops       = BN_LLONG DES_PTR DES_RISC1 DES_UNROLL RC4_INDEX MD2_INT
$cpuid_obj    = 
$bn_obj       = asm/bn86-out.o asm/co86-out.o
$des_obj      = asm/dx86-out.o asm/yx86-out.o
$aes_obj      = 
$bf_obj       = asm/bx86-out.o
$md5_obj      = asm/mx86-out.o
$sha1_obj     = asm/sx86-out.o
$cast_obj     = asm/cx86-out.o
$rc4_obj      = asm/rx86-out.o
$rmd160_obj   = asm/rm86-out.o
$rc5_obj      = asm/r586-out.o
$cpuid_obj    = x86cpuid-cof.o
$bn_obj       = asm/bn86-cof.o asm/co86-cof.o
$des_obj      = asm/dx86-cof.o asm/yx86-cof.o
$aes_obj      = 
$bf_obj       = asm/bx86-cof.o
$md5_obj      = asm/mx86-cof.o
$sha1_obj     = asm/sx86-cof.o asm/s512sse2-cof.o
$cast_obj     = asm/cx86-cof.o
$rc4_obj      = asm/rx86-cof.o
$rmd160_obj   = asm/rm86-cof.o
$rc5_obj      = asm/r586-cof.o
$dso_scheme   = win32
$shared_target= 
$shared_cflag = 
$shared_ldflag = 
$shared_target= cygwin-shared
$shared_cflag = -D_DLL
$shared_ldflag = -shared
$shared_extension = .dll
$ranlib       = 
$arflags      = 
+5 −0
Original line number Diff line number Diff line
@@ -65,6 +65,11 @@ buildinf.h: ../Makefile.ssl

x86cpuid-elf.s:	x86cpuid.pl perlasm/x86asm.pl
	$(PERL) x86cpuid.pl elf $(CFLAGS) $(PROCESSOR) > $@
x86cpuid-cof.s: x86cpuid.pl perlasm/x86asm.pl
	$(PERL) x86cpuid.pl coff $(CFLAGS) $(PROCESSOR) > $@
x86cpuid-out.s: x86cpuid.pl perlasm/x86asm.pl
	$(PERL) x86cpuid.pl a.out $(CFLAGS) $(PROCESSOR) > $@

amd64cpuid.s: amd64cpuid.pl
	$(PERL) amd64cpuid.pl $@
ia64cpuid.s: ia64cpuid.S
+8 −13
Original line number Diff line number Diff line
@@ -49,20 +49,15 @@ lib: $(LIBOBJ)
	$(RANLIB) $(LIB) || echo Never mind.
	@touch lib

# elf
# ELF
asm/bx86-elf.s: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
	(cd asm; $(PERL) bf-586.pl elf $(CFLAGS) $(PROCESSOR) > bx86-elf.s)

	(cd asm; $(PERL) bf-586.pl elf $(CFLAGS) $(PROCESSOR) > ../$@)
# COFF
asm/bx86-cof.s: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
	(cd asm; $(PERL) bf-586.pl coff $(CFLAGS) $(PROCESSOR) > ../$@)
# a.out
asm/bx86-out.o: asm/bx86unix.cpp
	$(CPP) -DOUT asm/bx86unix.cpp | as -o asm/bx86-out.o

# bsdi
asm/bx86bsdi.o: asm/bx86unix.cpp
	$(CPP) -DBSDI asm/bx86unix.cpp | sed 's/ :/:/' | as -o asm/bx86bsdi.o

asm/bx86unix.cpp: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
	(cd asm; $(PERL) bf-586.pl cpp $(PROCESSOR) >bx86unix.cpp)
asm/bx86-out.s: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
	(cd asm; $(PERL) bf-586.pl a.out $(CFLAGS) $(PROCESSOR) > ../$@)

files:
	$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
@@ -98,7 +93,7 @@ dclean:
	mv -f Makefile.new $(MAKEFILE)

clean:
	rm -f asm/bx86unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
	rm -f asm/bx86unix.cpp asm/*-[elf|cof|out].* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff

# DO NOT DELETE THIS LINE -- make depend depends on it.

Loading