annotate make/solaris/makefiles/gcc.make @ 6031:6e4b0b4481b9

Merge from main OpenJDK repository
author Greg Lewis <glewis@eyesbeyond.com>
date Sat, 03 Feb 2018 14:01:55 -0800
parents 7292cff45988
children
rev   line source
duke@0 1 #
brutisso@3084 2 # Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
duke@0 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 #
duke@0 5 # This code is free software; you can redistribute it and/or modify it
duke@0 6 # under the terms of the GNU General Public License version 2 only, as
duke@0 7 # published by the Free Software Foundation.
duke@0 8 #
duke@0 9 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 # version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 # accompanied this code).
duke@0 14 #
duke@0 15 # You should have received a copy of the GNU General Public License version
duke@0 16 # 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 #
trims@1563 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1563 20 # or visit www.oracle.com if you need additional information or have any
trims@1563 21 # questions.
duke@0 22 #
duke@0 23 #
duke@0 24
duke@0 25 #------------------------------------------------------------------------
erikj@3391 26 # CC, CXX & AS
duke@0 27
erikj@3840 28 # If a SPEC is not set already, then use these defaults.
erikj@3840 29 ifeq ($(SPEC),)
erikj@3840 30 CXX = g++
erikj@3840 31 CC = gcc
erikj@3840 32 AS = $(CC) -c
erikj@3840 33 MCS = /usr/ccs/bin/mcs
erikj@3840 34 endif
duke@0 35
duke@0 36 Compiler = gcc
duke@0 37
duke@0 38 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
duke@0 39 # prints the numbers (e.g. "2.95", "3.2.1")
duke@0 40 CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
duke@0 41 CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
duke@0 42
erikj@3391 43 # Check for the versions of C++ and C compilers ($CXX and $CC) used.
duke@0 44
duke@0 45 # Get the last thing on the line that looks like x.x+ (x is a digit).
duke@0 46 COMPILER_REV := \
erikj@3391 47 $(shell $(CXX) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
erikj@3391 48 CC_COMPILER_REV := \
duke@0 49 $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
duke@0 50
duke@0 51
duke@0 52 # check for precompiled headers support
duke@0 53 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
stefank@2003 54 # Allow the user to turn off precompiled headers from the command line.
stefank@2003 55 ifneq ($(USE_PRECOMPILED_HEADER),0)
duke@0 56 PRECOMPILED_HEADER_DIR=.
brutisso@3084 57 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
stefank@1992 58 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
duke@0 59 endif
stefank@2003 60 endif
duke@0 61
duke@0 62
duke@0 63 #------------------------------------------------------------------------
duke@0 64 # Compiler flags
duke@0 65
duke@0 66 # position-independent code
duke@0 67 PICFLAG = -fPIC
duke@0 68
duke@0 69 VM_PICFLAG/LIBJVM = $(PICFLAG)
duke@0 70 VM_PICFLAG/AOUT =
duke@0 71 VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO))
duke@0 72
duke@0 73 CFLAGS += $(VM_PICFLAG)
duke@0 74 CFLAGS += -fno-rtti
duke@0 75 CFLAGS += -fno-exceptions
duke@0 76 CFLAGS += -D_REENTRANT
duke@0 77 CFLAGS += -fcheck-new
duke@0 78
duke@0 79 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
duke@0 80
duke@0 81 ARCHFLAG/sparc = -m32 -mcpu=v9
duke@0 82 ARCHFLAG/sparcv9 = -m64 -mcpu=v9
duke@0 83 ARCHFLAG/i486 = -m32 -march=i586
duke@0 84 ARCHFLAG/amd64 = -m64 -march=k8
duke@0 85
duke@0 86
duke@0 87 # Optional sub-directory in /usr/lib where BUILDARCH libraries are kept.
duke@0 88 ISA_DIR=$(ISA_DIR/$(BUILDARCH))
duke@0 89 ISA_DIR/amd64=/amd64
duke@0 90 ISA_DIR/i486=
duke@0 91 ISA_DIR/sparcv9=/64
duke@0 92
duke@0 93
duke@0 94 CFLAGS += $(ARCHFLAG)
duke@0 95 AOUT_FLAGS += $(ARCHFLAG)
duke@0 96 LFLAGS += $(ARCHFLAG)
duke@0 97 ASFLAGS += $(ARCHFLAG)
duke@0 98
duke@0 99 ifeq ($(BUILDARCH), amd64)
duke@0 100 ASFLAGS += -march=k8 -march=amd64
duke@0 101 LFLAGS += -march=k8
duke@0 102 endif
duke@0 103
duke@0 104
duke@0 105 # Use C++ Interpreter
duke@0 106 ifdef CC_INTERP
duke@0 107 CFLAGS += -DCC_INTERP
duke@0 108 endif
duke@0 109
duke@0 110 # Keep temporary files (.ii, .s)
duke@0 111 ifdef NEED_ASM
duke@0 112 CFLAGS += -save-temps
duke@0 113 else
duke@0 114 CFLAGS += -pipe
duke@0 115 endif
duke@0 116
duke@0 117
duke@0 118 # Compiler warnings are treated as errors
duke@0 119 WARNINGS_ARE_ERRORS = -Werror
duke@0 120 # Enable these warnings. See 'info gcc' about details on these options
duke@0 121 ADDITIONAL_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare
duke@0 122 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ADDITIONAL_WARNINGS)
duke@0 123 # Special cases
duke@0 124 CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))
duke@0 125
duke@0 126 # The flags to use for an Optimized g++ build
duke@0 127 OPT_CFLAGS += -O3
duke@0 128
duke@0 129 # Hotspot uses very unstrict aliasing turn this optimization off
duke@0 130 OPT_CFLAGS += -fno-strict-aliasing
duke@0 131
duke@0 132 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp
duke@0 133 # if we use expensive-optimizations
duke@0 134 # Note: all ia64 setting reflect the ones for linux
duke@0 135 # No actial testing was performed: there is no Solaris on ia64 presently
duke@0 136 ifeq ($(BUILDARCH), ia64)
duke@0 137 OPT_CFLAGS/bytecodeInterpreter.o += -fno-expensive-optimizations
duke@0 138 endif
duke@0 139
duke@0 140 OPT_CFLAGS/NOOPT=-O0
stefank@1992 141
stefank@1992 142 # Flags for generating make dependency flags.
stefank@1992 143 ifneq ("${CC_VER_MAJOR}", "2")
kamg@4068 144 DEPFLAGS = -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
stefank@1992 145 endif
stefank@1992 146
stefank@2003 147 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
stefank@3185 148 ifeq ($(USE_PRECOMPILED_HEADER),0)
stefank@2003 149 CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
stefank@2003 150 endif
stefank@2003 151
duke@0 152 #------------------------------------------------------------------------
duke@0 153 # Linker flags
duke@0 154
duke@0 155 # statically link libstdc++.so, work with gcc but ignored by g++
duke@0 156 STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
duke@0 157
duke@0 158 # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
duke@0 159 ifneq ("${CC_VER_MAJOR}", "2")
duke@0 160 STATIC_LIBGCC += -static-libgcc
duke@0 161 endif
duke@0 162
duke@0 163 ifeq ($(BUILDARCH), ia64)
duke@0 164 # Note: all ia64 setting reflect the ones for linux
duke@0 165 # No actial testing was performed: there is no Solaris on ia64 presently
duke@0 166 LFLAGS += -Wl,-relax
duke@0 167 endif
duke@0 168
duke@0 169 ifdef USE_GNULD
duke@0 170 # Enable linker optimization
duke@0 171 LFLAGS += -Xlinker -O1
duke@0 172
duke@0 173 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
duke@0 174 MAPFLAG = -Xlinker --version-script=FILENAME
duke@0 175 else
duke@0 176 MAPFLAG = -Xlinker -M -Xlinker FILENAME
duke@0 177 endif
duke@0 178
duke@0 179 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
duke@0 180 SONAMEFLAG = -Xlinker -soname=SONAME
duke@0 181
duke@0 182 # Build shared library
duke@0 183 SHARED_FLAG = -shared
duke@0 184
duke@0 185 #------------------------------------------------------------------------
duke@0 186 # Debug flags
duke@0 187
duke@0 188 # Use the stabs format for debugging information (this is the default
duke@0 189 # on gcc-2.91). It's good enough, has all the information about line
duke@0 190 # numbers and local variables, and libjvm_g.so is only about 16M.
duke@0 191 # Change this back to "-g" if you want the most expressive format.
duke@0 192 # (warning: that could easily inflate libjvm_g.so to 150M!)
duke@0 193 # Note: The Itanium gcc compiler crashes when using -gstabs.
duke@0 194 DEBUG_CFLAGS/ia64 = -g
duke@0 195 DEBUG_CFLAGS/amd64 = -g
duke@0 196 DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
duke@0 197 ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
duke@0 198 DEBUG_CFLAGS += -gstabs
duke@0 199 endif