make/solaris/makefiles/sparcWorks.make

Sun, 13 Apr 2008 17:43:42 -0400

author
coleenp
date
Sun, 13 Apr 2008 17:43:42 -0400
changeset 548
ba764ed4b6f2
parent 526
a294fd0c4b38
child 593
a49545cab84a
permissions
-rw-r--r--

6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold

     1 #
     2 # Copyright 1998-2007 Sun Microsystems, Inc.  All Rights Reserved.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 #
     5 # This code is free software; you can redistribute it and/or modify it
     6 # under the terms of the GNU General Public License version 2 only, as
     7 # published by the Free Software Foundation.
     8 #
     9 # This code is distributed in the hope that it will be useful, but WITHOUT
    10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12 # version 2 for more details (a copy is included in the LICENSE file that
    13 # accompanied this code).
    14 #
    15 # You should have received a copy of the GNU General Public License version
    16 # 2 along with this work; if not, write to the Free Software Foundation,
    17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18 #
    19 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20 # CA 95054 USA or visit www.sun.com if you need additional information or
    21 # have any questions.
    22 #  
    23 #
    25 # Compiler-specific flags for sparcworks.
    27 # tell make which C and C++ compilers to use
    28 CC	= cc
    29 CPP	= CC
    31 AS	= /usr/ccs/bin/as
    33 NM	= /usr/ccs/bin/nm
    34 NAWK    = /bin/nawk
    36 REORDER_FLAG = -xF
    38 # Check for the versions of C++ and C compilers ($CPP and $CC) used. 
    40 # Get the last thing on the line that looks like x.x+ (x is a digit).
    41 COMPILER_REV := \
    42 $(shell $(CPP) -V 2>&1 | sed -e 's/^.*\([1-9]\.[0-9][0-9]*\).*/\1/')
    43 C_COMPILER_REV := \
    44 $(shell $(CC) -V 2>&1 | grep -i "cc:" |  sed -e 's/^.*\([1-9]\.[0-9][0-9]*\).*/\1/')
    46 VALIDATED_COMPILER_REV   := 5.8
    47 VALIDATED_C_COMPILER_REV := 5.8
    49 ENFORCE_COMPILER_REV${ENFORCE_COMPILER_REV} := ${VALIDATED_COMPILER_REV}
    50 ifneq (${COMPILER_REV},${ENFORCE_COMPILER_REV})
    51 dummy_target_to_enforce_compiler_rev:
    52 	@echo "Wrong ${CPP} version:  ${COMPILER_REV}. " \
    53 	"Use version ${ENFORCE_COMPILER_REV}, or set" \
    54 	"ENFORCE_COMPILER_REV=${COMPILER_REV}."
    55 	@exit 1
    56 endif
    58 ENFORCE_C_COMPILER_REV${ENFORCE_C_COMPILER_REV} := ${VALIDATED_C_COMPILER_REV}
    59 ifneq (${C_COMPILER_REV},${ENFORCE_C_COMPILER_REV})
    60 dummy_target_to_enforce_c_compiler_rev:
    61 	@echo "Wrong ${CC} version:  ${C_COMPILER_REV}. " \
    62 	"Use version ${ENFORCE_C_COMPILER_REV}, or set" \
    63 	"ENFORCE_C_COMPILER_REV=${C_COMPILER_REV}."
    64 	@exit 1
    65 endif
    67 # Fail the build if __fabsf is used.  __fabsf exists only in Solaris 8 2/04
    68 # and newer; objects with a dependency on this symbol will not run on older
    69 # Solaris 8.
    70 JVM_FAIL_IF_UNDEFINED = __fabsf
    72 JVM_CHECK_SYMBOLS = $(NM) -u -p $(LIBJVM.o) | \
    73 	$(NAWK) -v f="${JVM_FAIL_IF_UNDEFINED}" \
    74 	     'BEGIN    { c=split(f,s); rc=0; } \
    75 	      /:$$/     { file = $$1; } \
    76 	      /[^:]$$/  { for(n=1;n<=c;++n) { \
    77 			   if($$1==s[n]) { \
    78 			     printf("JVM_CHECK_SYMBOLS: %s contains illegal symbol %s\n", \
    79 				    file,$$1); \
    80 			     rc=1; \
    81 			   } \
    82 		         } \
    83                        } \
    84 	      END      { exit rc; }'
    86 LINK_LIB.CC/PRE_HOOK += $(JVM_CHECK_SYMBOLS) || exit 1;
    88 # Some interfaces (_lwp_create) changed with LP64 and Solaris 7
    89 SOLARIS_7_OR_LATER := \
    90 $(shell uname -r | awk -F. '{ if ($$2 >= 7) print "-DSOLARIS_7_OR_LATER"; }')
    91 CFLAGS += ${SOLARIS_7_OR_LATER}
    93 ARCHFLAG         = $(ARCHFLAG/$(BUILDARCH))
    94 # set ARCHFLAG/BUILDARCH which will ultimately be ARCHFLAG
    95 ifeq ($(TYPE),COMPILER2)
    96 ARCHFLAG/sparc   = -xarch=v8plus
    97 else
    98 ifeq ($(TYPE),TIERED)
    99 ARCHFLAG/sparc   = -xarch=v8plus
   100 else
   101 ARCHFLAG/sparc   = -xarch=v8
   102 endif
   103 endif
   104 ARCHFLAG/sparcv9 = -xarch=v9
   105 ARCHFLAG/i486  =
   106 ARCHFLAG/amd64  = -xarch=amd64
   108 # Optional sub-directory in /usr/lib where BUILDARCH libraries are kept.
   109 ISA_DIR=$(ISA_DIR/$(BUILDARCH))
   110 ISA_DIR/sparcv9=/sparcv9
   111 ISA_DIR/amd64=/amd64
   113 # Use these to work around compiler bugs:
   114 OPT_CFLAGS/SLOWER=-xO3
   115 OPT_CFLAGS/O2=-xO2
   116 OPT_CFLAGS/NOOPT=-xO1
   118 #################################################
   119 # Begin current (>=5.6) Forte compiler options #
   120 #################################################
   122 ifeq ($(shell expr $(COMPILER_REV) \>= 5.6), 1)
   124 ifeq ("${Platform_arch}", "sparc")
   126 # We MUST allow data alignment of 4 for sparc (sparcv9 is ok at 8s)
   127 ifndef LP64
   128 CFLAGS += -xmemalign=4s
   129 endif
   131 endif
   133 endif
   135 #################################################
   136 # Begin current (>=5.5) Forte compiler options #
   137 #################################################
   139 ifeq ($(shell expr $(COMPILER_REV) \>= 5.5), 1)
   141 CFLAGS     += $(ARCHFLAG)
   142 AOUT_FLAGS += $(ARCHFLAG)
   143 LIB_FLAGS  += $(ARCHFLAG)
   144 LFLAGS     += $(ARCHFLAG)
   146 ifeq ("${Platform_arch}", "sparc")
   148 # Flags for Optimization
   150 # [phh] Commented out pending verification that we do indeed want
   151 #       to potentially bias against u1 and u3 targets.
   152 #CFLAGS += -xchip=ultra2
   154 OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS)
   156 endif # sparc
   158 ifeq ("${Platform_arch_model}", "x86_32")
   160 OPT_CFLAGS=-xtarget=pentium $(EXTRA_OPT_CFLAGS)
   162 # UBE (CC 5.5) has bug 4923569 with -xO4
   163 OPT_CFLAGS+=-xO3
   165 endif # 32bit x86
   167 ifeq ("${Platform_arch_model}", "x86_64")
   169 ASFLAGS += -xarch=amd64
   170 CFLAGS  += -xarch=amd64
   171 # this one seemed useless
   172 LFLAGS_VM  += -xarch=amd64
   173 # this one worked
   174 LFLAGS  += -xarch=amd64
   175 AOUT_FLAGS += -xarch=amd64
   177 # -xO3 is faster than -xO4 on specjbb with SS10 compiler
   178 OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS)
   180 endif # 64bit x86
   182 # Inline functions
   183 CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_${Platform_arch}/vm/solaris_${Platform_arch_model}.il
   185 # no more exceptions
   186 CFLAGS/NOEX=-features=no%except
   189 # avoid compilation problems arising from fact that C++ compiler tries 
   190 # to search for external template definition by just compiling additional
   191 # source files in th same context
   192 CFLAGS +=  -template=no%extdef
   194 # Reduce code bloat by reverting back to 5.0 behavior for static initializers
   195 CFLAGS += -features=no%split_init
   197 # Use -D_Crun_inline_placement so we don't get references to 
   198 #    __1c2n6FIpv_0_ or   void*operator new(unsigned,void*)
   199 #  This avoids the hard requirement of the newer Solaris C++ runtime patches.
   200 #  NOTE: This is an undocumented feature of the SS10 compiler. See 6306698.
   201 CFLAGS += -D_Crun_inline_placement
   203 # PIC is safer for SPARC, and is considerably slower
   204 # a file foo.o which wants to compile -pic can set "PICFLAG/foo.o = -PIC"
   205 PICFLAG         = -KPIC
   206 PICFLAG/DEFAULT = $(PICFLAG)
   207 # [RGV] Need to figure which files to remove to get link to work
   208 #PICFLAG/BETTER  = -pic
   209 PICFLAG/BETTER  = $(PICFLAG/DEFAULT)
   210 PICFLAG/BYFILE  = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@))
   212 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
   213 MAPFLAG = -M FILENAME
   215 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
   216 SONAMEFLAG = -h SONAME
   218 # Build shared library
   219 SHARED_FLAG = -G
   221 # We don't need libCstd.so and librwtools7.so, only libCrun.so
   222 CFLAGS += -library=%none
   223 LFLAGS += -library=%none
   225 LFLAGS += -mt
   227 endif	# COMPILER_REV >= VALIDATED_COMPILER_REV
   229 ######################################
   230 # End 5.5 Forte compiler options     #
   231 ######################################
   233 ######################################
   234 # Begin 5.2 Forte compiler options   #
   235 ######################################
   237 ifeq ($(COMPILER_REV), 5.2)
   239 CFLAGS     += $(ARCHFLAG)
   240 AOUT_FLAGS += $(ARCHFLAG)
   241 LIB_FLAGS  += $(ARCHFLAG)
   242 LFLAGS     += $(ARCHFLAG)
   244 ifeq ("${Platform_arch}", "sparc")
   246 # Flags for Optimization
   248 # [phh] Commented out pending verification that we do indeed want
   249 #       to potentially bias against u1 and u3 targets.
   250 #CFLAGS += -xchip=ultra2
   252 ifdef LP64
   253 # SC5.0 tools on v9 are flakey at -xO4
   254 # [phh] Is this still true for 6.1?
   255 OPT_CFLAGS=-xO3 $(EXTRA_OPT_CFLAGS)
   256 else
   257 OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS)
   258 endif
   260 CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_sparc/vm/solaris_sparc.il
   262 endif # sparc
   264 ifeq ("${Platform_arch_model}", "x86_32")
   266 OPT_CFLAGS=-xtarget=pentium $(EXTRA_OPT_CFLAGS)
   268 # SC5.0 tools on x86 are flakey at -xO4
   269 # [phh] Is this still true for 6.1?
   270 OPT_CFLAGS+=-xO3
   272 CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_x86/vm/solaris_x86_32.il
   274 endif # 32bit x86
   276 # no more exceptions
   277 CFLAGS/NOEX=-noex
   279 # Reduce code bloat by reverting back to 5.0 behavior for static initializers
   280 CFLAGS += -Qoption ccfe -one_static_init
   282 # PIC is safer for SPARC, and is considerably slower
   283 # a file foo.o which wants to compile -pic can set "PICFLAG/foo.o = -PIC"
   284 PICFLAG         = -KPIC
   285 PICFLAG/DEFAULT = $(PICFLAG)
   286 # [RGV] Need to figure which files to remove to get link to work
   287 #PICFLAG/BETTER  = -pic
   288 PICFLAG/BETTER  = $(PICFLAG/DEFAULT)
   289 PICFLAG/BYFILE  = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@))
   291 # Would be better if these weren't needed, since we link with CC, but
   292 # at present removing them causes run-time errors
   293 LFLAGS += -library=Crun
   294 LIBS   += -library=Crun -lCrun
   296 endif	# COMPILER_REV >= VALIDATED_COMPILER_REV
   298 ##################################
   299 # End 5.2 Forte compiler options #
   300 ##################################
   302 ##################################
   303 # Begin old 5.1 compiler options #
   304 ##################################
   305 ifeq ($(COMPILER_REV), 5.1)
   307 _JUNK_ := $(shell echo >&2 \
   308        "*** ERROR: sparkWorks.make incomplete for 5.1 compiler")
   309 	@exit 1
   310 endif
   311 ##################################
   312 # End old 5.1 compiler options   #
   313 ##################################
   315 ##################################
   316 # Begin old 5.0 compiler options #
   317 ##################################
   319 ifeq	(${COMPILER_REV}, 5.0)
   321 # Had to hoist this higher apparently because of other changes. Must
   322 # come before -xarch specification.
   323 CFLAGS += -xtarget=native
   325 CFLAGS     += $(ARCHFLAG)
   326 AOUT_FLAGS += $(ARCHFLAG)
   327 LIB_FLAGS  += $(ARCHFLAG)
   328 LFLAGS     += $(ARCHFLAG)
   330 CFLAGS += -library=iostream
   331 LFLAGS += -library=iostream  -library=Crun
   332 LIBS += -library=iostream -library=Crun -lCrun
   334 # Flags for Optimization
   335 ifdef LP64
   336 # SC5.0 tools on v9 are flakey at -xO4
   337 OPT_CFLAGS=-xO3 $(EXTRA_OPT_CFLAGS)
   338 else
   339 OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS)
   340 endif
   342 ifeq ("${Platform_arch}", "sparc")
   344 CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.il
   346 endif # sparc
   348 ifeq ("${Platform_arch_model}", "x86_32")
   349 OPT_CFLAGS=-xtarget=pentium $(EXTRA_OPT_CFLAGS)
   350 ifeq ("${COMPILER_REV}", "5.0")
   351 # SC5.0 tools on x86 are flakey at -xO4
   352 OPT_CFLAGS+=-xO3
   353 else
   354 OPT_CFLAGS+=-xO4
   355 endif
   357 CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_x86/vm/solaris_x86_32.il
   359 endif  # 32bit x86
   361 # The following options run into misaligned ldd problem (raj)
   362 #OPT_CFLAGS = -fast -O4 -xarch=v8 -xchip=ultra
   364 # no more exceptions
   365 CFLAGS/NOEX=-noex
   367 # PIC is safer for SPARC, and is considerably slower
   368 # a file foo.o which wants to compile -pic can set "PICFLAG/foo.o = -PIC"
   369 PICFLAG         = -PIC
   370 PICFLAG/DEFAULT = $(PICFLAG)
   371 # [RGV] Need to figure which files to remove to get link to work
   372 #PICFLAG/BETTER  = -pic
   373 PICFLAG/BETTER  = $(PICFLAG/DEFAULT)
   374 PICFLAG/BYFILE  = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@))
   376 endif	# COMPILER_REV = 5.0
   378 ################################
   379 # End old 5.0 compiler options #
   380 ################################
   382 ifeq ("${COMPILER_REV}", "4.2")
   383 # 4.2 COMPILERS SHOULD NO LONGER BE USED
   384 _JUNK_ := $(shell echo >&2 \
   385        "*** ERROR: SC4.2 compilers are not supported by this code base!")
   386 	@exit 1
   387 endif
   389 # do not include shared lib path in a.outs
   390 AOUT_FLAGS += -norunpath
   391 LFLAGS_VM = -norunpath -z noversion
   393 # need position-indep-code for shared libraries
   394 # (ild appears to get errors on PIC code, so we'll try non-PIC for debug)
   395 ifeq ($(PICFLAGS),DEFAULT)
   396 VM_PICFLAG/LIBJVM  = $(PICFLAG/DEFAULT)
   397 else
   398 VM_PICFLAG/LIBJVM  = $(PICFLAG/BYFILE)
   399 endif
   400 VM_PICFLAG/AOUT    =
   402 VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO))
   403 CFLAGS += $(VM_PICFLAG)
   405 # less dynamic linking (no PLTs, please)
   406 #LIB_FLAGS += $(LINK_MODE)
   407 # %%%%% despite -znodefs, -Bsymbolic gets link errors -- Rose
   409 LINK_MODE = $(LINK_MODE/$(VERSION))
   410 LINK_MODE/debug     =
   411 LINK_MODE/optimized = -Bsymbolic -znodefs
   413 # Have thread local errnos
   414 ifeq ($(shell expr $(COMPILER_REV) \>= 5.5), 1)
   415 CFLAGS += -mt
   416 else
   417 CFLAGS += -D_REENTRANT
   418 endif
   420 ifdef CC_INTERP
   421 # C++ Interpreter
   422 CFLAGS += -DCC_INTERP
   423 endif
   425 # Flags for Debugging
   426 DEBUG_CFLAGS = -g
   427 FASTDEBUG_CFLAGS = -g0
   428 # The -g0 setting allows the C++ frontend to inline, which is a big win.
   430 # Enable the following CFLAGS additions if you need to compare the
   431 # built ELF objects.
   432 #
   433 # The -g option makes static data global and the "-Qoption ccfe
   434 # -xglobalstatic" option tells the compiler to not globalize static
   435 # data using a unique globalization prefix. Instead force the use of
   436 # a static globalization prefix based on the source filepath so the
   437 # objects from two identical compilations are the same.
   438 #DEBUG_CFLAGS += -Qoption ccfe -xglobalstatic
   439 #FASTDEBUG_CFLAGS += -Qoption ccfe -xglobalstatic
   441 ifeq	(${COMPILER_REV}, 5.2)
   442 COMPILER_DATE := $(shell $(CPP) -V 2>&1 | awk '{ print $$NF; }')
   443 ifeq	(${COMPILER_DATE}, 2001/01/31)
   444 # disable -g0 in fastdebug since SC6.1 dated 2001/01/31 seems to be buggy
   445 # use an innocuous value because it will get -g if it's empty
   446 FASTDEBUG_CFLAGS = -c
   447 endif
   448 endif
   450 # Uncomment or 'gmake CFLAGS_BROWSE=-sbfast' to get source browser information.
   451 # CFLAGS_BROWSE	= -sbfast
   452 CFLAGS		+= $(CFLAGS_BROWSE)
   454 # ILD is gone as of SS11 (5.8), not supportted in SS10 (5.7)
   455 ifeq ($(shell expr $(COMPILER_REV) \< 5.7), 1)
   456   # use ild when debugging (but when optimizing we want reproducible results)
   457   ILDFLAG = $(ILDFLAG/$(VERSION))
   458   ILDFLAG/debug     = -xildon
   459   ILDFLAG/optimized =
   460   AOUT_FLAGS += $(ILDFLAG)
   461 endif
   463 # Where to put the *.o files (a.out, or shared library)?
   464 LINK_INTO = $(LINK_INTO/$(VERSION))
   465 LINK_INTO/debug = LIBJVM
   466 LINK_INTO/optimized = LIBJVM
   468 # We link the debug version into the a.out because:
   469 #  1. ild works on a.out but not shared libraries, and using ild
   470 #     can cut rebuild times by 25% for small changes. (ILD is gone in SS11)
   471 #  2. dbx cannot gracefully set breakpoints in shared libraries
   472 #
   474 # apply this setting to link into the shared library even in the debug version:
   475 ifdef LP64
   476 LINK_INTO = LIBJVM
   477 else
   478 #LINK_INTO = LIBJVM
   479 endif
   481 MCS	= /usr/ccs/bin/mcs
   482 STRIP	= /usr/ccs/bin/strip
   484 # Solaris platforms collect lots of redundant file-ident lines,
   485 # to the point of wasting a significant percentage of file space.
   486 # (The text is stored in ELF .comment sections, contributed by
   487 # all "#pragma ident" directives in header and source files.)
   488 # This command "compresses" the .comment sections simply by
   489 # removing repeated lines.  The data can be extracted from
   490 # binaries in the field by using "mcs -p libjvm.so" or the older
   491 # command "what libjvm.so".
   492 LINK_LIB.CC/POST_HOOK += $(MCS) -c $@ || exit 1;
   493 # (The exit 1 is necessary to cause a build failure if the command fails and
   494 # multiple commands are strung together, and the final semicolon is necessary
   495 # since the hook must terminate itself as a valid command.)
   497 # Also, strip debug and line number information (worth about 1.7Mb).
   498 STRIP_LIB.CC/POST_HOOK = $(STRIP) -x $@ || exit 1;
   499 # STRIP_LIB.CC/POST_HOOK is incorporated into LINK_LIB.CC/POST_HOOK
   500 # in certain configurations, such as product.make.  Other configurations,
   501 # such as debug.make, do not include the strip operation.

mercurial