Improved PowerPC platform support.
authorAndy Polyakov <appro@openssl.org>
Mon, 20 Dec 2004 13:20:22 +0000 (13:20 +0000)
committerAndy Polyakov <appro@openssl.org>
Mon, 20 Dec 2004 13:20:22 +0000 (13:20 +0000)
Configure
Makefile.org
PROBLEMS
TABLE
config
crypto/md32_common.h

index a7fdc3dfdacd7aa27d522753365ab13458e14d8e..2685c9d239ce569315b3abb2f7869931c1b34ce8 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -393,7 +393,9 @@ 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-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::::::::::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::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"linux-ppc",    "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"linux-ppc",    "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -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)",
+# -bpowerpc64-linux is transient option, -m64 should be the one to use...
+"linux-ppc64",  "gcc:-bpowerpc64-linux -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -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::::::::::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::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
@@ -450,11 +452,10 @@ my %table=(
 
 
 # IBM's AIX.
-"aix-cc",   "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::",
-"aix-gcc",  "gcc:-O3 -DB_ENDIAN::(unknown):AIX::BN_LLONG RC4_CHAR:::",
-"aix43-cc",   "cc:-O -DAIX -DB_ENDIAN -qmaxmem=16384::(unknown):::BN_LLONG RC4_CHAR::::::::::dlfcn:aix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::",
-"aix43-gcc",  "gcc:-O1 -DAIX -DB_ENDIAN::(unknown):::BN_LLONG RC4_CHAR::::::::::dlfcn:",
-"aix64-cc",   "cc:-O -DAIX -DB_ENDIAN -qmaxmem=16384 -q64::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHAR::::::::::dlfcn:aix-shared::-q64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64",
+"aix3-cc",    "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::",
+"aix-gcc",    "gcc:-O3 -DB_ENDIAN::-D_THREAD_SAFE:AIX::BN_LLONG RC4_CHAR:asm/aix_ppc32.o:::::::::dlfcn:",
+"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::-qthreaded:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:asm/aix_ppc64.o:::::::::dlfcn:aix-shared::-q64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64",
 
 #
 # Cray T90 and similar (SDSC)
@@ -550,7 +551,7 @@ my %table=(
 
 ##### MacOS X (a.k.a. Rhapsody or Darwin) setup
 "rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::",
-"darwin-ppc-cc","cc:-O3 -fomit-frame-pointer -fno-common -DB_ENDIAN::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::::::::::darwin-shared:-fPIC::.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+"darwin-ppc-cc","cc:-O3 -fomit-frame-pointer -fno-common -DB_ENDIAN::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/osx_ppc32.o::::::::::darwin-shared:-fPIC::.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 "darwin-i386-cc","cc:-O3 -fomit-frame-pointer -fno-common -DB_ENDIAN::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::::::::::darwin-shared:-fPIC::.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 
 ##### A/UX
index a4349087b52cd0ec9f4d77d98dc0d824b91fc2c7..7c1fb95c5ca16e70930dde278384569eb42b9055 100644 (file)
@@ -574,6 +574,8 @@ do_aix-shared:
                libs="$(LIBKRB5) $$libs"; \
        fi; \
        ( set -x; \
+         OBJECT_MODE=`expr x${SHARED_LDFLAGS} : 'x\-[a-z]\([0-9]*\)'`; \
+         OBJECT_MODE=$${OBJECT_MODE:-32}; export OBJECT_MODE; \
          ld -r -o lib$$i.o $(ALLSYMSFLAG) lib$$i.a && \
          ( nm -Pg lib$$i.o | grep ' [BD] ' | cut -f1 -d' ' > lib$$i.exp; \
            $(SHAREDCMD) $(SHAREDFLAGS) \
index d6731b1b134cc3b21126a136291554df6136d671..cbefadb40e5138f07e5d845653450c74317172d4 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 57e89f94b8f4af0450fb852af6f5a265956c8176..282b6369c27076092e357537fd0a655c9767c99d 100644 (file)
--- a/TABLE
+++ b/TABLE
@@ -1027,13 +1027,13 @@ $arflags      =
 
 *** aix-cc
 $cc           = cc
-$cflags       = -O -DB_ENDIAN -qmaxmem=16384
+$cflags       = -q32 -O -DB_ENDIAN -qmaxmem=16384
 $unistd       = 
-$thread_cflag = (unknown)
+$thread_cflag = -qthreaded
 $sys_id       = AIX
 $lflags       = 
 $bn_ops       = BN_LLONG RC4_CHAR
-$bn_obj       = 
+$bn_obj       = asm/aix_ppc32.o
 $des_obj      = 
 $bf_obj       = 
 $md5_obj      = 
@@ -1042,23 +1042,23 @@ $cast_obj     =
 $rc4_obj      = 
 $rmd160_obj   = 
 $rc5_obj      = 
-$dso_scheme   = 
-$shared_target= 
+$dso_scheme   = dlfcn
+$shared_target= aix-shared
 $shared_cflag = 
-$shared_ldflag = 
-$shared_extension = 
+$shared_ldflag = -q32
+$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
 $ranlib       = 
-$arflags      = 
+$arflags      = -X 32
 
 *** aix-gcc
 $cc           = gcc
 $cflags       = -O3 -DB_ENDIAN
 $unistd       = 
-$thread_cflag = (unknown)
+$thread_cflag = -D_THREAD_SAFE
 $sys_id       = AIX
 $lflags       = 
 $bn_ops       = BN_LLONG RC4_CHAR
-$bn_obj       = 
+$bn_obj       = asm/aix_ppc32.o
 $des_obj      = 
 $bf_obj       = 
 $md5_obj      = 
@@ -1067,7 +1067,7 @@ $cast_obj     =
 $rc4_obj      = 
 $rmd160_obj   = 
 $rc5_obj      = 
-$dso_scheme   = 
+$dso_scheme   = dlfcn
 $shared_target= 
 $shared_cflag = 
 $shared_ldflag = 
@@ -1075,37 +1075,12 @@ $shared_extension =
 $ranlib       = 
 $arflags      = 
 
-*** aix43-cc
+*** aix3-cc
 $cc           = cc
-$cflags       = -O -DAIX -DB_ENDIAN -qmaxmem=16384
-$unistd       = 
-$thread_cflag = (unknown)
-$sys_id       = 
-$lflags       = 
-$bn_ops       = BN_LLONG RC4_CHAR
-$bn_obj       = 
-$des_obj      = 
-$bf_obj       = 
-$md5_obj      = 
-$sha1_obj     = 
-$cast_obj     = 
-$rc4_obj      = 
-$rmd160_obj   = 
-$rc5_obj      = 
-$dso_scheme   = dlfcn
-$shared_target= aix-shared
-$shared_cflag = 
-$shared_ldflag = 
-$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
-$ranlib       = 
-$arflags      = 
-
-*** aix43-gcc
-$cc           = gcc
-$cflags       = -O1 -DAIX -DB_ENDIAN
+$cflags       = -O -DB_ENDIAN -qmaxmem=16384
 $unistd       = 
 $thread_cflag = (unknown)
-$sys_id       = 
+$sys_id       = AIX
 $lflags       = 
 $bn_ops       = BN_LLONG RC4_CHAR
 $bn_obj       = 
@@ -1117,7 +1092,7 @@ $cast_obj     =
 $rc4_obj      = 
 $rmd160_obj   = 
 $rc5_obj      = 
-$dso_scheme   = dlfcn
+$dso_scheme   = 
 $shared_target= 
 $shared_cflag = 
 $shared_ldflag = 
@@ -1127,13 +1102,13 @@ $arflags      =
 
 *** aix64-cc
 $cc           = cc
-$cflags       = -O -DAIX -DB_ENDIAN -qmaxmem=16384 -q64
+$cflags       = -q64 -O -DB_ENDIAN -qmaxmem=16384
 $unistd       = 
-$thread_cflag = (unknown)
-$sys_id       = 
+$thread_cflag = -qthreaded
+$sys_id       = AIX
 $lflags       = 
 $bn_ops       = SIXTY_FOUR_BIT_LONG RC4_CHAR
-$bn_obj       = 
+$bn_obj       = asm/aix_ppc64.o
 $des_obj      = 
 $bf_obj       = 
 $md5_obj      = 
@@ -1458,7 +1433,7 @@ $thread_cflag = -D_REENTRANT
 $sys_id       = MACOSX
 $lflags       = 
 $bn_ops       = BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR
-$bn_obj       = 
+$bn_obj       = asm/osx_ppc32.o
 $des_obj      = 
 $bf_obj       = 
 $md5_obj      = 
@@ -3333,7 +3308,7 @@ $thread_cflag = -D_REENTRANT
 $sys_id       = 
 $lflags       = -ldl
 $bn_ops       = BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL
-$bn_obj       = 
+$bn_obj       = asm/linux_ppc32.o
 $des_obj      = 
 $bf_obj       = 
 $md5_obj      = 
@@ -3350,6 +3325,31 @@ $shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
 $ranlib       = 
 $arflags      = 
 
+*** linux-ppc64
+$cc           = gcc
+$cflags       = -bpowerpc64-linux -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall
+$unistd       = 
+$thread_cflag = -D_REENTRANT
+$sys_id       = 
+$lflags       = -ldl
+$bn_ops       = SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL
+$bn_obj       = asm/linux_ppc64.o
+$des_obj      = 
+$bf_obj       = 
+$md5_obj      = 
+$sha1_obj     = 
+$cast_obj     = 
+$rc4_obj      = 
+$rmd160_obj   = 
+$rc5_obj      = 
+$dso_scheme   = dlfcn
+$shared_target= linux-shared
+$shared_cflag = -fPIC
+$shared_ldflag = -bpowerpc64-linux
+$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
+$ranlib       = 
+$arflags      = 
+
 *** linux-ppro
 $cc           = gcc
 $cflags       = -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -mcpu=pentiumpro -Wall
diff --git a/config b/config
index 36e820e4fea4cd3e66d680ca708ae100d35d8509..d460088cf551d0616da3a0c0f0654c0e16ffef3e 100755 (executable)
--- a/config
+++ b/config
@@ -111,16 +111,16 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
        echo "m68k-apple-aux3"; exit 0
        ;;
 
-    AIX:[3456789]:4:*)
-       echo "${MACHINE}-ibm-aix43"; exit 0
+    AIX:[3-9]:4:*)
+       echo "${MACHINE}-ibm-aix"; exit 0
        ;;
 
-    AIX:*:[56789]:*)
-       echo "${MACHINE}-ibm-aix43"; exit 0
+    AIX:*:[5-9]:*)
+       echo "${MACHINE}-ibm-aix"; exit 0
        ;;
 
     AIX:*)
-       echo "${MACHINE}-ibm-aix"; exit 0
+       echo "${MACHINE}-ibm-aix3"; exit 0
        ;;
 
     dgux:*)
@@ -547,9 +547,14 @@ EOF
        rm dummy dummy.c
        ;;
   ppc64-*-linux2)
-       #Use the standard target for PPC architecture until we create a
-       #special one for the 64bit architecture.
-       OUT="linux-ppc" ;;
+       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" ;;
@@ -741,8 +746,28 @@ EOF
        fi
        options="$options -D_REENTRANT" ;;
   *-hpux)      OUT="hpux-parisc-$CC" ;;
+  *-aix)
+       KERNEL_BITS=`(getconf KERNEL_BITMODE) 2>/dev/null`
+       KERNEL_BITS=${KERNEL_BITS:-32}
+       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="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 8137c57b1c55f85cfc8992fa9278eb655efe50a4..fe157a173136f137899ff51634cc7591e00af686 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"  \