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