# HG changeset patch
# User ohair
# Date 1212597498 25200
#      Wed Jun 04 09:38:18 2008 -0700
# Node ID f9467b4496dc3731d73dbc5a42fd84cc9b1faaab
# Parent  b6601ba7f6dfe0d93e40b2891c581c30fdd92289
6563752: Build and test JDK7 with Sun Studio 12 Express compilers (prep makefiles)
Summary: Changes to support building with SS12.
Reviewed-by: tbell

diff --git a/make/common/Defs-solaris.gmk b/make/common/Defs-solaris.gmk
--- openjdk/jdk/make/common/Defs-solaris.gmk
+++ openjdk/jdk/make/common/Defs-solaris.gmk
@@ -197,7 +197,6 @@
 
 # Lint Flags:
 #	-Xa			ANSI C plus K&R, favor ANSI rules
-#       -Xarch=XXX		Same as 'cc -xarch=XXX'
 #	-fd			report on old style func defs
 #	-errchk=structarg	report on 64bit struct args by value
 #	-errchk=longptr64	report on 64bit to 32bit issues (ignores casts)
@@ -206,6 +205,7 @@
 #	-x			suppress unused externs
 #	-u			suppress extern func/vars used/defined
 #	-errfmt=simple		use one line errors with position info
+#       $(LINT_XARCH_OPTION)    See Compiler-sun.gwk
 
 LINTFLAGS_COMMON  = -Xa
 LINTFLAGS_COMMON += -fd 
@@ -224,42 +224,12 @@
 #    Tell the compilers to never generate globalized names, all the time.
 CFLAGS_COMMON += -W0,-noglobal
 
-# Arch specific settings (determines type of .o files and instruction set)
-ifeq ($(ARCH_FAMILY), sparc)
-  ifdef VIS_NEEDED
-    XARCH_VALUE/32=v8plusa
-    XARCH_VALUE/64=v9a
-  else 
-    # Someday this should change to improve optimization on UltraSPARC
-    #    and abandon the old v8-only machines like the SPARCstation 10.
-    #    Indications with Mustang is that alacrity runs do not show a
-    #    big improvement using v8plus over v8, but other benchmarks might.
-    XARCH_VALUE/32=v8
-    XARCH_VALUE/64=v9
-  endif
-endif
-ifeq ($(ARCH_FAMILY), i586)
-  XARCH_VALUE/64=amd64
-  XARCH_VALUE/32=
-endif
-
-# Arch value based on current data model being built
-XARCH_VALUE=$(XARCH_VALUE/$(ARCH_DATA_MODEL))
-ifneq ($(XARCH_VALUE), )
-  # The actual compiler -xarch options to use
-  XARCH_OPTION/32 = -xarch=$(XARCH_VALUE/32)
-  XARCH_OPTION/64 = -xarch=$(XARCH_VALUE/64)
-  XARCH_OPTION    = $(XARCH_OPTION/$(ARCH_DATA_MODEL))
-endif
-
-# If we have a specific -xarch value to use, add it
-ifdef XARCH_OPTION
-  CFLAGS_COMMON    += $(XARCH_OPTION)
-  CXXFLAGS_COMMON  += $(XARCH_OPTION)
-  ASFLAGS_COMMON   += $(XARCH_OPTION)
-  EXTRA_LIBS       += $(XARCH_OPTION)
-  LINTFLAGS_COMMON += -Xarch=$(XARCH_VALUE)
-endif
+# If we have a specific arch value to use, add it
+CFLAGS_COMMON    += $(XARCH_OPTION)
+CXXFLAGS_COMMON  += $(XARCH_OPTION)
+ASFLAGS_COMMON   += $(AS_XARCH_OPTION)
+EXTRA_LIBS       += $(XARCH_OPTION)
+LINTFLAGS_COMMON += $(LINT_XARCH_OPTION)
 
 #
 # uncomment the following to build with PERTURBALOT set
diff --git a/make/common/shared/Compiler-sun.gmk b/make/common/shared/Compiler-sun.gmk
--- openjdk/jdk/make/common/shared/Compiler-sun.gmk
+++ openjdk/jdk/make/common/shared/Compiler-sun.gmk
@@ -31,6 +31,9 @@
 
 # Sun Studio Compiler settings specific to Solaris
 ifeq ($(PLATFORM), solaris)
+  # FIXUP: Change to SS12 when validated
+  #COMPILER_VERSION=SS12
+  #REQUIRED_CC_VER=5.9
   COMPILER_VERSION=SS11
   REQUIRED_CC_VER=5.8
   CC             = $(COMPILER_PATH)cc
@@ -51,8 +54,8 @@
 # Sun Studio Compiler settings specific to Linux
 ifeq ($(PLATFORM), linux)
   # This has not been tested
