Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/make/solaris/makefiles/sparcWorks.make
32284 views
#1# Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.2# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3#4# This code is free software; you can redistribute it and/or modify it5# under the terms of the GNU General Public License version 2 only, as6# published by the Free Software Foundation.7#8# This code is distributed in the hope that it will be useful, but WITHOUT9# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11# version 2 for more details (a copy is included in the LICENSE file that12# accompanied this code).13#14# You should have received a copy of the GNU General Public License version15# 2 along with this work; if not, write to the Free Software Foundation,16# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17#18# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19# or visit www.oracle.com if you need additional information or have any20# questions.21#22#2324# If a SPEC is not set already, then use these defaults.25ifeq ($(SPEC),)26# Compiler-specific flags for sparcworks.27CC = cc28CXX = CC2930# Note that this 'as' is an older version of the Sun Studio 'fbe', and will31# use the older style options. The 'fbe' options will match 'cc' and 'CC'.32AS = /usr/ccs/bin/as3334NM = /usr/ccs/bin/nm35NAWK = /bin/nawk3637MCS = /usr/ccs/bin/mcs38STRIP = /usr/ccs/bin/strip39endif4041# Check for the versions of C++ and C compilers ($CXX and $CC) used.4243# Get the last thing on the line that looks like x.x+ (x is a digit).44COMPILER_REV := \45$(shell $(CXX) -V 2>&1 | sed -n 's/^.*[ ,\t]C++[ ,\t]\([1-9]\.[0-9][0-9]*\).*/\1/p')46CC_COMPILER_REV := \47$(shell $(CC) -V 2>&1 | sed -n 's/^.*[ ,\t]C[ ,\t]\([1-9]\.[0-9][0-9]*\).*/\1/p')4849# Pick which compiler is validated50ifeq ($(JRE_RELEASE_VER),1.6.0)51# Validated compiler for JDK6 is SS11 (5.8)52VALIDATED_COMPILER_REVS := 5.853VALIDATED_CC_COMPILER_REVS := 5.854else55# Validated compiler for JDK7 is SS12 update 1 + patches (5.10)56VALIDATED_COMPILER_REVS := 5.1057VALIDATED_CC_COMPILER_REVS := 5.1058endif5960# Warning messages about not using the above validated versions61ENFORCE_COMPILER_REV${ENFORCE_COMPILER_REV} := $(strip ${VALIDATED_COMPILER_REVS})62ifeq ($(filter ${ENFORCE_COMPILER_REV},${COMPILER_REV}),)63PRINTABLE_CC_REVS := $(subst $(shell echo ' '), or ,${ENFORCE_COMPILER_REV})64dummy_var_to_enforce_compiler_rev := $(shell \65echo >&2 WARNING: You are using CC version ${COMPILER_REV} and \66should be using version ${PRINTABLE_CC_REVS}.; \67echo >&2 Set ENFORCE_COMPILER_REV=${COMPILER_REV} to avoid this \68warning.)69endif7071ENFORCE_CC_COMPILER_REV${ENFORCE_CC_COMPILER_REV} := $(strip ${VALIDATED_CC_COMPILER_REVS})72ifeq ($(filter ${ENFORCE_CC_COMPILER_REV},${CC_COMPILER_REV}),)73PRINTABLE_C_REVS := $(subst $(shell echo ' '), or ,${ENFORCE_CC_COMPILER_REV})74dummy_var_to_enforce_c_compiler_rev := $(shell \75echo >&2 WARNING: You are using cc version ${CC_COMPILER_REV} and \76should be using version ${PRINTABLE_C_REVS}.; \77echo >&2 Set ENFORCE_CC_COMPILER_REV=${CC_COMPILER_REV} to avoid this \78warning.)79endif8081COMPILER_REV_NUMERIC := $(shell echo $(COMPILER_REV) | awk -F. '{ print $$1 * 100 + $$2 }')8283# Fail the build if __fabsf is used. __fabsf exists only in Solaris 8 2/0484# and newer; objects with a dependency on this symbol will not run on older85# Solaris 8.86JVM_FAIL_IF_UNDEFINED = __fabsf8788JVM_CHECK_SYMBOLS = $(NM) -u -p $(LIBJVM.o) | \89$(NAWK) -v f="${JVM_FAIL_IF_UNDEFINED}" \90'BEGIN { c=split(f,s); rc=0; } \91/:$$/ { file = $$1; } \92/[^:]$$/ { for(n=1;n<=c;++n) { \93if($$1==s[n]) { \94printf("JVM_CHECK_SYMBOLS: %s contains illegal symbol %s\n", \95file,$$1); \96rc=1; \97} \98} \99} \100END { exit rc; }'101102LINK_LIB.CXX/PRE_HOOK += $(JVM_CHECK_SYMBOLS) || exit 1;103104# New architecture options started in SS12 (5.9), we need both styles to build.105# The older arch options for SS11 (5.8) or older and also for /usr/ccs/bin/as.106# Note: default for 32bit sparc is now the same as v8plus, so the107# settings below have changed all 32bit sparc builds to be v8plus.108ARCHFLAG_OLD/sparc = -xarch=v8plus109ARCHFLAG_NEW/sparc = -m32 -xarch=sparc110ARCHFLAG_OLD/sparcv9 = -xarch=v9111ARCHFLAG_NEW/sparcv9 = -m64 -xarch=sparc112ARCHFLAG_OLD/i486 =113ARCHFLAG_NEW/i486 = -m32114ARCHFLAG_OLD/amd64 = -xarch=amd64115ARCHFLAG_NEW/amd64 = -m64116117# Select the ARCHFLAGs and other SS12 (5.9) options118ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)119ARCHFLAG/sparc = $(ARCHFLAG_NEW/sparc)120ARCHFLAG/sparcv9 = $(ARCHFLAG_NEW/sparcv9)121ARCHFLAG/i486 = $(ARCHFLAG_NEW/i486)122ARCHFLAG/amd64 = $(ARCHFLAG_NEW/amd64)123else124ARCHFLAG/sparc = $(ARCHFLAG_OLD/sparc)125ARCHFLAG/sparcv9 = $(ARCHFLAG_OLD/sparcv9)126ARCHFLAG/i486 = $(ARCHFLAG_OLD/i486)127ARCHFLAG/amd64 = $(ARCHFLAG_OLD/amd64)128endif129130# ARCHFLAGS for the current build arch131ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))132AS_ARCHFLAG = $(ARCHFLAG_OLD/$(BUILDARCH))133134# Optional sub-directory in /usr/lib where BUILDARCH libraries are kept.135ISA_DIR=$(ISA_DIR/$(BUILDARCH))136ISA_DIR/sparcv9=/sparcv9137ISA_DIR/amd64=/amd64138139# Use these to work around compiler bugs:140OPT_CFLAGS/SLOWER=-xO3141OPT_CFLAGS/O2=-xO2142OPT_CFLAGS/NOOPT=-xO1143144# Flags for creating the dependency files.145ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)146DEPFLAGS = -xMMD -xMF $(DEP_DIR)/$(@:%=%.d)147endif148149# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.150CFLAGS += -DDONT_USE_PRECOMPILED_HEADER151152# Compiler warnings are treated as errors153CFLAGS_WARN = -xwe154155################################################156# Begin current (>=5.9) Forte compiler options #157#################################################158159ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)160ifeq ($(Platform_arch), x86)161OPT_CFLAGS/NO_TAIL_CALL_OPT = -Wu,-O~yz162OPT_CCFLAGS/NO_TAIL_CALL_OPT = -Qoption ube -O~yz163OPT_CFLAGS/stubGenerator_x86_32.o = $(OPT_CFLAGS) -xspace164OPT_CFLAGS/stubGenerator_x86_64.o = $(OPT_CFLAGS) -xspace165endif # Platform_arch == x86166ifeq ("${Platform_arch}", "sparc")167OPT_CFLAGS/stubGenerator_sparc.o = $(OPT_CFLAGS) -xspace168endif169endif # COMPILER_REV_NUMERIC >= 509170171#################################################172# Begin current (>=5.6) Forte compiler options #173#################################################174175ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 506), 1)176177ifeq ("${Platform_arch}", "sparc")178179# We MUST allow data alignment of 4 for sparc (sparcv9 is ok at 8s)180ifndef LP64181CFLAGS += -xmemalign=4s182endif183184endif185186endif187188#################################################189# Begin current (>=5.5) Forte compiler options #190#################################################191192ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 505), 1)193194CFLAGS += $(ARCHFLAG)195AOUT_FLAGS += $(ARCHFLAG)196LIB_FLAGS += $(ARCHFLAG)197LFLAGS += $(ARCHFLAG)198199ifeq ("${Platform_arch}", "sparc")200201# Flags for Optimization202203# [phh] Commented out pending verification that we do indeed want204# to potentially bias against u1 and u3 targets.205#CFLAGS += -xchip=ultra2206207OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS)208209endif # sparc210211ifeq ("${Platform_arch_model}", "x86_32")212213OPT_CFLAGS=-xtarget=pentium -xO4 $(EXTRA_OPT_CFLAGS)214215endif # 32bit x86216217ifeq ("${Platform_arch_model}", "x86_64")218219ASFLAGS += $(AS_ARCHFLAG)220CFLAGS += $(ARCHFLAG/amd64)221# this one seemed useless222LFLAGS_VM += $(ARCHFLAG/amd64)223# this one worked224LFLAGS += $(ARCHFLAG/amd64)225AOUT_FLAGS += $(ARCHFLAG/amd64)226227# -xO3 is faster than -xO4 on specjbb with SS10 compiler228OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS)229230endif # 64bit x86231232# Inline functions233CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_${Platform_arch}/vm/solaris_${Platform_arch_model}.il234235# no more exceptions236CFLAGS/NOEX=-features=no%except237238239# avoid compilation problems arising from fact that C++ compiler tries240# to search for external template definition by just compiling additional241# source files in th same context242CFLAGS += -template=no%extdef243244# Reduce code bloat by reverting back to 5.0 behavior for static initializers245CFLAGS += -features=no%split_init246247# Use -D_Crun_inline_placement so we don't get references to248# __1c2n6FIpv_0_ or void*operator new(unsigned,void*)249# This avoids the hard requirement of the newer Solaris C++ runtime patches.250# NOTE: This is an undocumented feature of the SS10 compiler. See 6306698.251CFLAGS += -D_Crun_inline_placement252253# PIC is safer for SPARC, and is considerably slower254# a file foo.o which wants to compile -pic can set "PICFLAG/foo.o = -PIC"255PICFLAG = -KPIC256PICFLAG/DEFAULT = $(PICFLAG)257# [RGV] Need to figure which files to remove to get link to work258#PICFLAG/BETTER = -pic259PICFLAG/BETTER = $(PICFLAG/DEFAULT)260PICFLAG/BYFILE = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@))261262# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.263MAPFLAG = -M FILENAME264265# Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj266SONAMEFLAG = -h SONAME267268# Build shared library269SHARED_FLAG = -G270271# We don't need libCstd.so and librwtools7.so, only libCrun.so272CFLAGS += -library=%none273LFLAGS += -library=%none274275LFLAGS += -mt276277endif # COMPILER_REV_NUMERIC >= 505278279######################################280# End 5.5 Forte compiler options #281######################################282283######################################284# Begin 5.2 Forte compiler options #285######################################286287ifeq ($(COMPILER_REV_NUMERIC), 502)288289CFLAGS += $(ARCHFLAG)290AOUT_FLAGS += $(ARCHFLAG)291LIB_FLAGS += $(ARCHFLAG)292LFLAGS += $(ARCHFLAG)293294ifeq ("${Platform_arch}", "sparc")295296# Flags for Optimization297298# [phh] Commented out pending verification that we do indeed want299# to potentially bias against u1 and u3 targets.300#CFLAGS += -xchip=ultra2301302ifdef LP64303# SC5.0 tools on v9 are flakey at -xO4304# [phh] Is this still true for 6.1?305OPT_CFLAGS=-xO3 $(EXTRA_OPT_CFLAGS)306else307OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS)308endif309310endif # sparc311312ifeq ("${Platform_arch_model}", "x86_32")313314OPT_CFLAGS=-xtarget=pentium $(EXTRA_OPT_CFLAGS)315316# SC5.0 tools on x86 are flakey at -xO4317# [phh] Is this still true for 6.1?318OPT_CFLAGS+=-xO3319320endif # 32bit x86321322# no more exceptions323CFLAGS/NOEX=-noex324325# Inline functions326CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_${Platform_arch}/vm/solaris_${Platform_arch_model}.il327328# Reduce code bloat by reverting back to 5.0 behavior for static initializers329CFLAGS += -Qoption ccfe -one_static_init330331# PIC is safer for SPARC, and is considerably slower332# a file foo.o which wants to compile -pic can set "PICFLAG/foo.o = -PIC"333PICFLAG = -KPIC334PICFLAG/DEFAULT = $(PICFLAG)335# [RGV] Need to figure which files to remove to get link to work336#PICFLAG/BETTER = -pic337PICFLAG/BETTER = $(PICFLAG/DEFAULT)338PICFLAG/BYFILE = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@))339340# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.341MAPFLAG = -M FILENAME342343# Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj344SONAMEFLAG = -h SONAME345346# Build shared library347SHARED_FLAG = -G348349# Would be better if these weren't needed, since we link with CC, but350# at present removing them causes run-time errors351LFLAGS += -library=Crun352LIBS += -library=Crun -lCrun353354endif # COMPILER_REV_NUMERIC == 502355356##################################357# End 5.2 Forte compiler options #358##################################359360##################################361# Begin old 5.1 compiler options #362##################################363ifeq ($(COMPILER_REV_NUMERIC), 501)364365_JUNK_ := $(shell echo >&2 \366"*** ERROR: sparkWorks.make incomplete for 5.1 compiler")367@exit 1368endif369##################################370# End old 5.1 compiler options #371##################################372373##################################374# Begin old 5.0 compiler options #375##################################376377ifeq (${COMPILER_REV_NUMERIC}, 500)378379# Had to hoist this higher apparently because of other changes. Must380# come before -xarch specification.381# NOTE: native says optimize for the machine doing the compile, bad news.382CFLAGS += -xtarget=native383384CFLAGS += $(ARCHFLAG)385AOUT_FLAGS += $(ARCHFLAG)386LIB_FLAGS += $(ARCHFLAG)387LFLAGS += $(ARCHFLAG)388389CFLAGS += -library=iostream390LFLAGS += -library=iostream -library=Crun391LIBS += -library=iostream -library=Crun -lCrun392393# Flags for Optimization394ifdef LP64395# SC5.0 tools on v9 are flakey at -xO4396OPT_CFLAGS=-xO3 $(EXTRA_OPT_CFLAGS)397else398OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS)399endif400401ifeq ("${Platform_arch}", "sparc")402403CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.il404405endif # sparc406407ifeq ("${Platform_arch_model}", "x86_32")408OPT_CFLAGS=-xtarget=pentium $(EXTRA_OPT_CFLAGS)409ifeq ("${COMPILER_REV_NUMERIC}", "500")410# SC5.0 tools on x86 are flakey at -xO4411OPT_CFLAGS+=-xO3412else413OPT_CFLAGS+=-xO4414endif415416CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_x86/vm/solaris_x86_32.il417418endif # 32bit x86419420# The following options run into misaligned ldd problem (raj)421#OPT_CFLAGS = -fast -O4 $(ARCHFLAG/sparc) -xchip=ultra422423# no more exceptions424CFLAGS/NOEX=-noex425426# PIC is safer for SPARC, and is considerably slower427# a file foo.o which wants to compile -pic can set "PICFLAG/foo.o = -PIC"428PICFLAG = -PIC429PICFLAG/DEFAULT = $(PICFLAG)430# [RGV] Need to figure which files to remove to get link to work431#PICFLAG/BETTER = -pic432PICFLAG/BETTER = $(PICFLAG/DEFAULT)433PICFLAG/BYFILE = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@))434435endif # COMPILER_REV_NUMERIC = 500436437################################438# End old 5.0 compiler options #439################################440441ifeq ("${COMPILER_REV_NUMERIC}", "402")442# 4.2 COMPILERS SHOULD NO LONGER BE USED443_JUNK_ := $(shell echo >&2 \444"*** ERROR: SC4.2 compilers are not supported by this code base!")445@exit 1446endif447448# do not include shared lib path in a.outs449AOUT_FLAGS += -norunpath450LFLAGS_VM = -norunpath -z noversion451452# need position-indep-code for shared libraries453# (ild appears to get errors on PIC code, so we'll try non-PIC for debug)454ifeq ($(PICFLAGS),DEFAULT)455VM_PICFLAG/LIBJVM = $(PICFLAG/DEFAULT)456else457VM_PICFLAG/LIBJVM = $(PICFLAG/BYFILE)458endif459VM_PICFLAG/AOUT =460461VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO))462CFLAGS += $(VM_PICFLAG)463464# less dynamic linking (no PLTs, please)465#LIB_FLAGS += $(LINK_MODE)466# %%%%% despite -znodefs, -Bsymbolic gets link errors -- Rose467468LINK_MODE = $(LINK_MODE/$(VERSION))469LINK_MODE/debug =470LINK_MODE/optimized = -Bsymbolic -znodefs471472# Have thread local errnos473ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 505), 1)474CFLAGS += -mt475else476CFLAGS += -D_REENTRANT477endif478479ifdef CC_INTERP480# C++ Interpreter481CFLAGS += -DCC_INTERP482endif483484# Flags for Debugging485# The -g0 setting allows the C++ frontend to inline, which is a big win.486# The -xs setting disables 'lazy debug info' which puts everything in487# the .so instead of requiring the '.o' files.488ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)489OPT_CFLAGS += -g0 -xs490endif491DEBUG_CFLAGS = -g492FASTDEBUG_CFLAGS = -g0493ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)494DEBUG_CFLAGS += -xs495FASTDEBUG_CFLAGS += -xs496endif497498# Special global options for SS12499ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)500# There appears to be multiple issues with the new Dwarf2 debug format, so501# we tell the compiler to use the older 'stabs' debug format all the time.502# Note that this needs to be used in optimized compiles too to be 100%.503# This is a workaround for SS12 (5.9) bug 6694600504CFLAGS += -xdebugformat=stabs505endif506507# Enable the following CFLAGS additions if you need to compare the508# built ELF objects.509#510# The -g option makes static data global and the "-Qoption ccfe511# -xglobalstatic" option tells the compiler to not globalize static512# data using a unique globalization prefix. Instead force the use of513# a static globalization prefix based on the source filepath so the514# objects from two identical compilations are the same.515# EXTRA_CFLAGS only covers vm_version.cpp for some reason516#EXTRA_CFLAGS += -Qoption ccfe -xglobalstatic517#OPT_CFLAGS += -Qoption ccfe -xglobalstatic518#DEBUG_CFLAGS += -Qoption ccfe -xglobalstatic519#FASTDEBUG_CFLAGS += -Qoption ccfe -xglobalstatic520521ifeq (${COMPILER_REV_NUMERIC}, 502)522COMPILER_DATE := $(shell $(CXX) -V 2>&1 | sed -n '/^.*[ ]C++[ ]\([1-9]\.[0-9][0-9]*\)/p' | awk '{ print $$NF; }')523ifeq (${COMPILER_DATE}, 2001/01/31)524# disable -g0 in fastdebug since SC6.1 dated 2001/01/31 seems to be buggy525# use an innocuous value because it will get -g if it's empty526FASTDEBUG_CFLAGS = -c527endif528endif529530# Uncomment or 'gmake CFLAGS_BROWSE=-sbfast' to get source browser information.531# CFLAGS_BROWSE = -sbfast532CFLAGS += $(CFLAGS_BROWSE)533534# ILD is gone as of SS11 (5.8), not supportted in SS10 (5.7)535ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \< 507), 1)536# use ild when debugging (but when optimizing we want reproducible results)537ILDFLAG = $(ILDFLAG/$(VERSION))538ILDFLAG/debug = -xildon539ILDFLAG/optimized =540AOUT_FLAGS += $(ILDFLAG)541endif542543# Where to put the *.o files (a.out, or shared library)?544LINK_INTO = $(LINK_INTO/$(VERSION))545LINK_INTO/debug = LIBJVM546LINK_INTO/optimized = LIBJVM547548# We link the debug version into the a.out because:549# 1. ild works on a.out but not shared libraries, and using ild550# can cut rebuild times by 25% for small changes. (ILD is gone in SS11)551# 2. dbx cannot gracefully set breakpoints in shared libraries552#553554# apply this setting to link into the shared library even in the debug version:555ifdef LP64556LINK_INTO = LIBJVM557else558#LINK_INTO = LIBJVM559endif560561# Solaris platforms collect lots of redundant file-ident lines,562# to the point of wasting a significant percentage of file space.563# (The text is stored in ELF .comment sections, contributed by564# all "#pragma ident" directives in header and source files.)565# This command "compresses" the .comment sections simply by566# removing repeated lines. The data can be extracted from567# binaries in the field by using "mcs -p libjvm.so" or the older568# command "what libjvm.so".569LINK_LIB.CXX/POST_HOOK += $(MCS) -c $@ || exit 1;570# (The exit 1 is necessary to cause a build failure if the command fails and571# multiple commands are strung together, and the final semicolon is necessary572# since the hook must terminate itself as a valid command.)573574# Also, strip debug and line number information (worth about 1.7Mb).575# If we can create .debuginfo files, then the VM is stripped in vm.make576# and this macro is not used.577STRIP_LIB.CXX/POST_HOOK = $(STRIP) -x $@ || exit 1;578# STRIP_LIB.CXX/POST_HOOK is incorporated into LINK_LIB.CXX/POST_HOOK579# in certain configurations, such as product.make. Other configurations,580# such as debug.make, do not include the strip operation.581582583