Wed, 13 Mar 2013 15:15:56 -0400
8009829: CDS: JDK JPRT test fails crash in Symbol::equals()
Summary: -Xshare:dump was creating a Symbol in C_heap. There's an assert there that jdk jprt wasn't hitting because it was only done in product
Reviewed-by: dholmes, hseigel, iklam
duke@435 | 1 | # |
dcubed@3724 | 2 | # Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | # |
duke@435 | 5 | # This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | # under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | # published by the Free Software Foundation. |
duke@435 | 8 | # |
duke@435 | 9 | # This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | # version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | # accompanied this code). |
duke@435 | 14 | # |
duke@435 | 15 | # You should have received a copy of the GNU General Public License version |
duke@435 | 16 | # 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | # |
trims@1907 | 19 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | # or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | # questions. |
duke@435 | 22 | # |
duke@435 | 23 | # |
duke@435 | 24 | |
duke@435 | 25 | #------------------------------------------------------------------------ |
erikj@3518 | 26 | # CC, CXX & AS |
duke@435 | 27 | |
erikj@3600 | 28 | # If a SPEC is not set already, then use these defaults. |
erikj@3600 | 29 | ifeq ($(SPEC),) |
erikj@3600 | 30 | # When cross-compiling the ALT_COMPILER_PATH points |
erikj@3600 | 31 | # to the cross-compilation toolset |
erikj@3600 | 32 | ifdef CROSS_COMPILE_ARCH |
erikj@3600 | 33 | CXX = $(ALT_COMPILER_PATH)/g++ |
erikj@3600 | 34 | CC = $(ALT_COMPILER_PATH)/gcc |
erikj@3600 | 35 | HOSTCXX = g++ |
erikj@3600 | 36 | HOSTCC = gcc |
erikj@3600 | 37 | STRIP = $(ALT_COMPILER_PATH)/strip |
erikj@3600 | 38 | else |
erikj@3600 | 39 | CXX = g++ |
erikj@3600 | 40 | CC = gcc |
erikj@3600 | 41 | HOSTCXX = $(CXX) |
erikj@3600 | 42 | HOSTCC = $(CC) |
erikj@3600 | 43 | STRIP = strip |
erikj@3600 | 44 | endif |
erikj@3600 | 45 | AS = $(CC) -c |
bobv@2036 | 46 | endif |
bobv@2036 | 47 | |
duke@435 | 48 | |
duke@435 | 49 | # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only |
duke@435 | 50 | # prints the numbers (e.g. "2.95", "3.2.1") |
duke@435 | 51 | CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1) |
duke@435 | 52 | CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2) |
duke@435 | 53 | |
duke@435 | 54 | # check for precompiled headers support |
duke@435 | 55 | ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0" |
stefank@2325 | 56 | # Allow the user to turn off precompiled headers from the command line. |
stefank@2325 | 57 | ifneq ($(USE_PRECOMPILED_HEADER),0) |
duke@435 | 58 | PRECOMPILED_HEADER_DIR=. |
brutisso@3229 | 59 | PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp |
stefank@2314 | 60 | PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch |
duke@435 | 61 | endif |
stefank@2325 | 62 | endif |
duke@435 | 63 | |
duke@435 | 64 | |
duke@435 | 65 | #------------------------------------------------------------------------ |
duke@435 | 66 | # Compiler flags |
duke@435 | 67 | |
duke@435 | 68 | # position-independent code |
duke@435 | 69 | PICFLAG = -fPIC |
duke@435 | 70 | |
duke@435 | 71 | VM_PICFLAG/LIBJVM = $(PICFLAG) |
duke@435 | 72 | VM_PICFLAG/AOUT = |
duke@435 | 73 | VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO)) |
duke@435 | 74 | |
erikj@3649 | 75 | ifeq ($(JVM_VARIANT_ZERO), true) |
never@1445 | 76 | CFLAGS += $(LIBFFI_CFLAGS) |
never@1445 | 77 | endif |
erikj@3649 | 78 | ifeq ($(JVM_VARIANT_ZEROSHARK), true) |
erikj@3649 | 79 | CFLAGS += $(LIBFFI_CFLAGS) |
twisti@2047 | 80 | CFLAGS += $(LLVM_CFLAGS) |
twisti@2047 | 81 | endif |
duke@435 | 82 | CFLAGS += $(VM_PICFLAG) |
duke@435 | 83 | CFLAGS += -fno-rtti |
duke@435 | 84 | CFLAGS += -fno-exceptions |
duke@435 | 85 | CFLAGS += -D_REENTRANT |
duke@435 | 86 | CFLAGS += -fcheck-new |
coleenp@2507 | 87 | # version 4 and above support fvisibility=hidden (matches jni_x86.h file) |
coleenp@2507 | 88 | # except 4.1.2 gives pointless warnings that can't be disabled (afaik) |
coleenp@2507 | 89 | ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" |
coleenp@2507 | 90 | CFLAGS += -fvisibility=hidden |
coleenp@2507 | 91 | endif |
duke@435 | 92 | |
duke@435 | 93 | ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) |
duke@435 | 94 | ARCHFLAG/i486 = -m32 -march=i586 |
duke@435 | 95 | ARCHFLAG/amd64 = -m64 |
duke@435 | 96 | ARCHFLAG/ia64 = |
duke@435 | 97 | ARCHFLAG/sparc = -m32 -mcpu=v9 |
duke@435 | 98 | ARCHFLAG/sparcv9 = -m64 -mcpu=v9 |
bobv@2036 | 99 | ARCHFLAG/arm = -fsigned-char |
never@1445 | 100 | ARCHFLAG/zero = $(ZERO_ARCHFLAG) |
bobv@2036 | 101 | ifndef E500V2 |
bobv@2036 | 102 | ARCHFLAG/ppc = -mcpu=powerpc |
bobv@2036 | 103 | endif |
duke@435 | 104 | |
duke@435 | 105 | CFLAGS += $(ARCHFLAG) |
duke@435 | 106 | AOUT_FLAGS += $(ARCHFLAG) |
duke@435 | 107 | LFLAGS += $(ARCHFLAG) |
duke@435 | 108 | ASFLAGS += $(ARCHFLAG) |
duke@435 | 109 | |
bobv@2036 | 110 | ifdef E500V2 |
bobv@2036 | 111 | CFLAGS += -DE500V2 |
bobv@2036 | 112 | endif |
bobv@2036 | 113 | |
duke@435 | 114 | # Use C++ Interpreter |
duke@435 | 115 | ifdef CC_INTERP |
duke@435 | 116 | CFLAGS += -DCC_INTERP |
duke@435 | 117 | endif |
duke@435 | 118 | |
duke@435 | 119 | # Keep temporary files (.ii, .s) |
duke@435 | 120 | ifdef NEED_ASM |
duke@435 | 121 | CFLAGS += -save-temps |
duke@435 | 122 | else |
duke@435 | 123 | CFLAGS += -pipe |
duke@435 | 124 | endif |
duke@435 | 125 | |
duke@435 | 126 | # Compiler warnings are treated as errors |
duke@435 | 127 | WARNINGS_ARE_ERRORS = -Werror |
xlu@664 | 128 | |
duke@435 | 129 | # Except for a few acceptable ones |
xlu@664 | 130 | # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit |
xlu@664 | 131 | # conversions which might affect the values. To avoid that, we need to turn |
xlu@664 | 132 | # it off explicitly. |
xlu@664 | 133 | ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" |
xlu@664 | 134 | ACCEPTABLE_WARNINGS = -Wpointer-arith -Wsign-compare |
xlu@664 | 135 | else |
duke@435 | 136 | ACCEPTABLE_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare |
xlu@664 | 137 | endif |
xlu@664 | 138 | |
duke@435 | 139 | CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ACCEPTABLE_WARNINGS) |
duke@435 | 140 | # Special cases |
duke@435 | 141 | CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) |
duke@435 | 142 | |
duke@435 | 143 | # The flags to use for an Optimized g++ build |
jprovino@4165 | 144 | OPT_CFLAGS/SIZE=-Os |
jprovino@4165 | 145 | OPT_CFLAGS/SPEED=-O3 |
duke@435 | 146 | |
duke@435 | 147 | # Hotspot uses very unstrict aliasing turn this optimization off |
jprovino@4165 | 148 | # This option is added to CFLAGS rather than OPT_CFLAGS |
jprovino@4165 | 149 | # so that OPT_CFLAGS overrides get this option too. |
jprovino@4165 | 150 | CFLAGS += -fno-strict-aliasing |
jprovino@4165 | 151 | |
jprovino@4165 | 152 | OPT_CFLAGS_DEFAULT ?= SPEED |
jprovino@4165 | 153 | |
jprovino@4165 | 154 | ifdef OPT_CFLAGS |
jprovino@4165 | 155 | ifneq ("$(origin OPT_CFLAGS)", "command line") |
jprovino@4165 | 156 | $(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.") |
jprovino@4165 | 157 | endif |
jprovino@4165 | 158 | endif |
jprovino@4165 | 159 | |
jprovino@4165 | 160 | OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS) |
duke@435 | 161 | |
duke@435 | 162 | # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp |
duke@435 | 163 | # if we use expensive-optimizations |
duke@435 | 164 | ifeq ($(BUILDARCH), ia64) |
duke@435 | 165 | OPT_CFLAGS += -fno-expensive-optimizations |
duke@435 | 166 | endif |
duke@435 | 167 | |
duke@435 | 168 | OPT_CFLAGS/NOOPT=-O0 |
duke@435 | 169 | |
kvn@1179 | 170 | # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation. |
kvn@1179 | 171 | ifneq "$(shell expr \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) = 3 \) \))" "0" |
kvn@1179 | 172 | OPT_CFLAGS/mulnode.o += -O0 |
kvn@1179 | 173 | endif |
kvn@1179 | 174 | |
stefank@2314 | 175 | # Flags for generating make dependency flags. |
stefank@2314 | 176 | ifneq ("${CC_VER_MAJOR}", "2") |
kamg@3832 | 177 | DEPFLAGS = -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d) |
stefank@2314 | 178 | endif |
stefank@2314 | 179 | |
stefank@2325 | 180 | # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp. |
stefank@3325 | 181 | ifeq ($(USE_PRECOMPILED_HEADER),0) |
stefank@2325 | 182 | CFLAGS += -DDONT_USE_PRECOMPILED_HEADER |
stefank@2325 | 183 | endif |
stefank@2325 | 184 | |
duke@435 | 185 | #------------------------------------------------------------------------ |
duke@435 | 186 | # Linker flags |
duke@435 | 187 | |
duke@435 | 188 | # statically link libstdc++.so, work with gcc but ignored by g++ |
duke@435 | 189 | STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic |
duke@435 | 190 | |
duke@435 | 191 | # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x. |
duke@435 | 192 | ifneq ("${CC_VER_MAJOR}", "2") |
duke@435 | 193 | STATIC_LIBGCC += -static-libgcc |
duke@435 | 194 | endif |
duke@435 | 195 | |
duke@435 | 196 | ifeq ($(BUILDARCH), ia64) |
duke@435 | 197 | LFLAGS += -Wl,-relax |
duke@435 | 198 | endif |
duke@435 | 199 | |
duke@435 | 200 | # Enable linker optimization |
duke@435 | 201 | LFLAGS += -Xlinker -O1 |
duke@435 | 202 | |
ohair@1011 | 203 | # If this is a --hash-style=gnu system, use --hash-style=both |
ohair@1011 | 204 | # The gnu .hash section won't work on some Linux systems like SuSE 10. |
ohair@1011 | 205 | _HAS_HASH_STYLE_GNU:=$(shell $(CC) -dumpspecs | grep -- '--hash-style=gnu') |
ohair@1011 | 206 | ifneq ($(_HAS_HASH_STYLE_GNU),) |
ohair@1011 | 207 | LDFLAGS_HASH_STYLE = -Wl,--hash-style=both |
ohair@1011 | 208 | endif |
ohair@1011 | 209 | LFLAGS += $(LDFLAGS_HASH_STYLE) |
ohair@1011 | 210 | |
duke@435 | 211 | # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file. |
duke@435 | 212 | MAPFLAG = -Xlinker --version-script=FILENAME |
duke@435 | 213 | |
duke@435 | 214 | # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj |
duke@435 | 215 | SONAMEFLAG = -Xlinker -soname=SONAME |
duke@435 | 216 | |
duke@435 | 217 | # Build shared library |
duke@435 | 218 | SHARED_FLAG = -shared |
duke@435 | 219 | |
duke@435 | 220 | # Keep symbols even they are not used |
dsamersoff@2839 | 221 | AOUT_FLAGS += -Xlinker -export-dynamic |
duke@435 | 222 | |
duke@435 | 223 | #------------------------------------------------------------------------ |
duke@435 | 224 | # Debug flags |
duke@435 | 225 | |
dcubed@3989 | 226 | # DEBUG_BINARIES uses full -g debug information for all configs |
dcubed@3989 | 227 | ifeq ($(DEBUG_BINARIES), true) |
dcubed@3989 | 228 | CFLAGS += -g |
dcubed@3989 | 229 | else |
dcubed@3989 | 230 | # Use the stabs format for debugging information (this is the default |
dcubed@3989 | 231 | # on gcc-2.91). It's good enough, has all the information about line |
dcubed@4344 | 232 | # numbers and local variables, and libjvm.so is only about 16M. |
dcubed@3989 | 233 | # Change this back to "-g" if you want the most expressive format. |
dcubed@4344 | 234 | # (warning: that could easily inflate libjvm.so to 150M!) |
dcubed@3989 | 235 | # Note: The Itanium gcc compiler crashes when using -gstabs. |
dcubed@3989 | 236 | DEBUG_CFLAGS/ia64 = -g |
dcubed@3989 | 237 | DEBUG_CFLAGS/amd64 = -g |
dcubed@3989 | 238 | DEBUG_CFLAGS/arm = -g |
dcubed@3989 | 239 | DEBUG_CFLAGS/ppc = -g |
dcubed@3989 | 240 | DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH)) |
dcubed@3989 | 241 | ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),) |
dcubed@3989 | 242 | DEBUG_CFLAGS += -gstabs |
dcubed@3150 | 243 | endif |
dcubed@3989 | 244 | |
dcubed@3989 | 245 | ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) |
dcubed@3989 | 246 | FASTDEBUG_CFLAGS/ia64 = -g |
dcubed@3989 | 247 | FASTDEBUG_CFLAGS/amd64 = -g |
dcubed@3989 | 248 | FASTDEBUG_CFLAGS/arm = -g |
dcubed@3989 | 249 | FASTDEBUG_CFLAGS/ppc = -g |
dcubed@3989 | 250 | FASTDEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH)) |
dcubed@3989 | 251 | ifeq ($(FASTDEBUG_CFLAGS/$(BUILDARCH)),) |
dcubed@3989 | 252 | FASTDEBUG_CFLAGS += -gstabs |
dcubed@3989 | 253 | endif |
dcubed@3989 | 254 | |
dcubed@3989 | 255 | OPT_CFLAGS/ia64 = -g |
dcubed@3989 | 256 | OPT_CFLAGS/amd64 = -g |
dcubed@3989 | 257 | OPT_CFLAGS/arm = -g |
dcubed@3989 | 258 | OPT_CFLAGS/ppc = -g |
dcubed@3989 | 259 | OPT_CFLAGS += $(OPT_CFLAGS/$(BUILDARCH)) |
dcubed@3989 | 260 | ifeq ($(OPT_CFLAGS/$(BUILDARCH)),) |
dcubed@3989 | 261 | OPT_CFLAGS += -gstabs |
dcubed@3989 | 262 | endif |
dcubed@3150 | 263 | endif |
dcubed@3150 | 264 | endif |
dcubed@3150 | 265 | |
bobv@2036 | 266 | # If we are building HEADLESS, pass on to VM |
bobv@2036 | 267 | # so it can set the java.awt.headless property |
bobv@2036 | 268 | ifdef HEADLESS |
bobv@2036 | 269 | CFLAGS += -DHEADLESS |
bobv@2036 | 270 | endif |
bobv@2036 | 271 | |
bobv@2036 | 272 | # We are building Embedded for a small device |
bobv@2036 | 273 | # favor code space over speed |
bobv@2036 | 274 | ifdef MINIMIZE_RAM_USAGE |
bobv@2036 | 275 | CFLAGS += -DMINIMIZE_RAM_USAGE |
bobv@2036 | 276 | endif |