Mercurial > hg > truffle
annotate make/bsd/makefiles/gcc.make @ 5938:2c0751569716
7152954: G1: Native memory leak during full GCs
Summary: Add destructor to TruncatedSeq and call delete when necessary
Reviewed-by: johnc, tonyp
author | brutisso |
---|---|
date | Tue, 13 Mar 2012 21:12:53 +0100 |
parents | 7292cff45988 |
children | 3d7ea1dbe0de |
rev | line source |
---|---|
3960 | 1 # |
2 # Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. | |
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. | |
22 # | |
23 # | |
24 | |
25 OS_VENDOR = $(shell uname -s) | |
26 | |
27 #------------------------------------------------------------------------ | |
4891
719f7007c8e8
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
4129
diff
changeset
|
28 # CC, CXX & AS |
3960 | 29 |
5897
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
30 # If a SPEC is not set already, then use these defaults. |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
31 ifeq ($(SPEC),) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
32 # When cross-compiling the ALT_COMPILER_PATH points |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
33 # to the cross-compilation toolset |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
34 ifdef CROSS_COMPILE_ARCH |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
35 CXX = $(ALT_COMPILER_PATH)/g++ |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
36 CC = $(ALT_COMPILER_PATH)/gcc |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
37 HOSTCXX = g++ |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
38 HOSTCC = gcc |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
39 else ifneq ($(OS_VENDOR), Darwin) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
40 CXX = g++ |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
41 CC = gcc |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
42 HOSTCXX = $(CXX) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
43 HOSTCC = $(CC) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
44 endif |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
45 |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
46 # i486 hotspot requires -mstackrealign on Darwin. |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
47 # llvm-gcc supports this in Xcode 3.2.6 and 4.0. |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
48 # gcc-4.0 supports this on earlier versions. |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
49 # Prefer llvm-gcc where available. |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
50 ifeq ($(OS_VENDOR), Darwin) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
51 ifeq ($(origin CXX), default) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
52 CXX = llvm-g++ |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
53 endif |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
54 ifeq ($(origin CC), default) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
55 CC = llvm-gcc |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
56 endif |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
57 |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
58 ifeq ($(ARCH), i486) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
59 LLVM_SUPPORTS_STACKREALIGN := $(shell \ |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
60 [ "0"`llvm-gcc -v 2>&1 | grep LLVM | sed -E "s/.*LLVM build ([0-9]+).*/\1/"` -gt "2333" ] \ |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
61 && echo true || echo false) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
62 |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
63 ifeq ($(LLVM_SUPPORTS_STACKREALIGN), true) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
64 CXX32 ?= llvm-g++ |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
65 CC32 ?= llvm-gcc |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
66 else |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
67 CXX32 ?= g++-4.0 |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
68 CC32 ?= gcc-4.0 |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
69 endif |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
70 CXX = $(CXX32) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
71 CC = $(CC32) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
72 endif |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
73 |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
74 HOSTCXX = $(CXX) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
75 HOSTCC = $(CC) |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
76 endif |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
77 |
7292cff45988
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
erikj
parents:
4891
diff
changeset
|
78 AS = $(CC) -c -x assembler-with-cpp |
4006 | 79 endif |
80 | |
3960 | 81 |
82 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only | |
83 # prints the numbers (e.g. "2.95", "3.2.1") | |
84 CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1) | |
85 CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2) | |
86 | |
87 # check for precompiled headers support | |
88 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0" | |
89 # Allow the user to turn off precompiled headers from the command line. | |
90 ifneq ($(USE_PRECOMPILED_HEADER),0) | |
91 PRECOMPILED_HEADER_DIR=. | |
4033
95009f678859
7106766: Move the precompiled header from the src/share/vm directory
brutisso
parents:
4006
diff
changeset
|
92 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp |
3960 | 93 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch |
94 endif | |
95 endif | |
96 | |
97 | |
98 #------------------------------------------------------------------------ | |
99 # Compiler flags | |
100 | |
101 # position-independent code | |
102 PICFLAG = -fPIC | |
103 | |
104 VM_PICFLAG/LIBJVM = $(PICFLAG) | |
105 VM_PICFLAG/AOUT = | |
106 VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO)) | |
107 | |
108 ifeq ($(ZERO_BUILD), true) | |
109 CFLAGS += $(LIBFFI_CFLAGS) | |
110 endif | |
111 ifeq ($(SHARK_BUILD), true) | |
112 CFLAGS += $(LLVM_CFLAGS) | |
113 endif | |
114 CFLAGS += $(VM_PICFLAG) | |
115 CFLAGS += -fno-rtti | |
116 CFLAGS += -fno-exceptions | |
117 CFLAGS += -pthread | |
118 CFLAGS += -fcheck-new | |
119 # version 4 and above support fvisibility=hidden (matches jni_x86.h file) | |
120 # except 4.1.2 gives pointless warnings that can't be disabled (afaik) | |
121 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" | |
122 CFLAGS += -fvisibility=hidden | |
123 endif | |
124 | |
125 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) | |
126 ARCHFLAG/i486 = -m32 -march=i586 | |
127 ARCHFLAG/amd64 = -m64 | |
128 ARCHFLAG/ia64 = | |
129 ARCHFLAG/sparc = -m32 -mcpu=v9 | |
130 ARCHFLAG/sparcv9 = -m64 -mcpu=v9 | |
131 ARCHFLAG/zero = $(ZERO_ARCHFLAG) | |
132 | |
133 # Darwin-specific build flags | |
134 ifeq ($(OS_VENDOR), Darwin) | |
135 # Ineffecient 16-byte stack re-alignment on Darwin/IA32 | |
136 ARCHFLAG/i486 += -mstackrealign | |
137 endif | |
138 | |
139 CFLAGS += $(ARCHFLAG) | |
140 AOUT_FLAGS += $(ARCHFLAG) | |
141 LFLAGS += $(ARCHFLAG) | |
142 ASFLAGS += $(ARCHFLAG) | |
143 | |
144 ifdef E500V2 | |
145 CFLAGS += -DE500V2 | |
146 endif | |
147 | |
148 # Use C++ Interpreter | |
149 ifdef CC_INTERP | |
150 CFLAGS += -DCC_INTERP | |
151 endif | |
152 | |
153 # Build for embedded targets | |
154 ifdef JAVASE_EMBEDDED | |
155 CFLAGS += -DJAVASE_EMBEDDED | |
156 endif | |
157 | |
158 # Keep temporary files (.ii, .s) | |
159 ifdef NEED_ASM | |
160 CFLAGS += -save-temps | |
161 else | |
162 CFLAGS += -pipe | |
163 endif | |
164 | |
165 # Compiler warnings are treated as errors | |
4006 | 166 ifneq ($(COMPILER_WARNINGS_FATAL),false) |
167 WARNINGS_ARE_ERRORS = -Werror | |
168 endif | |
3960 | 169 |
170 # Except for a few acceptable ones | |
171 # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit | |
172 # conversions which might affect the values. To avoid that, we need to turn | |
173 # it off explicitly. | |
174 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" | |
175 ACCEPTABLE_WARNINGS = -Wpointer-arith -Wsign-compare | |
176 else | |
177 ACCEPTABLE_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare | |
178 endif | |
179 | |
180 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ACCEPTABLE_WARNINGS) | |
181 # Special cases | |
182 CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) | |
183 # XXXDARWIN: for _dyld_bind_fully_image_containing_address | |
184 ifeq ($(OS_VENDOR), Darwin) | |
185 CFLAGS_WARN/os_bsd.o = $(CFLAGS_WARN/DEFAULT) -Wno-deprecated-declarations | |
186 endif | |
187 | |
188 | |
189 # The flags to use for an Optimized g++ build | |
4006 | 190 ifeq ($(OS_VENDOR), Darwin) |
191 # use -Os by default, unless -O3 can be proved to be worth the cost, as per policy | |
192 # <http://wikis.sun.com/display/OpenJDK/Mac+OS+X+Port+Compilers> | |
193 OPT_CFLAGS += -Os | |
194 else | |
195 OPT_CFLAGS += -O3 | |
196 endif | |
3960 | 197 |
198 # Hotspot uses very unstrict aliasing turn this optimization off | |
199 OPT_CFLAGS += -fno-strict-aliasing | |
200 | |
201 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp | |
202 # if we use expensive-optimizations | |
203 ifeq ($(BUILDARCH), ia64) | |
204 OPT_CFLAGS += -fno-expensive-optimizations | |
205 endif | |
206 | |
207 OPT_CFLAGS/NOOPT=-O0 | |
208 | |
209 # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation. | |
210 ifneq "$(shell expr \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) = 3 \) \))" "0" | |
211 OPT_CFLAGS/mulnode.o += -O0 | |
212 endif | |
213 | |
214 # Flags for generating make dependency flags. | |
215 ifneq ("${CC_VER_MAJOR}", "2") | |
216 DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d) | |
217 endif | |
218 | |
219 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp. | |
4129
f4414323345f
7116081: USE_PRECOMPILED_HEADER=0 triggers a single threaded build of the JVM
stefank
parents:
4033
diff
changeset
|
220 ifeq ($(USE_PRECOMPILED_HEADER),0) |
3960 | 221 CFLAGS += -DDONT_USE_PRECOMPILED_HEADER |
222 endif | |
223 | |
224 #------------------------------------------------------------------------ | |
225 # Linker flags | |
226 | |
227 # statically link libstdc++.so, work with gcc but ignored by g++ | |
228 STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic | |
229 | |
230 # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x. | |
231 ifneq ("${CC_VER_MAJOR}", "2") | |
232 STATIC_LIBGCC += -static-libgcc | |
233 endif | |
234 | |
235 ifeq ($(BUILDARCH), ia64) | |
236 LFLAGS += -Wl,-relax | |
237 endif | |
238 | |
239 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file. | |
240 MAPFLAG = -Xlinker --version-script=FILENAME | |
241 | |
242 # | |
243 # Shared Library | |
244 # | |
245 ifeq ($(OS_VENDOR), Darwin) | |
246 # Standard linker flags | |
247 LFLAGS += | |
248 | |
249 # Darwin doesn't use ELF and doesn't support version scripts | |
250 LDNOMAP = true | |
251 | |
252 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj | |
253 SONAMEFLAG = | |
254 | |
255 # Build shared library | |
4006 | 256 SHARED_FLAG = -Wl,-install_name,@rpath/$(@F) -dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $(VM_PICFLAG) |
3960 | 257 |
258 # Keep symbols even they are not used | |
259 #AOUT_FLAGS += -Xlinker -export-dynamic | |
260 else | |
261 # Enable linker optimization | |
262 LFLAGS += -Xlinker -O1 | |
263 | |
264 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj | |
265 SONAMEFLAG = -Xlinker -soname=SONAME | |
266 | |
267 # Build shared library | |
268 SHARED_FLAG = -shared $(VM_PICFLAG) | |
269 | |
270 # Keep symbols even they are not used | |
271 AOUT_FLAGS += -Xlinker -export-dynamic | |
272 endif | |
273 | |
274 #------------------------------------------------------------------------ | |
275 # Debug flags | |
276 | |
277 # Use the stabs format for debugging information (this is the default | |
278 # on gcc-2.91). It's good enough, has all the information about line | |
279 # numbers and local variables, and libjvm_g.so is only about 16M. | |
280 # Change this back to "-g" if you want the most expressive format. | |
281 # (warning: that could easily inflate libjvm_g.so to 150M!) | |
282 # Note: The Itanium gcc compiler crashes when using -gstabs. | |
283 DEBUG_CFLAGS/ia64 = -g | |
284 DEBUG_CFLAGS/amd64 = -g | |
285 DEBUG_CFLAGS/arm = -g | |
286 DEBUG_CFLAGS/ppc = -g | |
287 DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH)) | |
288 ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),) | |
289 DEBUG_CFLAGS += -gstabs | |
290 endif | |
291 | |
292 # DEBUG_BINARIES overrides everything, use full -g debug information | |
293 ifeq ($(DEBUG_BINARIES), true) | |
294 DEBUG_CFLAGS = -g | |
295 CFLAGS += $(DEBUG_CFLAGS) | |
296 endif | |
297 | |
298 # If we are building HEADLESS, pass on to VM | |
299 # so it can set the java.awt.headless property | |
300 ifdef HEADLESS | |
301 CFLAGS += -DHEADLESS | |
302 endif | |
303 | |
304 # We are building Embedded for a small device | |
305 # favor code space over speed | |
306 ifdef MINIMIZE_RAM_USAGE | |
307 CFLAGS += -DMINIMIZE_RAM_USAGE | |
308 endif |