author | jmasa |
Thu, 28 Aug 2014 17:45:58 +0000 | |
changeset 26318 | 4a618975cfcc |
parent 26172 | 7ab032af2835 |
child 26417 | c55a863f2a7f |
permissions | -rw-r--r-- |
10565 | 1 |
# |
18431 | 2 |
# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. |
10565 | 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
# or visit www.oracle.com if you need additional information or have any |
|
21 |
# questions. |
|
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
22 |
# |
10565 | 23 |
# |
24 |
||
25 |
OS_VENDOR = $(shell uname -s) |
|
26 |
||
27 |
#------------------------------------------------------------------------ |
|
11721
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
11205
diff
changeset
|
28 |
# CC, CXX & AS |
10565 | 29 |
|
11955
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
30 |
# If a SPEC is not set already, then use these defaults. |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
31 |
ifeq ($(SPEC),) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
32 |
# When cross-compiling the ALT_COMPILER_PATH points |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
33 |
# to the cross-compilation toolset |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
34 |
ifdef CROSS_COMPILE_ARCH |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
35 |
CXX = $(ALT_COMPILER_PATH)/g++ |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
36 |
CC = $(ALT_COMPILER_PATH)/gcc |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
37 |
HOSTCXX = g++ |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
38 |
HOSTCC = gcc |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
39 |
else ifneq ($(OS_VENDOR), Darwin) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
40 |
CXX = g++ |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
41 |
CC = gcc |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
42 |
HOSTCXX = $(CXX) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
43 |
HOSTCC = $(CC) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
44 |
endif |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
45 |
|
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
46 |
# i486 hotspot requires -mstackrealign on Darwin. |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
47 |
# llvm-gcc supports this in Xcode 3.2.6 and 4.0. |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
48 |
# gcc-4.0 supports this on earlier versions. |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
49 |
# Prefer llvm-gcc where available. |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
50 |
ifeq ($(OS_VENDOR), Darwin) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
51 |
ifeq ($(origin CXX), default) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
52 |
CXX = llvm-g++ |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
53 |
endif |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
54 |
ifeq ($(origin CC), default) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
55 |
CC = llvm-gcc |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
56 |
endif |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
57 |
|
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
58 |
ifeq ($(ARCH), i486) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
59 |
LLVM_SUPPORTS_STACKREALIGN := $(shell \ |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
60 |
[ "0"`llvm-gcc -v 2>&1 | grep LLVM | sed -E "s/.*LLVM build ([0-9]+).*/\1/"` -gt "2333" ] \ |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
61 |
&& echo true || echo false) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
62 |
|
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
63 |
ifeq ($(LLVM_SUPPORTS_STACKREALIGN), true) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
64 |
CXX32 ?= llvm-g++ |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
65 |
CC32 ?= llvm-gcc |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
66 |
else |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
67 |
CXX32 ?= g++-4.0 |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
68 |
CC32 ?= gcc-4.0 |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
69 |
endif |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
70 |
CXX = $(CXX32) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
71 |
CC = $(CC32) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
72 |
endif |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
73 |
|
17880 | 74 |
ifeq ($(USE_CLANG), true) |
75 |
CXX = clang++ |
|
76 |
CC = clang |
|
77 |
endif |
|
78 |
||
11955
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
79 |
HOSTCXX = $(CXX) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
80 |
HOSTCC = $(CC) |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
81 |
endif |
aeca8151886e
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
11721
diff
changeset
|
82 |
|
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
83 |
AS = $(CC) -c |
10739 | 84 |
endif |
85 |
||
20686
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
86 |
ifeq ($(OS_VENDOR), Darwin) |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
87 |
ifeq ($(DSYMUTIL),) |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
88 |
DSYMUTIL=dsymutil |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
89 |
endif |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
90 |
endif |
10565 | 91 |
|
17880 | 92 |
ifeq ($(USE_CLANG), true) |
93 |
CC_VER_MAJOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f1) |
|
94 |
CC_VER_MINOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f2) |
|
95 |
else |
|
96 |
# -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only |
|
97 |
# prints the numbers (e.g. "2.95", "3.2.1") |
|
98 |
CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1) |
|
99 |
CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2) |
|
10565 | 100 |
endif |
101 |
||
17880 | 102 |
ifeq ($(USE_CLANG), true) |
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
103 |
# Clang has precompiled headers support by default, but the user can switch |
17880 | 104 |
# it off by using 'USE_PRECOMPILED_HEADER=0'. |
105 |
ifdef LP64 |
|
106 |
ifeq ($(USE_PRECOMPILED_HEADER),) |
|
107 |
USE_PRECOMPILED_HEADER=1 |
|
108 |
endif |
|
109 |
else |
|
110 |
# We don't support precompiled headers on 32-bit builds because there some files are |
|
111 |
# compiled with -fPIC while others are compiled without (see 'NONPIC_OBJ_FILES' rules.make) |
|
112 |
# Clang produces an error if the PCH file was compiled with other options than the actual compilation unit. |
|
113 |
USE_PRECOMPILED_HEADER=0 |
|
114 |
endif |
|
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
115 |
|
17880 | 116 |
ifeq ($(USE_PRECOMPILED_HEADER),1) |
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
117 |
|
17880 | 118 |
ifndef LP64 |
119 |
$(error " Precompiled Headers only supported on 64-bit platforms!") |
|
120 |
endif |
|
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
121 |
|
17880 | 122 |
PRECOMPILED_HEADER_DIR=. |
123 |
PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp |
|
124 |
PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.pch |
|
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
125 |
|
17880 | 126 |
PCH_FLAG = -include precompiled.hpp |
127 |
PCH_FLAG/DEFAULT = $(PCH_FLAG) |
|
128 |
PCH_FLAG/NO_PCH = -DNO_PCH |
|
129 |
PCH_FLAG/BY_FILE = $(PCH_FLAG/$@)$(PCH_FLAG/DEFAULT$(PCH_FLAG/$@)) |
|
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
130 |
|
17880 | 131 |
VM_PCH_FLAG/LIBJVM = $(PCH_FLAG/BY_FILE) |
132 |
VM_PCH_FLAG/AOUT = |
|
133 |
VM_PCH_FLAG = $(VM_PCH_FLAG/$(LINK_INTO)) |
|
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
134 |
|
17880 | 135 |
# We only use precompiled headers for the JVM build |
136 |
CFLAGS += $(VM_PCH_FLAG) |
|
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
137 |
|
19701
8dfde6242cd1
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
19693
diff
changeset
|
138 |
# The following files are compiled at various optimization |
8dfde6242cd1
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
19693
diff
changeset
|
139 |
# levels due to optimization issues encountered at the |
8dfde6242cd1
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
19693
diff
changeset
|
140 |
# 'OPT_CFLAGS_DEFAULT' level. The Clang compiler issues a compile |
8dfde6242cd1
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
19693
diff
changeset
|
141 |
# time error if there is an optimization level specification |
8dfde6242cd1
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
19693
diff
changeset
|
142 |
# skew between the PCH file and the C++ file. Especially if the |
8dfde6242cd1
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
19693
diff
changeset
|
143 |
# PCH file is compiled at a higher optimization level than |
8dfde6242cd1
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
19693
diff
changeset
|
144 |
# the C++ file. One solution might be to prepare extra optimization |
8dfde6242cd1
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
19693
diff
changeset
|
145 |
# level specific PCH files for the opt build and use them here, but |
8dfde6242cd1
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
19693
diff
changeset
|
146 |
# it's probably not worth the effort as long as only a few files |
8dfde6242cd1
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
19693
diff
changeset
|
147 |
# need this special handling. |
17880 | 148 |
PCH_FLAG/loopTransform.o = $(PCH_FLAG/NO_PCH) |
149 |
PCH_FLAG/sharedRuntimeTrig.o = $(PCH_FLAG/NO_PCH) |
|
150 |
PCH_FLAG/sharedRuntimeTrans.o = $(PCH_FLAG/NO_PCH) |
|
19693
633580a41062
8022407: sun/misc/CopyMemory.java fails with SIGSEGV in Unsafe_SetByte+0x35
hseigel
parents:
19336
diff
changeset
|
151 |
PCH_FLAG/unsafe.o = $(PCH_FLAG/NO_PCH) |
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
152 |
|
17880 | 153 |
endif |
154 |
else # ($(USE_CLANG), true) |
|
155 |
# check for precompiled headers support |
|
156 |
ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0" |
|
157 |
# Allow the user to turn off precompiled headers from the command line. |
|
158 |
ifneq ($(USE_PRECOMPILED_HEADER),0) |
|
159 |
PRECOMPILED_HEADER_DIR=. |
|
160 |
PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp |
|
161 |
PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch |
|
162 |
endif |
|
163 |
endif |
|
164 |
endif |
|
165 |
||
166 |
# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp. |
|
167 |
ifeq ($(USE_PRECOMPILED_HEADER),0) |
|
168 |
CFLAGS += -DDONT_USE_PRECOMPILED_HEADER |
|
169 |
endif |
|
10565 | 170 |
|
171 |
#------------------------------------------------------------------------ |
|
172 |
# Compiler flags |
|
173 |
||
174 |
# position-independent code |
|
175 |
PICFLAG = -fPIC |
|
176 |
||
177 |
VM_PICFLAG/LIBJVM = $(PICFLAG) |
|
178 |
VM_PICFLAG/AOUT = |
|
179 |
VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO)) |
|
180 |
||
12156
fb31de03f649
7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents:
11955
diff
changeset
|
181 |
ifeq ($(JVM_VARIANT_ZERO), true) |
fb31de03f649
7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents:
11955
diff
changeset
|
182 |
CFLAGS += $(LIBFFI_CFLAGS) |
10565 | 183 |
endif |
12156
fb31de03f649
7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents:
11955
diff
changeset
|
184 |
ifeq ($(JVM_VARIANT_ZEROSHARK), true) |
fb31de03f649
7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents:
11955
diff
changeset
|
185 |
CFLAGS += $(LIBFFI_CFLAGS) |
fb31de03f649
7141246: build-infra merge: Introduce new JVM_VARIANT* to control which kind of jvm gets built
erikj
parents:
11955
diff
changeset
|
186 |
CFLAGS += $(LLVM_CFLAGS) |
10565 | 187 |
endif |
188 |
CFLAGS += $(VM_PICFLAG) |
|
189 |
CFLAGS += -fno-rtti |
|
190 |
CFLAGS += -fno-exceptions |
|
17880 | 191 |
ifeq ($(USE_CLANG),) |
192 |
CFLAGS += -pthread |
|
193 |
CFLAGS += -fcheck-new |
|
194 |
# version 4 and above support fvisibility=hidden (matches jni_x86.h file) |
|
195 |
# except 4.1.2 gives pointless warnings that can't be disabled (afaik) |
|
196 |
ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" |
|
197 |
CFLAGS += -fvisibility=hidden |
|
198 |
endif |
|
199 |
else |
|
200 |
CFLAGS += -fvisibility=hidden |
|
201 |
endif |
|
202 |
||
203 |
ifeq ($(USE_CLANG), true) |
|
204 |
# Before Clang 3.1, we had to pass the stack alignment specification directly to llvm with the help of '-mllvm' |
|
205 |
# Starting with version 3.1, Clang understands the '-mstack-alignment' (and rejects '-mllvm -stack-alignment') |
|
206 |
ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 1 \) \))" "0" |
|
207 |
STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mstack-alignment=16 |
|
208 |
else |
|
209 |
STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mllvm -stack-alignment=16 |
|
210 |
endif |
|
10565 | 211 |
endif |
212 |
||
213 |
ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) |
|
214 |
ARCHFLAG/i486 = -m32 -march=i586 |
|
17880 | 215 |
ARCHFLAG/amd64 = -m64 $(STACK_ALIGNMENT_OPT) |
10565 | 216 |
ARCHFLAG/ia64 = |
217 |
ARCHFLAG/sparc = -m32 -mcpu=v9 |
|
218 |
ARCHFLAG/sparcv9 = -m64 -mcpu=v9 |
|
219 |
ARCHFLAG/zero = $(ZERO_ARCHFLAG) |
|
220 |
||
221 |
# Darwin-specific build flags |
|
222 |
ifeq ($(OS_VENDOR), Darwin) |
|
223 |
# Ineffecient 16-byte stack re-alignment on Darwin/IA32 |
|
224 |
ARCHFLAG/i486 += -mstackrealign |
|
225 |
endif |
|
226 |
||
227 |
CFLAGS += $(ARCHFLAG) |
|
228 |
AOUT_FLAGS += $(ARCHFLAG) |
|
229 |
LFLAGS += $(ARCHFLAG) |
|
230 |
ASFLAGS += $(ARCHFLAG) |
|
231 |
||
232 |
ifdef E500V2 |
|
233 |
CFLAGS += -DE500V2 |
|
234 |
endif |
|
235 |
||
236 |
# Use C++ Interpreter |
|
237 |
ifdef CC_INTERP |
|
238 |
CFLAGS += -DCC_INTERP |
|
239 |
endif |
|
240 |
||
241 |
# Keep temporary files (.ii, .s) |
|
242 |
ifdef NEED_ASM |
|
243 |
CFLAGS += -save-temps |
|
244 |
else |
|
245 |
CFLAGS += -pipe |
|
246 |
endif |
|
247 |
||
248 |
# Compiler warnings are treated as errors |
|
10739 | 249 |
ifneq ($(COMPILER_WARNINGS_FATAL),false) |
250 |
WARNINGS_ARE_ERRORS = -Werror |
|
251 |
endif |
|
10565 | 252 |
|
17880 | 253 |
ifeq ($(USE_CLANG), true) |
254 |
# However we need to clean the code up before we can unrestrictedly enable this option with Clang |
|
20295 | 255 |
WARNINGS_ARE_ERRORS += -Wno-logical-op-parentheses -Wno-parentheses-equality -Wno-parentheses |
17880 | 256 |
WARNINGS_ARE_ERRORS += -Wno-switch -Wno-tautological-compare |
257 |
# Not yet supported by clang in Xcode 4.6.2 |
|
258 |
# WARNINGS_ARE_ERRORS += -Wno-tautological-constant-out-of-range-compare |
|
259 |
WARNINGS_ARE_ERRORS += -Wno-delete-non-virtual-dtor -Wno-deprecated -Wno-format -Wno-dynamic-class-memaccess |
|
19336
ddceb0657500
8022956: Clang: enable return type warnings on BSD
twisti
parents:
18431
diff
changeset
|
260 |
WARNINGS_ARE_ERRORS += -Wno-empty-body |
17880 | 261 |
endif |
262 |
||
23185 | 263 |
WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wformat=2 |
17880 | 264 |
|
22240
ec02eda6b9b6
8022263: use same Clang warnings on BSD as on Linux
twisti
parents:
20686
diff
changeset
|
265 |
ifeq ($(USE_CLANG),) |
17880 | 266 |
# Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit |
267 |
# conversions which might affect the values. Only enable it in earlier versions. |
|
22240
ec02eda6b9b6
8022263: use same Clang warnings on BSD as on Linux
twisti
parents:
20686
diff
changeset
|
268 |
ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" |
ec02eda6b9b6
8022263: use same Clang warnings on BSD as on Linux
twisti
parents:
20686
diff
changeset
|
269 |
WARNINGS_FLAGS += -Wconversion |
17880 | 270 |
endif |
10565 | 271 |
endif |
272 |
||
15938 | 273 |
CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS) |
10565 | 274 |
# Special cases |
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
275 |
CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) |
10565 | 276 |
# XXXDARWIN: for _dyld_bind_fully_image_containing_address |
277 |
ifeq ($(OS_VENDOR), Darwin) |
|
278 |
CFLAGS_WARN/os_bsd.o = $(CFLAGS_WARN/DEFAULT) -Wno-deprecated-declarations |
|
279 |
endif |
|
280 |
||
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
281 |
# optimization control flags (Used by fastdebug and release variants) |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
282 |
OPT_CFLAGS/NOOPT=-O0 |
25498 | 283 |
OPT_CFLAGS/DEBUG=-O0 |
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
284 |
OPT_CFLAGS/SIZE=-Os |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
285 |
OPT_CFLAGS/SPEED=-O3 |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
286 |
|
10739 | 287 |
ifeq ($(OS_VENDOR), Darwin) |
288 |
# use -Os by default, unless -O3 can be proved to be worth the cost, as per policy |
|
22784
f264891fc7a8
8030350: Enable additional compiler warnings for GCC
mduigou
parents:
22240
diff
changeset
|
289 |
# <https://wiki.openjdk.java.net/display/MacOSXPort/Compiler+Errata> |
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
290 |
OPT_CFLAGS_DEFAULT ?= SIZE |
10739 | 291 |
else |
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
292 |
OPT_CFLAGS_DEFAULT ?= SPEED |
10739 | 293 |
endif |
10565 | 294 |
|
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
295 |
# Hotspot uses very unstrict aliasing turn this optimization off |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
296 |
# This option is added to CFLAGS rather than OPT_CFLAGS |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
297 |
# so that OPT_CFLAGS overrides get this option too. |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
298 |
CFLAGS += -fno-strict-aliasing |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
299 |
|
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
300 |
ifdef OPT_CFLAGS |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
301 |
ifneq ("$(origin OPT_CFLAGS)", "command line") |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
302 |
$(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.") |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
303 |
endif |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
304 |
endif |
10565 | 305 |
|
13975
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
306 |
OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS) |
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
307 |
|
2f7431485cfa
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
12943
diff
changeset
|
308 |
# The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp |
10565 | 309 |
# if we use expensive-optimizations |
310 |
ifeq ($(BUILDARCH), ia64) |
|
311 |
OPT_CFLAGS += -fno-expensive-optimizations |
|
312 |
endif |
|
313 |
||
17880 | 314 |
# Work around some compiler bugs. |
315 |
ifeq ($(USE_CLANG), true) |
|
25347
4ca04b797b3a
8048298: Clang needs to lower optimization level for some files
iveresov
parents:
25340
diff
changeset
|
316 |
# Clang 4.2 |
17880 | 317 |
ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1) |
318 |
OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT) |
|
19701
8dfde6242cd1
8024050: Incorrect optimization level and comment specified for unsafe.cpp
hseigel
parents:
19693
diff
changeset
|
319 |
OPT_CFLAGS/unsafe.o += -O1 |
25347
4ca04b797b3a
8048298: Clang needs to lower optimization level for some files
iveresov
parents:
25340
diff
changeset
|
320 |
# Clang 5.0 |
4ca04b797b3a
8048298: Clang needs to lower optimization level for some files
iveresov
parents:
25340
diff
changeset
|
321 |
else ifeq ($(shell expr $(CC_VER_MAJOR) = 5 \& $(CC_VER_MINOR) = 0), 1) |
4ca04b797b3a
8048298: Clang needs to lower optimization level for some files
iveresov
parents:
25340
diff
changeset
|
322 |
OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT) |
4ca04b797b3a
8048298: Clang needs to lower optimization level for some files
iveresov
parents:
25340
diff
changeset
|
323 |
OPT_CFLAGS/unsafe.o += -O1 |
4ca04b797b3a
8048298: Clang needs to lower optimization level for some files
iveresov
parents:
25340
diff
changeset
|
324 |
# Clang 5.1 |
4ca04b797b3a
8048298: Clang needs to lower optimization level for some files
iveresov
parents:
25340
diff
changeset
|
325 |
else ifeq ($(shell expr $(CC_VER_MAJOR) = 5 \& $(CC_VER_MINOR) = 1), 1) |
4ca04b797b3a
8048298: Clang needs to lower optimization level for some files
iveresov
parents:
25340
diff
changeset
|
326 |
OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT) |
4ca04b797b3a
8048298: Clang needs to lower optimization level for some files
iveresov
parents:
25340
diff
changeset
|
327 |
OPT_CFLAGS/unsafe.o += -O1 |
4ca04b797b3a
8048298: Clang needs to lower optimization level for some files
iveresov
parents:
25340
diff
changeset
|
328 |
else |
4ca04b797b3a
8048298: Clang needs to lower optimization level for some files
iveresov
parents:
25340
diff
changeset
|
329 |
$(error "Update compiler workarounds for Clang $(CC_VER_MAJOR).$(CC_VER_MINOR)") |
17880 | 330 |
endif |
331 |
else |
|
332 |
# 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation. |
|
333 |
ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1) |
|
334 |
OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT) |
|
335 |
endif |
|
10565 | 336 |
endif |
337 |
||
338 |
# Flags for generating make dependency flags. |
|
17880 | 339 |
DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d) |
340 |
ifeq ($(USE_CLANG),) |
|
341 |
ifneq ($(CC_VER_MAJOR), 2) |
|
342 |
DEPFLAGS += -fpch-deps |
|
343 |
endif |
|
10565 | 344 |
endif |
345 |
||
346 |
# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp. |
|
11205
f07e6dd70a1f
7116081: USE_PRECOMPILED_HEADER=0 triggers a single threaded build of the JVM
stefank
parents:
10830
diff
changeset
|
347 |
ifeq ($(USE_PRECOMPILED_HEADER),0) |
10565 | 348 |
CFLAGS += -DDONT_USE_PRECOMPILED_HEADER |
349 |
endif |
|
350 |
||
15862 | 351 |
ifeq ($(OS_VENDOR), Darwin) |
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
352 |
# Setting these parameters makes it an error to link to macosx APIs that are |
15862 | 353 |
# newer than the given OS version and makes the linked binaries compatible even |
354 |
# if built on a newer version of the OS. |
|
355 |
# The expected format is X.Y.Z |
|
356 |
ifeq ($(MACOSX_VERSION_MIN),) |
|
357 |
MACOSX_VERSION_MIN=10.7.0 |
|
358 |
endif |
|
359 |
# The macro takes the version with no dots, ex: 1070 |
|
360 |
CFLAGS += -DMAC_OS_X_VERSION_MAX_ALLOWED=$(subst .,,$(MACOSX_VERSION_MIN)) \ |
|
361 |
-mmacosx-version-min=$(MACOSX_VERSION_MIN) |
|
362 |
LDFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN) |
|
363 |
endif |
|
364 |
||
19956
9065fbafee8d
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
19701
diff
changeset
|
365 |
|
9065fbafee8d
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
19701
diff
changeset
|
366 |
#------------------------------------------------------------------------ |
9065fbafee8d
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
19701
diff
changeset
|
367 |
# Assembler flags |
9065fbafee8d
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
19701
diff
changeset
|
368 |
|
9065fbafee8d
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
19701
diff
changeset
|
369 |
# Enforce prerpocessing of .s files |
9065fbafee8d
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
19701
diff
changeset
|
370 |
ASFLAGS += -x assembler-with-cpp |
9065fbafee8d
8022617: Openjdk hotspot build is broken on BSD platforms using gcc
dsamersoff
parents:
19701
diff
changeset
|
371 |
|
10565 | 372 |
#------------------------------------------------------------------------ |
373 |
# Linker flags |
|
374 |
||
375 |
# statically link libstdc++.so, work with gcc but ignored by g++ |
|
376 |
STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic |
|
377 |
||
22889
b8796ece69ae
8033898: undefined symbol when build hotspot with Xcode5
henryjen
parents:
22784
diff
changeset
|
378 |
# Ensure use libstdc++ on clang, not libc++ |
b8796ece69ae
8033898: undefined symbol when build hotspot with Xcode5
henryjen
parents:
22784
diff
changeset
|
379 |
ifeq ($(USE_CLANG), true) |
b8796ece69ae
8033898: undefined symbol when build hotspot with Xcode5
henryjen
parents:
22784
diff
changeset
|
380 |
LFLAGS += -stdlib=libstdc++ |
b8796ece69ae
8033898: undefined symbol when build hotspot with Xcode5
henryjen
parents:
22784
diff
changeset
|
381 |
endif |
b8796ece69ae
8033898: undefined symbol when build hotspot with Xcode5
henryjen
parents:
22784
diff
changeset
|
382 |
|
17880 | 383 |
ifeq ($(USE_CLANG),) |
384 |
# statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x. |
|
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
385 |
ifneq ($(CC_VER_MAJOR), 2) |
17880 | 386 |
STATIC_LIBGCC += -static-libgcc |
387 |
endif |
|
10565 | 388 |
|
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
389 |
ifneq ($(OS_VENDOR), Darwin) |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
390 |
ifneq (, findstring(debug,$(BUILD_FLAVOR))) |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
391 |
# for relocations read-only |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
392 |
LFLAGS += -Xlinker -z -Xlinker relro |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
393 |
|
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
394 |
ifeq ($(BUILD_FLAVOR), debug) |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
395 |
# disable incremental relocations linking |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
396 |
LFLAGS += -Xlinker -z -Xlinker now |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
397 |
endif |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
398 |
endif |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
399 |
endif |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
400 |
|
17880 | 401 |
ifeq ($(BUILDARCH), ia64) |
402 |
LFLAGS += -Wl,-relax |
|
403 |
endif |
|
10565 | 404 |
endif |
405 |
||
406 |
# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file. |
|
407 |
MAPFLAG = -Xlinker --version-script=FILENAME |
|
408 |
||
409 |
# |
|
410 |
# Shared Library |
|
411 |
# |
|
412 |
ifeq ($(OS_VENDOR), Darwin) |
|
413 |
# Standard linker flags |
|
414 |
LFLAGS += |
|
415 |
||
18431 | 416 |
# The apple linker has its own variant of mapfiles/version-scripts |
417 |
MAPFLAG = -Xlinker -exported_symbols_list -Xlinker FILENAME |
|
10565 | 418 |
|
419 |
# Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj |
|
420 |
SONAMEFLAG = |
|
421 |
||
422 |
# Build shared library |
|
10739 | 423 |
SHARED_FLAG = -Wl,-install_name,@rpath/$(@F) -dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $(VM_PICFLAG) |
10565 | 424 |
|
425 |
# Keep symbols even they are not used |
|
426 |
#AOUT_FLAGS += -Xlinker -export-dynamic |
|
427 |
else |
|
428 |
# Enable linker optimization |
|
429 |
LFLAGS += -Xlinker -O1 |
|
430 |
||
431 |
# Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj |
|
432 |
SONAMEFLAG = -Xlinker -soname=SONAME |
|
433 |
||
434 |
# Build shared library |
|
435 |
SHARED_FLAG = -shared $(VM_PICFLAG) |
|
436 |
||
437 |
# Keep symbols even they are not used |
|
438 |
AOUT_FLAGS += -Xlinker -export-dynamic |
|
439 |
endif |
|
440 |
||
441 |
#------------------------------------------------------------------------ |
|
442 |
# Debug flags |
|
443 |
||
17880 | 444 |
ifeq ($(USE_CLANG), true) |
445 |
# Restrict the debug information created by Clang to avoid |
|
446 |
# too big object files and speed the build up a little bit |
|
447 |
# (see http://llvm.org/bugs/show_bug.cgi?id=7554) |
|
448 |
CFLAGS += -flimit-debug-info |
|
10565 | 449 |
endif |
450 |
||
25498 | 451 |
# Allow no optimizations. |
452 |
DEBUG_CFLAGS=-O0 |
|
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
453 |
|
17880 | 454 |
# DEBUG_BINARIES uses full -g debug information for all configs |
10565 | 455 |
ifeq ($(DEBUG_BINARIES), true) |
17880 | 456 |
CFLAGS += -g |
457 |
else |
|
458 |
# Use the stabs format for debugging information (this is the default |
|
459 |
# on gcc-2.91). It's good enough, has all the information about line |
|
460 |
# numbers and local variables, and libjvm.so is only about 16M. |
|
461 |
# Change this back to "-g" if you want the most expressive format. |
|
462 |
# (warning: that could easily inflate libjvm.so to 150M!) |
|
463 |
# Note: The Itanium gcc compiler crashes when using -gstabs. |
|
464 |
DEBUG_CFLAGS/ia64 = -g |
|
465 |
DEBUG_CFLAGS/amd64 = -g |
|
466 |
DEBUG_CFLAGS/arm = -g |
|
467 |
DEBUG_CFLAGS/ppc = -g |
|
468 |
DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH)) |
|
469 |
ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),) |
|
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
470 |
ifeq ($(USE_CLANG), true) |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
471 |
# Clang doesn't understand -gstabs |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
472 |
DEBUG_CFLAGS += -g |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
473 |
else |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
474 |
DEBUG_CFLAGS += -gstabs |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
475 |
endif |
17880 | 476 |
endif |
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
477 |
|
20686
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
478 |
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
479 |
FASTDEBUG_CFLAGS/ia64 = -g |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
480 |
FASTDEBUG_CFLAGS/amd64 = -g |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
481 |
FASTDEBUG_CFLAGS/arm = -g |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
482 |
FASTDEBUG_CFLAGS/ppc = -g |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
483 |
FASTDEBUG_CFLAGS += $(FASTDEBUG_CFLAGS/$(BUILDARCH)) |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
484 |
ifeq ($(FASTDEBUG_CFLAGS/$(BUILDARCH)),) |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
485 |
ifeq ($(USE_CLANG), true) |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
486 |
# Clang doesn't understand -gstabs |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
487 |
FASTDEBUG_CFLAGS += -g |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
488 |
else |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
489 |
FASTDEBUG_CFLAGS += -gstabs |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
490 |
endif |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
491 |
endif |
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
492 |
|
20686
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
493 |
OPT_CFLAGS/ia64 = -g |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
494 |
OPT_CFLAGS/amd64 = -g |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
495 |
OPT_CFLAGS/arm = -g |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
496 |
OPT_CFLAGS/ppc = -g |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
497 |
OPT_CFLAGS += $(OPT_CFLAGS/$(BUILDARCH)) |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
498 |
ifeq ($(OPT_CFLAGS/$(BUILDARCH)),) |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
499 |
ifeq ($(USE_CLANG), true) |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
500 |
# Clang doesn't understand -gstabs |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
501 |
OPT_CFLAGS += -g |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
502 |
else |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
503 |
OPT_CFLAGS += -gstabs |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
504 |
endif |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
505 |
endif |
1fa9a75192c3
7165611: implement Full Debug Symbols on MacOS X hotspot
dcubed
parents:
20295
diff
changeset
|
506 |
endif |
10565 | 507 |
endif |
508 |
||
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
509 |
ifeq ($(USE_CLANG),) |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
510 |
# Enable bounds checking. |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
511 |
ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) )" "1" |
26172
7ab032af2835
8047952: Remove _FORTIFY_SOURCE from fastdebug and slowdebug builds
mduigou
parents:
25498
diff
changeset
|
512 |
# stack smashing checks. |
7ab032af2835
8047952: Remove _FORTIFY_SOURCE from fastdebug and slowdebug builds
mduigou
parents:
25498
diff
changeset
|
513 |
DEBUG_CFLAGS += -fstack-protector-all --param ssp-buffer-size=1 |
24955
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
514 |
endif |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
515 |
endif |
fbde9efb7b56
8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents:
23185
diff
changeset
|
516 |
|
10565 | 517 |
# If we are building HEADLESS, pass on to VM |
518 |
# so it can set the java.awt.headless property |
|
519 |
ifdef HEADLESS |
|
520 |
CFLAGS += -DHEADLESS |
|
521 |
endif |
|
522 |
||
523 |
# We are building Embedded for a small device |
|
524 |
# favor code space over speed |
|
525 |
ifdef MINIMIZE_RAM_USAGE |
|
526 |
CFLAGS += -DMINIMIZE_RAM_USAGE |
|
527 |
endif |