-  COMPILER_VERSION=SS11
-  REQUIRED_CC_VER=5.8
+  COMPILER_VERSION=SS12
+  REQUIRED_CC_VER=5.9
   CC             = $(COMPILER_PATH)cc
   CPP            = $(COMPILER_PATH)cc -E
   CXX            = $(COMPILER_PATH)CC
@@ -74,3 +77,58 @@
 _CC_VER :=$(shell $(CC) -V 2>&1 | $(HEAD) -n 1)
 CC_VER  :=$(call GetVersion,"$(_CC_VER)")
 
+# Arch specific settings (determines type of .o files and instruction set)
+#  Starting in SS12 (5.9), the arch options changed.
+#  The assembler /usr/ccs/bin/as wants older SS11 (5.8) style options.
+#   Note: We need to have both 32 and 64 values at all times for awt Makefiles.
+#
+XARCH_OPTION_OLD/32 =
+XARCH_OPTION_OLD/64 =
+XARCH_OPTION_NEW/32 = -m32
+XARCH_OPTION_NEW/64 = -m64
+# Lint options are slightly different
+LINT_XARCH_OPTION_OLD/32 =
+LINT_XARCH_OPTION_OLD/64 =
+LINT_XARCH_OPTION_NEW/32 = -m32
+LINT_XARCH_OPTION_NEW/64 = -m64
+ifeq ($(ARCH_FAMILY), sparc)
+  ifdef VIS_NEEDED
+    XARCH_OPTION_OLD/32 += -xarch=v8plusa
+    XARCH_OPTION_OLD/64 += -xarch=v9a
+    XARCH_OPTION_NEW/32 += -xarch=sparcvis
+    XARCH_OPTION_NEW/64 += -xarch=sparcvis
+  else
+    # Someday this should change to improve optimization on UltraSPARC
+    #    and abandon v8, even change to sparcvis or sparcvis2, this
+    #    abandons machines like the SPARCstation 10.
+    #    Indications with jdk6 is that alacrity runs do not show a
+    #    big improvement using v8plus over v8, but other benchmarks might.
+    XARCH_OPTION_OLD/32 += -xarch=v8
+    XARCH_OPTION_OLD/64 += -xarch=v9
+    # Note that this new option (SS12+) effectively means v8plus
+    XARCH_OPTION_NEW/32 += -xarch=sparc
+    XARCH_OPTION_NEW/64 += -xarch=sparc
+  endif
+  LINT_XARCH_OPTION_OLD/64 += -Xarch=v9
+endif
+ifeq ($(ARCH_FAMILY), i586)
+  XARCH_OPTION_OLD/64      += -xarch=amd64
+  LINT_XARCH_OPTION_OLD/64 += -Xarch=amd64
+endif
+# Pick the options we want based on the compiler being used.
+ifeq ($(shell expr $(CC_VER) \>= 5.9), 1)
+  XARCH_OPTION/32 = $(XARCH_OPTION_NEW/32)
+  XARCH_OPTION/64 = $(XARCH_OPTION_NEW/64)
+  LINT_XARCH_OPTION/32 = $(LINT_XARCH_OPTION_NEW/32)
+  LINT_XARCH_OPTION/64 = $(LINT_XARCH_OPTION_NEW/64)
+else
+  XARCH_OPTION/32 = $(XARCH_OPTION_OLD/32)
+  XARCH_OPTION/64 = $(XARCH_OPTION_OLD/64)
+  LINT_XARCH_OPTION/32 = $(LINT_XARCH_OPTION_OLD/32)
+  LINT_XARCH_OPTION/64 = $(LINT_XARCH_OPTION_OLD/64)
+endif
+XARCH_OPTION = $(XARCH_OPTION/$(ARCH_DATA_MODEL))
+LINT_XARCH_OPTION = $(LINT_XARCH_OPTION/$(ARCH_DATA_MODEL))
+# The /usr/ccs/bin/as assembler always wants the older SS11 (5.8) options.
+AS_XARCH_OPTION = $(XARCH_OPTION_OLD/$(ARCH_DATA_MODEL))
+
diff --git a/make/jdk_generic_profile.sh b/make/jdk_generic_profile.sh
--- openjdk/jdk/make/jdk_generic_profile.sh
+++ openjdk/jdk/make/jdk_generic_profile.sh
@@ -119,7 +119,7 @@
   # System place where JDK installed images are stored?
   jdk_instances=/usr/jdk/instances
 
-  # Get the SS11 compilers (and latest patches for them too)
+  # Get the Sun Studio compilers (and latest patches for them too)
   if [ "${ALT_COMPILER_PATH}" = "" ] ; then
     ALT_COMPILER_PATH=/opt/SUNWspro/bin
     export ALT_COMPILER_PATH
