From: Andy Polyakov Date: Mon, 20 Dec 2004 13:44:34 +0000 (+0000) Subject: Refine PowerPC platform support. X-Git-Tag: OpenSSL_0_9_7g~17^2~106 X-Git-Url: https://git.openssl.org/?p=openssl.git;a=commitdiff_plain;h=76ef6ac956490b4d9f78445599ce52510021858a;ds=sidebyside Refine PowerPC platform support. --- diff --git a/Configure b/Configure index e2b6f99359..4863f72979 100755 --- a/Configure +++ b/Configure @@ -315,7 +315,8 @@ my %table=( "linux-mipsel", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL DES_RISC2:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-mips", "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL DES_RISC2:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-ppc", "gcc:-DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL::asm/linux_ppc32.o::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", -"linux-ppc64", "gcc:-m64 -DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL::asm/linux_ppc64.o::::::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +# -bpowerpc64-linux is transient option, -m64 should be the one to use... +"linux-ppc64", "gcc:-bpowerpc64-linux -DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL::asm/linux_ppc64.o::::::::::dlfcn:linux-shared:-fPIC:-bpowerpc64-linux:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-m68k", "gcc:-DB_ENDIAN -DTERMIO -O2 -fomit-frame-pointer -Wall::-D_REENTRANT:::BN_LLONG::", "linux-s390", "gcc:-DB_ENDIAN -DTERMIO -DNO_ASM -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-s390x", "gcc:-DB_ENDIAN -DTERMIO -DNO_ASM -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", @@ -412,11 +413,11 @@ my %table=( "sco5-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown)::-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:svr3-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", #### IBM's AIX. -"aix-gcc", "gcc:-O -DB_ENDIAN::(unknown):AIX::BN_LLONG RC4_CHAR::asm/aix_ppc32.o::::::::::dlfcn:", -"aix43-cc", "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):::BN_LLONG RC4_CHAR::asm/aix_ppc32.o::::::::::dlfcn:aix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::", +"aix3-cc", "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::", +"aix-gcc", "gcc:-O -DB_ENDIAN::-D_THREAD_SAFE:AIX::BN_LLONG RC4_CHAR::asm/aix_ppc32.o::::::::::dlfcn:", # Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE # at build time. $OBJECT_MODE is respected at ./config stage! -"aix-cc", "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR::asm/aix_ppc32.o::::::::::dlfcn:aix-shared::-q32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32", +"aix-cc", "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384::-qthreaded:AIX::BN_LLONG RC4_CHAR::asm/aix_ppc32.o::::::::::dlfcn:aix-shared::-q32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32", "aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::asm/aix_ppc64.o::::::::::dlfcn:aix-shared::-q64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64", # diff --git a/PROBLEMS b/PROBLEMS index 85e96a5ebe..8301624639 100644 --- a/PROBLEMS +++ b/PROBLEMS @@ -90,15 +90,6 @@ failures in other parts of the code. Workaround: modify the target to +O2 when building with no-asm. -* Poor support for AIX shared builds. - -do_aix-shared rule is not flexible enough to parameterize through a -config-line. './Configure aix43-cc shared' is working, but not -'./Configure aix64-gcc shared'. In latter case make fails to create shared -libraries. It's possible to build 64-bit shared libraries by running -'env OBJECT_MODE=64 make', but we need more elegant solution. Preferably one -supporting even gcc shared builds. See RT#463 for background information. - * Problems building shared libraries on SCO OpenServer Release 5.0.6 with gcc 2.95.3 diff --git a/TABLE b/TABLE index e9391294ac..be462d4dc9 100644 --- a/TABLE +++ b/TABLE @@ -1165,7 +1165,7 @@ $arflags = $cc = cc $cflags = -q32 -O -DB_ENDIAN -qmaxmem=16384 $unistd = -$thread_cflag = (unknown) +$thread_cflag = -qthreaded $sys_id = AIX $lflags = $bn_ops = BN_LLONG RC4_CHAR @@ -1192,7 +1192,7 @@ $arflags = -X 32 $cc = gcc $cflags = -O -DB_ENDIAN $unistd = -$thread_cflag = (unknown) +$thread_cflag = -D_THREAD_SAFE $sys_id = AIX $lflags = $bn_ops = BN_LLONG RC4_CHAR @@ -1215,16 +1215,16 @@ $shared_extension = $ranlib = $arflags = -*** aix43-cc +*** aix3-cc $cc = cc $cflags = -O -DB_ENDIAN -qmaxmem=16384 $unistd = $thread_cflag = (unknown) -$sys_id = +$sys_id = AIX $lflags = $bn_ops = BN_LLONG RC4_CHAR $cpuid_obj = -$bn_obj = asm/aix_ppc32.o +$bn_obj = $des_obj = $aes_obj = $bf_obj = @@ -1234,11 +1234,11 @@ $cast_obj = $rc4_obj = $rmd160_obj = $rc5_obj = -$dso_scheme = dlfcn -$shared_target= aix-shared +$dso_scheme = +$shared_target= $shared_cflag = $shared_ldflag = -$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR) +$shared_extension = $ranlib = $arflags = @@ -3377,7 +3377,7 @@ $arflags = *** linux-ppc64 $cc = gcc -$cflags = -m64 -DB_ENDIAN -DTERMIO -O3 -Wall +$cflags = -bpowerpc64-linux -DB_ENDIAN -DTERMIO -O3 -Wall $unistd = $thread_cflag = -D_REENTRANT $sys_id = @@ -3397,7 +3397,7 @@ $rc5_obj = $dso_scheme = dlfcn $shared_target= linux-shared $shared_cflag = -fPIC -$shared_ldflag = -m64 +$shared_ldflag = -bpowerpc64-linux $shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR) $ranlib = $arflags = diff --git a/config b/config index 98f6d9fdc7..9d6788708f 100755 --- a/config +++ b/config @@ -111,12 +111,16 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in echo "m68k-apple-aux3"; exit 0 ;; + AIX:[3-9]:4:*) + echo "${MACHINE}-ibm-aix"; exit 0 + ;; + AIX:*:[5-9]:*) - echo "${MACHINE}-ibm-aix5"; exit 0 + echo "${MACHINE}-ibm-aix"; exit 0 ;; AIX:*) - echo "${MACHINE}-ibm-aix"; exit 0 + echo "${MACHINE}-ibm-aix3"; exit 0 ;; dgux:*) @@ -542,7 +546,15 @@ EOF ${CC} -o dummy dummy.c && OUT=`./dummy ${MACHINE}` rm dummy dummy.c ;; - ppc64-*-linux2) OUT="linux-ppc64" ;; + ppc64-*-linux2) + echo "WARNING! If you wish to build 64-bit library, then you have to" + echo " invoke './Configure linux-ppc64' *manually*." + if [ "$TEST" = "false" ]; then + echo " You have about 5 seconds to press Ctrl-C to abort." + (stty -icanon min 0 time 50; read waste) < /dev/tty + fi + OUT="linux-ppc" + ;; ppc-*-linux2) OUT="linux-ppc" ;; m68k-*-linux*) OUT="linux-m68k" ;; ia64-*-linux?) OUT="linux-ia64" ;; @@ -725,37 +737,28 @@ EOF fi options="$options -D_REENTRANT" ;; *-hpux) OUT="hpux-parisc-$CC" ;; - *-aix5) + *-aix) KERNEL_BITS=`(getconf KERNEL_BITMODE) 2>/dev/null` KERNEL_BITS=${KERNEL_BITS:-32} - if [ $KERNEL_BITS -eq 64 ]; then - # we default to 64-bit because PKI performance is >3x better... - OBJECT_MODE=${OBJECT_MODE:-$KERNEL_BITS} - else - OBJECT_MODE=32 - fi - OUT="aix-cc" - if [ "$CC" = "cc" -a $OBJECT_MODE -eq 64 ]; then - OUT="aix64-cc" - echo "WARNING! If you wish to build 32-bit kit, then you have to" - echo " invoke './Configure aix-cc' *manually*." - if [ "$TEST" = "false" ]; then - echo " You have ~5 seconds to press Ctrl-C to abort." - (stty -icanon min 0 time 50; read waste) < /dev/tty - fi - elif [ "$CC" = "gcc" ]; then - OUT="aix-gcc" - fi - ;; - *-aix) + OBJECT_MODE=${OBJECT_MODE:-32} if [ "$CC" = "gcc" ]; then OUT="aix-gcc" + elif [ $OBJECT_MODE -eq 64 ]; then + echo 'Your $OBJECT_MODE was found to be set to 64' + OUT="aix64-cc" else - OUT="aix43-cc" + OUT="aix-cc" + if [ $KERNEL_BITS -eq 64 ]; then + echo "WARNING! If you wish to build 64-bit kit, then you have to" + echo " invoke './Configure aix64-cc' *manually*." + if [ "$TEST" = "false" ]; then + echo " You have ~5 seconds to press Ctrl-C to abort." + (/bin/stty -icanon min 0 time 50; read waste) < /dev/tty + fi + fi fi ;; # these are all covered by the catchall below - # *-aix) OUT="aix-$CC" ;; # *-dgux) OUT="dgux" ;; mips-sony-newsos4) OUT="newsos4-gcc" ;; *-*-cygwin_pre1.3) OUT="Cygwin-pre1.3" ;; diff --git a/crypto/bn/Makefile.ssl b/crypto/bn/Makefile.ssl index efdfde397a..08cdd92c46 100644 --- a/crypto/bn/Makefile.ssl +++ b/crypto/bn/Makefile.ssl @@ -103,8 +103,8 @@ asm/pa-risc2.o: asm/pa-risc2.s # ppc - AIX, Linux, MacOS X... asm/linux_ppc32.s: asm/ppc.pl; $(PERL) $< $@ asm/linux_ppc64.s: asm/ppc.pl; $(PERL) $< $@ -asm/aix_ppc32.s: asm/ppc.pl; $(PERL) $< $@ -asm/aix_ppc64.s: asm/ppc.pl; $(PERL) $< $@ +asm/aix_ppc32.s: asm/ppc.pl; $(PERL) asm/ppc.pl $@ +asm/aix_ppc64.s: asm/ppc.pl; $(PERL) asm/ppc.pl $@ asm/osx_ppc32.s: asm/ppc.pl; $(PERL) $< $@ files: diff --git a/crypto/md32_common.h b/crypto/md32_common.h index 7eef6e9074..0cbcfaf8a2 100644 --- a/crypto/md32_common.h +++ b/crypto/md32_common.h @@ -206,7 +206,7 @@ : "cc"); \ ret; \ }) -# elif defined(__powerpc) || defined(__ppc) +# elif defined(__powerpc) || defined(__ppc__) || defined(__powerpc64__) # define ROTATE(a,n) ({ register unsigned int ret; \ asm ( \ "rlwinm %0,%1,%2,0,31" \ diff --git a/util/mklink.pl b/util/mklink.pl index 9386da7aa4..c8653cecc3 100755 --- a/util/mklink.pl +++ b/util/mklink.pl @@ -52,6 +52,7 @@ $symlink_exists=eval {symlink("",""); 1}; foreach $file (@files) { my $err = ""; if ($symlink_exists) { + unlink "$from/$file"; symlink("$to/$file", "$from/$file") or $err = " [$!]"; } else { unlink "$from/$file";