Refine PowerPC platform support.
authorAndy Polyakov <appro@openssl.org>
Mon, 20 Dec 2004 13:44:34 +0000 (13:44 +0000)
committerAndy Polyakov <appro@openssl.org>
Mon, 20 Dec 2004 13:44:34 +0000 (13:44 +0000)
Configure
PROBLEMS
TABLE
config
crypto/bn/Makefile.ssl
crypto/md32_common.h
util/mklink.pl

index e2b6f99359136f62ce6947b6d02ff7257c434381..4863f72979b5342e71d828c79be89c541fcb1300 100755 (executable)
--- 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",
 
 #
index 85e96a5ebebc9511f1bf58dcc205a0122d0a9623..8301624639a1cbc3d919c9cdab6c45b26ec6ef4a 100644 (file)
--- 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 e9391294ac2935ba9e4ad66fd5ff0d767c90f218..be462d4dc959c9d6dd070f7d274d093108452e2e 100644 (file)
--- 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 98f6d9fdc7c4a74d33c1b0c420d042391eb0dc52..9d6788708f089c697674eaabbb64d464ebecb15a 100755 (executable)
--- 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" ;;
index efdfde397ac4cfc4d0e783d4e01706e76b1be33e..08cdd92c46c69752b013d9252a0bee94cb3ece0e 100644 (file)
@@ -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:
index 7eef6e907453474ab50ba2d063dfe20c593a0d3e..0cbcfaf8a20ba279480904765a39fcf47f84e875 100644 (file)
                                : "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"  \
index 9386da7aa4c3a3f0f02e3d32583c06b0684f6e8b..c8653cecc37852358a936fba593ab2c0af35de30 100755 (executable)
@@ -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";