From a0618e3e5e79f629e7818d64338d29d4a751c649 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Sun, 25 Jul 1999 15:13:49 +0000 Subject: [PATCH] Added support for SPARC Linux. --- CHANGES | 3 +++ Configure | 14 ++++++++++-- config | 47 ++++++++++++++++++++++++++--------------- crypto/bn/Makefile.ssl | 1 - crypto/md5/Makefile.ssl | 12 +++++------ 5 files changed, 50 insertions(+), 27 deletions(-) diff --git a/CHANGES b/CHANGES index 108675fc4d..7cda75c18b 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,9 @@ Changes between 0.9.3a and 0.9.4 [xx Jul/Aug/...? 1999] + *) Added support for SPARC Linux. + [Andy Polyakov] + *) pem_password_cb function type incompatibly changed from typedef int pem_password_cb(char *buf, int size, int rwflag); to diff --git a/Configure b/Configure index 2bc2ad001e..d8c7eaf7e6 100755 --- a/Configure +++ b/Configure @@ -121,6 +121,18 @@ my %table=( "solaris-usparc-cc","cc:-xtarget=ultra -xarch=v8plus -xstrconst -xO5 -xdepend -Xa -DB_ENDIAN -DULTRASPARC -DBN_DIV2W::-D_REENTRANT:-lsocket -lnsl:BN_LLONG RC4_CHAR DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o:", "solaris64-usparc-cc","cc:-xtarget=ultra -xarch=v9 -xstrconst -xO5 -xdepend -Xa -DB_ENDIAN -DULTRASPARC::-D_REENTRANT:-lsocket -lnsl:SIXTY_FOUR_BIT_LONG RC4_CHAR DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::asm/md5-sparcv9.o:", +#### SPARC Linux setups +"linux-sparcv7","gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::BN_LLONG RC4_CHAR DES_UNROLL BF_PTR::", +# Ray Miller has patiently +# assisted with debugging of following two configs. +"linux-sparcv8","gcc:-mv8 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT::BN_LLONG RC4_CHAR DES_UNROLL BF_PTR:asm/sparcv8.o::::", +# it's a real mess with -mcpu=ultrasparc option under Linux, but +# -Wa,-Av8plus should do the trick no matter what. +"linux-sparcv9","gcc:-mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DULTRASPARC -DBN_DIV2W::-D_REENTRANT::BN_LLONG RC4_CHAR DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o:", +# !!!Folowing can't be even tested yet!!! +# We have to wait at least till 64-bit libc is available!!! +#"linux64-sparcv9","sparc64-linux-gcc:-m64 -mcpu=v9 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DULTRASPARC -DBN_DIV2W::-D_REENTRANT::BN_LLONG RC4_CHAR DES_UNROLL BF_PTR::::asm/md5-sparcv9.o:", + # Sunos configs, assuming sparc for the gcc one. ##"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown)::DES_UNROLL:::", "sunos-gcc","gcc:-O3 -mv8::(unknown)::BN_LLONG RC4_CHAR DES_UNROLL DES_PTR DES_RISC1:::", @@ -188,8 +200,6 @@ my %table=( "linux-aout", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::(unknown)::BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_out_asm", "linux-mips", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::(unknown)::BN_LLONG:::", "linux-ppc", "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::(unknown)::::", -"linux-sparc","gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::BN_LLONG RC4_CHAR DES_UNROLL BF_PTR::", -"linux-sparc64","gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -mv8 -Wall::-D_REENTRANT:::::", "NetBSD-sparc", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -mv8 -Wall -DB_ENDIAN::(unknown)::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL:::", "NetBSD-m68", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall -DB_ENDIAN::(unknown)::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL:::", "NetBSD-x86", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -m486 -Wall::(unknown)::BN_LLONG $x86_gcc_des $x86_gcc_opts:", diff --git a/config b/config index 8a47ca102d..6f36435d48 100755 --- a/config +++ b/config @@ -292,9 +292,13 @@ done # figure out if gcc is available and if so we use it otherwise # we fallback to whatever cc does on the system -GCCVER=`(gcc -v) 2>&1` -if [ $? = "0" ]; then +GCCVER=`(gcc --version) 2>/dev/null` +if [ "$GCCVER" != "" ]; then CC=gcc + # then strip off whatever prefix Cygnus prepends the number with... + GCCVER=`echo $GCCVER | sed 's/^[a-z]*\-//'` + # peak only digits before and after first dot, e.g. 2.95.1 gives 29 + GCCVER=`echo $GCCVER | sed '/\([0-9]\)\.\([0-9]\).*/\1\2/'` else CC=cc if [ "$SYSTEM" = "SunOS" ] @@ -319,8 +323,22 @@ case "$GUESSOS" in alpha-*-linux2) OUT="alpha-gcc" ;; ppc-*-linux2) OUT="linux-ppc" ;; mips-*-linux?) OUT="linux-mips" ;; + sparc64-*-linux2) + #Before we uncomment following line we have to wait at least till + #64-bit glibc for SPARC is available:-( + #echo "WARNING! If you wish to build 64-bit library, then you have to" + #echo " invoke './Configure linux64-sparcv9' *manually*." + #echo " Type Ctrl-C if you don't want to continue." + #read waste < /dev/tty + OUT="linux-sparcv9" ;; sparc-*-linux2) OUT="linux-sparc" ;; - sparc64-*-linux2) OUT="linux-sparc64" ;; + KARCH=`awk '/type/{print$3}' /proc/cpuinfo` + case ${KARCH:-sun4} in + sun4u*) OUT="linux-sparcv9" ;; + sun4m) OUT="linux-sparcv8" ;; + sun4d) OUT="linux-sparcv8" ;; + *) OUT="linux-sparcv7" ;; + esac ;; *-*-linux2) OUT="linux-elf" ;; *-*-linux1) OUT="linux-aout" ;; sun4u-sun-solaris2) OUT="solaris-usparc-$CC" ;; @@ -350,21 +368,16 @@ case "$GUESSOS" in esac # gcc < 2.8 does not support -mcpu=ultrasparc -if [ "$OUT" = solaris-usparc-gcc ] +if [ "$OUT" = solaris-usparc-gcc -a $GCCVER -lt 28 ] +then + echo "WARNING! Do consider upgrading to gcc-2.8 or later." + OUT=solaris-usparc-oldgcc +fi +if [ "$OUT" = "linux-sparcv9" -a $GCCVER -lt 28 ] then - GCCVERMAJOR="`echo $GCCVER | sed 's/.*version \([^.]*\).*/\1/`" - GCCVERMINOR="`echo $GCCVER | sed 's/.*version[^.]*\.\([^.]*\).*/\1/`" - echo "gcc version $GCCVERMAJOR.$GCCVERMINOR.x" - case "$GCCVERMAJOR" in - egcs*) - ;; - *) - if [ $GCCVERMAJOR$GCCVERMINOR -lt 28 ] - then - OUT=solaris-usparc-oldgcc - fi - ;; - esac + echo "WARNING! Falling down to 'linux-sparcv8'." + echo " Upgrade to gcc-2.8 or later." + OUT=linux-sparcv8 fi case "$GUESSOS" in diff --git a/crypto/bn/Makefile.ssl b/crypto/bn/Makefile.ssl index 93c2a0195f..d14f2d5375 100644 --- a/crypto/bn/Makefile.ssl +++ b/crypto/bn/Makefile.ssl @@ -102,7 +102,6 @@ asm/co86unix.cpp: asm/co-586.pl asm/sparcv8.o: asm/sparcv8.S asm/sparcv8plus.o: asm/sparcv8plus.S - $(CC) -xarch=v8plus -c asm/sparcv8plus.S -o asm/sparcv8plus.o asm/sparcv8plus-gcc.o: asm/sparcv8plus.S gcc -E asm/sparcv8plus.S | /usr/ccs/bin/as -xarch=v8plus - -o asm/sparcv8plus-gcc.o diff --git a/crypto/md5/Makefile.ssl b/crypto/md5/Makefile.ssl index d73650fe4d..5d6dc8a376 100644 --- a/crypto/md5/Makefile.ssl +++ b/crypto/md5/Makefile.ssl @@ -19,6 +19,7 @@ AR= ar r MD5_ASM_OBJ= CFLAGS= $(INCLUDES) $(CFLAG) +ASFLAGS=$(CFLAGS) GENERAL=Makefile TEST=md5test.c @@ -66,16 +67,13 @@ asm/mx86bsdi.o: asm/mx86unix.cpp asm/mx86unix.cpp: asm/md5-586.pl (cd asm; $(PERL) md5-586.pl cpp >mx86unix.cpp) -# works for both SC and gcc -# (PATH is changed because /usr/ccs/bin/as knows opcodes we need -# that GNU as has never heard of) asm/md5-sparcv8plus.o: asm/md5-sparcv9.S - $(CPP) -DULTRASPARC -DMD5_BLOCK_DATA_ORDER asm/md5-sparcv9.S | \ - PATH=/usr/ccs/bin:$(PATH) as -xarch=v8plus - -o asm/md5-sparcv8plus.o + $(CC) $(ASFLAGS) -DMD5_BLOCK_DATA_ORDER -c \ + -o asm/md5-sparcv8plus.o asm/md5-sparcv9.S asm/md5-sparcv9.o: asm/md5-sparcv9.S - PATH=/usr/ccs/bin:$(PATH) $(CC) -xarch=v9 -DULTRASPARC -DMD5_BLOCK_DATA_ORDER -c asm/md5-sparcv9.S -o asm/md5-sparcv9.o - + $(CC) $(ASFLAGS) -DMD5_BLOCK_DATA_ORDER -c \ + -o asm/md5-sparcv9.o asm/md5-sparcv9.S files: $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO -- GitLab