Defs-solaris.gmk revision 4956
2362N/A# Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. 0N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A# This code is free software; you can redistribute it and/or modify it 0N/A# under the terms of the GNU General Public License version 2 only, as 0N/A# published by the Free Software Foundation. Oracle designates this 0N/A# particular file as subject to the "Classpath" exception as provided 0N/A# by Oracle in the LICENSE file that accompanied this code. 0N/A# This code is distributed in the hope that it will be useful, but WITHOUT 0N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A# version 2 for more details (a copy is included in the LICENSE file that 0N/A# accompanied this code). 0N/A# You should have received a copy of the GNU General Public License version 0N/A# 2 along with this work; if not, write to the Free Software Foundation, 2362N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A# Makefile to specify compiler flags for programs and libraries 0N/A# targeted to Solaris. Should not contain any rules. 0N/A# WARNING: This file is shared with other workspaces. 0N/A# So when it includes other files, it must use JDK_TOPDIR. 0N/A# Warning: the following variables are overridden by Defs.gmk. Set 0N/A# values will be silently ignored: 0N/A# CFLAGS (set $(OTHER_CFLAGS) instead) 0N/A# CPPFLAGS (set $(OTHER_CPPFLAGS) instead) 0N/A# CXXFLAGS (set $(OTHER_CXXFLAGS) instead) 0N/A# LDFLAGS (set $(OTHER_LDFAGS) instead) 0N/A# LDLIBS (set $(EXTRA_LIBS) instead) 0N/A# LDLIBS_COMMON (set $(EXTRA_LIBS) instead) 0N/A# LINTFLAGS (set $(OTHER_LINTFLAGS) instead) 0N/A# Note: CPPFLAGS are used in C and C++ compiles. 0N/A# Get shared JDK settings 0N/A# Platform specific closed sources 0N/A# platform specific include files 0N/A# suffix used for make dependencies files 0N/A# suffix used for lint files 0N/A# The suffix applied to the library name for FDLIBM 0N/A# The suffix applied to scripts (.bat for windows, nothing for unix) 0N/A# CC compiler object code output directive flag value 0N/A# The Full Debug Symbols (FDS) default for VARIANT == OPT builds is 0N/A# enabled with debug info files ZIP'ed to save space. For VARIANT != 0N/A# OPT builds, FDS is always enabled, after all a debug build without 0N/A# debug info isn't very useful. The ZIP_DEBUGINFO_FILES option only has 0N/A# meaning when FDS is enabled. 0N/A# If you invoke a build with FULL_DEBUG_SYMBOLS=0, then FDS will be 0N/A# disabled for a VARIANT == OPT build. 0N/A# Note: Use of a different variable name for the FDS override option 0N/A# versus the FDS enabled check is intentional (FULL_DEBUG_SYMBOLS 0N/A# versus ENABLE_FULL_DEBUG_SYMBOLS). For auto build systems that pass 0N/A# in options via environment variables, use of distinct variables 0N/A# prevents strange behaviours. For example, in a VARIANT != OPT build, 0N/A# the FULL_DEBUG_SYMBOLS environment variable will be 0, but the # ENABLE_FULL_DEBUG_SYMBOLS make variable will be 1. If the same # variable name is used, then different values can be picked up by # different parts of the build. Just to be clear, we only need two # variable names because the incoming option value can be overridden # in some situations, e.g., a VARIANT != OPT build. # debug variants always get Full Debug Symbols (if available) # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later # Default OBJCOPY comes from the SUNWbinutils package: # On Solaris AMD64/X64, gobjcopy is not happy and fails: # BFD: stKPaiop: Not enough room for program headers, try linking with -N # BFD: stKPaiop: Not enough room for program headers, try linking with -N # BFD: stKPaiop: Not enough room for program headers, try linking with -N # disable .debuginfo support by setting ALT_OBJCOPY to a non-existent path # Setting ENABLE_FULL_DEBUG_SYMBOLS=1 (and OBJCOPY) above enables the # JDK build to import .debuginfo or .diz files from the HotSpot build. # However, adding FDS support to the JDK build will occur in phases # so a different make variable (LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS # and PROGRAM_SUPPORTS_FULL_DEBUG_SYMBOLS) is used to indicate that a # particular library or program supports FDS. echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files.") echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.") # Library stripping policies for .debuginfo configs: # all_strip - strips everything from the library # min_strip - strips most stuff from the library; leaves minimum symbols # no_strip - does not strip the library at all # Oracle security policy requires "all_strip". A waiver was granted on # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE. # Currently, STRIP_POLICY is only used when Full Debug Symbols is enabled. # HACK: disable ZIP_DEBUGINFO_FILES by default until install repo # Java default optimization (-x04/-O2) etc. Applies to the VM. # If -Xa is in CFLAGS_COMMON it will end up ahead of $(CC_OPT) for the # optimized build, and that ordering of the flags completely freaks # out cc. Hence, -Xa is instead in each CFLAGS variant. # The more unusual options to the Sun C compiler: # -v Stricter type checking, more error checking # (To turn ALL warnings into fatals, use -errwarn=%all) # -xstrconst Place string literals and constants in read-only area # (means you can't write on your string literals) # -xs Force debug information (stabs) into the .so or a.out # .o files needing to be around, but at a space cost) # -g & -O If you add the -g option to the optimized compiles # you will get better stack retraces, the code is # still optimized. This includes a space cost too. # -xc99=%none Do NOT allow for c99 extensions to be used. # e.g. declarations must precede statements # -xCC Allow the C++ style of comments in C: // # Required with many of the source files. # -mt Assume multi-threaded (important) # The more unusual options to the Sun C compiler: # Debug flag for C and C++ compiler # Turn off -g if we are doing tcov build # FASTDEBUG: Optimize the -g builds, gives us a faster debug java # If true adds -O to the debug compiles. This allows for any assert # tests to remain and debug checking. The resulting code is faster # but less debuggable. Stack traces are still valid, although only # approximate line numbers are given. Printing of local variables # during a debugging session is not possible, but stepping and # printing of global or static variables should be possible. # If Full Debug Symbols is enabled, then we want the same debug and # optimization flags as used by FASTDEBUG. We also want all the # debug info in one place (-xs). # Do not allow C99 language features like declarations in code etc. # Allow C++ comments in C code # Show error message tags on errors # Required C compiler flags # Maximum warnings all the time # Assume MT behavior all the time (important) # Assume no C++ exceptions are used # For C++, these options tell it to assume nothing about locating libraries # either at compile time, or at runtime. Use of these options will likely # require the use of -L and -R options to indicate where libraries will # be found at compile time (-L) and at runtime (-R). # The /usr/lib location comes for free, so no need to specify that one. # Note: C is much simplier and there is no need for these options. This # is mostly needed to avoid dependencies on libraries in the # Compiler install area, also see LIBCXX and LIBM. # Treat compiler warnings as errors, if requested # Add -xstrconst to the library compiles. This forces all string # literals into the read-only data section, which prevents them from # being written to and increases the runtime pages shared on the system. # Source browser database # If defined adds -xsb to compiles and creates a # source browsing database during compilation. # -Xa ANSI C plus K&R, favor ANSI rules # -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) # -errchk=parentheses report on suggested use of extra parens # -v suppress unused args # -x suppress unused externs # -errfmt=simple use one line errors with position info # The -W0,-noglobal tells the compiler to NOT generate mangled global # ELF data symbols for file local static data. # This can break fix&continue, but we'd rather do the same compilations # for deliverable bits as we do for non-deliverable bits # Tell the compilers to never generate globalized names, all the time. # If we have a specific arch value to use, add it # uncomment the following to build with PERTURBALOT set # OTHER_CFLAGS += -DPERTURBALOT # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the # Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN # Note: -Dmacro is the same as #define macro 1 # -Dmacro= is the same as #define macro # Turn off a superfluous compiler error message on Intel # Java memory management is based on memory mapping by default, but a # system only assuming malloc/free can be built by adding -DUSE_MALLOC # -L paths for finding and -ljava # We never really want the incremental linker, ever # The -xildoff option tells Sun's compilers to NOT use incremental linker # Libraries need to locate other libraries at runtime, and you can tell # a library where to look by way of the dynamic runpaths (RPATH or RUNPATH) # buried inside the .so. The $ORIGIN says to look relative to where # the library itself is and it can be followed with relative paths from # that. By default we always look in $ORIGIN, optionally we add relative # paths if the Makefile sets LD_RUNPATH_EXTRAS to those relative paths. # The environment variable LD_LIBRARY_PATH will over-ride these runpaths. # Try: 'dump -Lv lib*.so' to see these settings in a library. # Postprocessing is done on the images directories only # Debug 'strip -x' leaves local function Elf symbols (better stack traces) # Sun C compiler will take -M and pass it on to ld. # Usage: ld $(LD_MAPFILE_FLAG) mapfile *.o # Variables globally settable from the make command line (default # Eg: % gnumake GPROF=true # PARTIAL_GPROF is to be used ONLY during compilation - it should not # appear during linking of libraries or programs. It also should # prevent linking with -z defs to allow a symbol to remain undefined. # For a TCOV build we add in the TCOV_OPTION # Solaris only uses native threads. # Different "levels" of optimization. # Automatic precompiled header option to use (if COMPILE_APPROACH=batch) # (See Rules.gmk) May need to wait for gcc 5? # Highest could be -xO5, but indications are that -xO5 should be reserved # for a per-file use, on sources with known performance impacts. # We need stack frames at all times # Unknown spelling on this option at this time (Maybe in SS13?) # On X86, make sure tail call optimization is off # The z and y are the tail call optimizations. # Somehow, tail call optimization is creeping in. # WARNING: These may cause compiler warnings about duplicate -O options # On i586 we need to tell the code generator to ALWAYS use a # Note that in 5.7, this is done with -xregs=no%frameptr # It's not exactly clear when this optimization kicks in, the # current assumption is -xO4 or greater and for C++ with # the -features=no%except option and -xO4 and greater. # Bottom line is, we ALWAYS want a frame pointer! # Do NOT use frame pointer register as a general purpose opt register # Optimizer for sparc needs to be told not to do certain things # related to frames or save instructions. # Do not use save instructions instead of add instructions # This was an optimization starting in SC5.0 that made it hard for us to # find the "save" instruction (which got turned into an "add") # Don't allow tail call code optimization. Started in SC5.0. # We don't like code of this form: # because we can't tell if the method will have a stack frame # and register windows or not. # Extra options used with HIGHEST # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be # done with care, there are some assumptions below that need to # be understood about the use of pointers, and IEEE behavior. # Use non-standard floating point mode (not IEEE 754) # Do some simplification of floating point arithmetic (not IEEE 754) # Use single precision floating point with 'float' # Assume memory references via basic pointer types do not alias # (Source with excessing pointer casting and data access with mixed # pointer types are not recommended) # Use intrinsic or inline versions for math/std functions # (If you expect perfect errno behavior, do not use this) # Loop data dependency optimizations (need -xO3 or higher) # Pointer parameters to functions do not overlap # (Similar to -xalias_level=basic usage, but less obvious sometimes. # If you pass in multiple pointers to the same data, do not use this) # Inline some library routines # (If you expect perfect errno behavior, do not use this) # Use optimized math routines # (If you expect perfect errno behavior, do not use this) # Can cause undefined external on Solaris 8 X86 on __sincos, removing for now # CC_HIGHEST_EXTRAS += -xlibmopt # Assume at most 8byte alignment, raise SIGBUS on error ### Presents an ABI issue with customer JNI libs? ####CC_HIGHEST_EXTRAS += -xmemalign=8s # Automatic prefetch instructions, explicit prefetch macros # Pick ultra as the chip to optimize to # Pick pentium as the chip to optimize to # The Solaris CBE (Common Build Environment) requires that the use # of appl registers be disabled when compiling a public library (or # a library that's loaded by a public library) on sparc. # Presents an ABI issue with customer JNI libs? We must be able to # to handle 4byte aligned objects? (rare occurance, but possible?) # Just incase someone trys to use the SOS9 compilers # We MUST allow data alignment of 4 for sparc (sparcv9 is ok at 8s) # Automatic precompiled header option to use (if COMPILE_APPROACH=batch) # (See Rules.gmk) The SS11 -xpch=auto* options appear to be broken. # Add in keep frame options # Add in highest optimization settings # Default optimization settings based on level. # Flags required all the time # Path and option to link against the VM, if you have to. Note that # there are libraries that link against only -ljava, but they do get # -L to the -ljvm, this is because -ljava depends on -ljvm, whereas # the library itself should not. # Part of INCREMENTAL_BUILD mechanism. # In addition on Solaris, any include file starting with / is deleted, # this gets rid of things like /usr/include files, which never change. CC_DEPEND_FILTER =
$(SED) -e
'/:[ ]*[/]/d' -e
's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g' |
$(SORT) -u
# Location of openwin libraries (do we really need this anymore?) # Runtime graphics library search paths... # C++ Runtime library (libCrun.so), use instead of -lCrun. # Originally used instead of -lCrun to guarantee use of the system # .so version and not the .a or .so that came with the compilers. # With the newer compilers this could probably change back to -lCrun but # in general this is ok to continue to do. # JDK now requires Solaris 10, so pick up libm.so.2 # Network Services library # service configuration facility library # Dynamic Loading library # GLOBAL_KPIC: If set means all libraries are PIC, position independent code # EXCEPT for select compiles # If a .o file is compiled non-PIC then it should be forced # into the RW data segment with a mapfile option. This is done # with object files which generated from .s files. # The -ztext enforces that no relocations remain in the text segment # so that it remains purely read-only for optimum system performance. # Some libraries may use a smaller size (13bit -Kpic) on sparc instead of # (32 bit -KPIC) and will override GLOBAL_KPIC appropriately. # If your platform has DPS, it will have Type1 fonts too, in which case # it is best to enable DPS support until such time as 2D's rasteriser # can fully handle Type1 fonts in all cases. Default is "yes". # HAVE_DPS should only be "no" if the platform has no DPS headers or libs # DPS (Displayable PostScript) is available on Solaris machines # Settings for the JDI - Serviceability Agent binding.