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