Extend Solaris x86 support to amd64.
authorAndy Polyakov <appro@openssl.org>
Mon, 4 Apr 2005 17:10:53 +0000 (17:10 +0000)
committerAndy Polyakov <appro@openssl.org>
Mon, 4 Apr 2005 17:10:53 +0000 (17:10 +0000)
Configure
Makefile.shared
TABLE
config
crypto/bn/Makefile
crypto/rc4/Makefile

index 7c91ef5e0b2ecee56c8a4d757f505afc265301bb..e7159cd8c53a7d99ec86271bc825e0e74b2b5cb5 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -185,8 +185,19 @@ my %table=(
 # 7_x86) /usr/ccs/bin/as fails to assemble with "Illegal mnemonic"
 # error message.
 "solaris-x86-gcc","gcc:-O3 -fomit-frame-pointer -m486 -Wall -DL_ENDIAN -DOPENSSL_NO_INLINE_ASM::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+# -shared -static-libgcc might appear controversial, but modules taken
+# from static libgcc do not have relocations and linking them into our
+# shared objects doesn't have any negative side-effects. On the contrary,
+# doing so makes it possible to use gcc shared build with Sun C. Given
+# that gcc generates faster code [thanks to inline assembler], I would
+# actually recommend to consider using gcc shared build even with vendor
+# compiler:-)
+#                                              <appro@fy.chalmers.se>
+"solaris64-x86_64-gcc","gcc:-m64 -O3 -Wall -DL_ENDIAN -DMD32_REG_T=int::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:solaris-shared:-fPIC:-m64 -shared -static-libgcc:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 #### Solaris x86 with Sun C setups
 "solaris-x86-cc","cc:-fast -O -Xa::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"solaris64-x86_64-cc","cc:-fast -xarch=amd64 -xstrconst -Xa -DL_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${no_asm}:dlfcn:solaris-shared:-KPIC:-xarch=amd64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 
 #### SPARC Solaris with GNU C setups
 "solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
index d4df5e2b66eb96b1886f5b26fec53f2d8eb2515b..6c6a96d58f3d10c381ca9ea1691b287e01269f33 100644 (file)
@@ -141,7 +141,7 @@ DO_GNU_SO=$(CALC_VERSIONS); \
        LIBDEPS="$(LIBDEPS)"; \
        ALLSYMSFLAGS='-Wl,--whole-archive'; \
        NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
-       SHAREDFLAGS="$(CFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX -Wl,-rpath,$(LIBRPATH)"; \
+       SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX -Wl,-rpath,$(LIBRPATH)"; \
        SHAREDCMD='$(CC)'
 DO_GNU_APP=LDCMD=$(CC);\
        LDFLAGS="$(CFLAGS) -Wl,-rpath,$(LIBRPATH)"; \
@@ -457,7 +457,7 @@ link_o.solaris:
                LIBDEPS="$(LIBDEPS)"; \
                ALLSYMSFLAGS="$${MINUSZ}allextract"; \
                NOALLSYMSFLAGS="$${MINUSZ}defaultextract"; \
-               SHAREDFLAGS="$(CFLAGS) -G -dy -z text -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX -R $(LIBRPATH) -Wl,-Bsymbolic"; \
+               SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -G -dy -z text -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX -R $(LIBRPATH) -Wl,-Bsymbolic"; \
                SHAREDCMD='$(CC)'; \
        fi; \
        $(LINK_SO_O)
@@ -473,7 +473,7 @@ link_a.solaris:
                LIBDEPS="$(LIBDEPS)"; \
                ALLSYMSFLAGS="$${MINUSZ}allextract"; \
                NOALLSYMSFLAGS="$${MINUSZ}defaultextract"; \
-               SHAREDFLAGS="$(CFLAGS) -G -dy -z text -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX -R $(LIBRPATH) -Wl,-Bsymbolic"; \
+               SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -G -dy -z text -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX -R $(LIBRPATH) -Wl,-Bsymbolic"; \
                SHAREDCMD='$(CC)'; \
        fi; \
        $(LINK_SO_A)
diff --git a/TABLE b/TABLE
index 76ca810e4606830af76f52258b0b331bd3dc3982..bf8e148fb181240bc30f214af6bda5bd9a80db2e 100644 (file)
--- a/TABLE
+++ b/TABLE
@@ -314,7 +314,7 @@ $md5_obj      = mx86-cof.o
 $sha1_obj     = sx86-cof.o s512sse2-cof.o
 $cast_obj     = cx86-cof.o
 $rc4_obj      = rx86-cof.o
-$rmd160_obj   = /rm86-cof.o
+$rmd160_obj   = rm86-cof.o
 $rc5_obj      = r586-cof.o
 $dso_scheme   = dlfcn
 $shared_target= cygwin-shared
@@ -3095,7 +3095,7 @@ $md5_obj      = mx86-cof.o
 $sha1_obj     = sx86-cof.o s512sse2-cof.o
 $cast_obj     = cx86-cof.o
 $rc4_obj      = rx86-cof.o
-$rmd160_obj   = /rm86-cof.o
+$rmd160_obj   = rm86-cof.o
 $rc5_obj      = r586-cof.o
 $dso_scheme   = win32
 $shared_target= cygwin-shared
@@ -3807,6 +3807,60 @@ $shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
 $ranlib       = 
 $arflags      = 
 
+*** solaris64-x86_64-cc
+$cc           = cc
+$cflags       = -fast -xarch=amd64 -xstrconst -Xa -DL_ENDIAN
+$unistd       = 
+$thread_cflag = -D_REENTRANT
+$sys_id       = 
+$lflags       = -lsocket -lnsl -ldl
+$bn_ops       = SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL
+$cpuid_obj    = 
+$bn_obj       = 
+$des_obj      = 
+$aes_obj      = 
+$bf_obj       = 
+$md5_obj      = 
+$sha1_obj     = 
+$cast_obj     = 
+$rc4_obj      = 
+$rmd160_obj   = 
+$rc5_obj      = 
+$dso_scheme   = dlfcn
+$shared_target= solaris-shared
+$shared_cflag = -KPIC
+$shared_ldflag = -xarch=amd64
+$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
+$ranlib       = 
+$arflags      = 
+
+*** solaris64-x86_64-gcc
+$cc           = gcc
+$cflags       = -m64 -O3 -Wall -DL_ENDIAN -DMD32_REG_T=int
+$unistd       = 
+$thread_cflag = -D_REENTRANT
+$sys_id       = 
+$lflags       = -lsocket -lnsl -ldl
+$bn_ops       = SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL
+$cpuid_obj    = amd64cpuid.o
+$bn_obj       = x86_64-gcc.o
+$des_obj      = 
+$aes_obj      = 
+$bf_obj       = 
+$md5_obj      = 
+$sha1_obj     = 
+$cast_obj     = 
+$rc4_obj      = rc4-amd64.o
+$rmd160_obj   = 
+$rc5_obj      = 
+$dso_scheme   = dlfcn
+$shared_target= solaris-shared
+$shared_cflag = -fPIC
+$shared_ldflag = -m64 -shared -static-libgcc
+$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
+$ranlib       = 
+$arflags      = 
+
 *** sunos-gcc
 $cc           = gcc
 $cflags       = -O3 -mv8 -Dssize_t=int
diff --git a/config b/config
index 711af61541a9711181e65ed00b8f1442996ce960..71ada7bbe1508ee7808587bb2075753bd853ea21 100755 (executable)
--- a/config
+++ b/config
@@ -442,7 +442,7 @@ if [ "$SYSTEM" = "SunOS" ]; then
        egrep -e '^cc: .* C [0-9]\.[0-9]' | \
        sed 's/.* C \([0-9]\)\.\([0-9]\).*/\1\2/'`
   CCVER=${CCVER:-0}
-  if [ $CCVER -gt 40 ]; then
+  if [ $MACHINE != i86pc -a $CCVER -gt 40 ]; then
     CC=cc      # overrides gcc!!!
     if [ $CCVER -eq 50 ]; then
       echo "WARNING! Detected WorkShop C 5.0. Do make sure you have"
@@ -638,7 +638,14 @@ case "$GUESSOS" in
   sun4m-*-solaris2)    OUT="solaris-sparcv8-$CC" ;;
   sun4d-*-solaris2)    OUT="solaris-sparcv8-$CC" ;;
   sun4*-*-solaris2)    OUT="solaris-sparcv7-$CC" ;;
-  *86*-*-solaris2)     OUT="solaris-x86-$CC" ;;
+  *86*-*-solaris2)
+       ISA64=`(isalist) 2>/dev/null | grep amd64`
+       if [ "$ISA64" != "" ]; then
+           OUT="solaris64-x86_64-$CC"
+       else
+           OUT="solaris-x86-$CC"
+       fi
+       ;;
   *-*-sunos4)          OUT="sunos-$CC" ;;
 
   *86*-*-bsdi4)                OUT="bsdi-elf-gcc" ;;
index 75437cdbccc9030f8b31626e2b49e6769ef6788a..0a3851853dda5984cdb60905112570c285a4b230 100644 (file)
@@ -89,6 +89,7 @@ sparcv8plus.o:        asm/sparcv8plus.S
 mips3.o:       asm/mips3.s
 
 x86_64-gcc.o:  asm/x86_64-gcc.c
+       $(CC) $(CFLAGS) -c -o $@ asm/x86_64-gcc.c
 
 bn-ia64.s:     asm/ia64.S
        $(CC) $(CFLAGS) -E asm/ia64.S > $@
index 91fb3ac8031338dcedde0d156f3f6e28725c9ac6..a392e3e997cea8141a2c4fff15063da703a25076 100644 (file)
@@ -58,7 +58,7 @@ rx86-cof.s: asm/rc4-586.pl ../perlasm/x86asm.pl
 rx86-out.s: asm/rc4-586.pl ../perlasm/x86asm.pl
        (cd asm; $(PERL) rc4-586.pl a.out $(CFLAGS) > ../$@)
 
-rc4-amd64.s: asm/rc4-amd64.pl; $(PERL) $< $@
+rc4-amd64.s: asm/rc4-amd64.pl; $(PERL) asm/rc4-amd64.pl $@
 
 rc4-ia64.s: asm/rc4-ia64.S
        $(CC) $(CFLAGS) -E asm/rc4-ia64.S > $@