Print this page
rev 7128 : 8074010: followup to 8072383
Summary: move arm and gcc logic from open gcc.make to closed
Reviewed-by: dholmes, kvn
Split |
Split |
Close |
Expand all |
Collapse all |
--- old/hotspot/make/linux/makefiles/gcc.make
+++ new/hotspot/make/linux/makefiles/gcc.make
1 1 #
2 2 # Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
3 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 4 #
5 5 # This code is free software; you can redistribute it and/or modify it
6 6 # under the terms of the GNU General Public License version 2 only, as
7 7 # published by the Free Software Foundation.
8 8 #
9 9 # This code is distributed in the hope that it will be useful, but WITHOUT
10 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 12 # version 2 for more details (a copy is included in the LICENSE file that
13 13 # accompanied this code).
14 14 #
15 15 # You should have received a copy of the GNU General Public License version
16 16 # 2 along with this work; if not, write to the Free Software Foundation,
17 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 18 #
19 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 20 # or visit www.oracle.com if you need additional information or have any
21 21 # questions.
22 22 #
23 23 #
24 24
25 25 #------------------------------------------------------------------------
26 26 # CC, CXX & AS
27 27
28 28 # If a SPEC is not set already, then use these defaults.
29 29 ifeq ($(SPEC),)
30 30 # When cross-compiling the ALT_COMPILER_PATH points
31 31 # to the cross-compilation toolset
32 32 ifdef CROSS_COMPILE_ARCH
33 33 CXX = $(ALT_COMPILER_PATH)/g++
34 34 CC = $(ALT_COMPILER_PATH)/gcc
35 35 HOSTCXX = g++
36 36 HOSTCC = gcc
37 37 STRIP = $(ALT_COMPILER_PATH)/strip
38 38 else
39 39 ifeq ($(USE_CLANG), true)
40 40 CXX = clang++
41 41 CC = clang
42 42 else
43 43 CXX = g++
44 44 CC = gcc
45 45 endif
46 46
47 47 HOSTCXX = $(CXX)
48 48 HOSTCC = $(CC)
49 49 STRIP = strip
50 50 endif
51 51 AS = $(CC) -c
52 52 endif
53 53
54 54
55 55 ifeq ($(USE_CLANG), true)
56 56 CC_VER_MAJOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f1)
57 57 CC_VER_MINOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f2)
58 58 else
59 59 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
60 60 # prints the numbers (e.g. "2.95", "3.2.1")
61 61 CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
62 62 CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
63 63 endif
64 64
65 65
66 66 ifeq ($(USE_CLANG), true)
67 67 # Clang has precompiled headers support by default, but the user can switch
68 68 # it off by using 'USE_PRECOMPILED_HEADER=0'.
69 69 ifdef LP64
70 70 ifeq ($(USE_PRECOMPILED_HEADER),)
71 71 USE_PRECOMPILED_HEADER=1
72 72 endif
73 73 else
74 74 # We don't support precompiled headers on 32-bit builds because there some files are
75 75 # compiled with -fPIC while others are compiled without (see 'NONPIC_OBJ_FILES' rules.make)
76 76 # Clang produces an error if the PCH file was compiled with other options than the actual compilation unit.
77 77 USE_PRECOMPILED_HEADER=0
78 78 endif
79 79
80 80 ifeq ($(USE_PRECOMPILED_HEADER),1)
81 81
82 82 ifndef LP64
83 83 $(error " Precompiled Headers only supported on 64-bit platforms!")
84 84 endif
85 85
86 86 PRECOMPILED_HEADER_DIR=.
87 87 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
88 88 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.pch
89 89
90 90 PCH_FLAG = -include precompiled.hpp
91 91 PCH_FLAG/DEFAULT = $(PCH_FLAG)
92 92 PCH_FLAG/NO_PCH = -DNO_PCH
93 93 PCH_FLAG/BY_FILE = $(PCH_FLAG/$@)$(PCH_FLAG/DEFAULT$(PCH_FLAG/$@))
94 94
95 95 VM_PCH_FLAG/LIBJVM = $(PCH_FLAG/BY_FILE)
96 96 VM_PCH_FLAG/AOUT =
97 97 VM_PCH_FLAG = $(VM_PCH_FLAG/$(LINK_INTO))
98 98
99 99 # We only use precompiled headers for the JVM build
100 100 CFLAGS += $(VM_PCH_FLAG)
101 101
102 102 # There are some files which don't like precompiled headers
103 103 # The following files are build with 'OPT_CFLAGS/NOOPT' (-O0) in the opt build.
104 104 # But Clang doesn't support a precompiled header which was compiled with -O3
105 105 # to be used in a compilation unit which uses '-O0'. We could also prepare an
106 106 # extra '-O0' PCH file for the opt build and use it here, but it's probably
107 107 # not worth the effoert as long as only two files need this special handling.
108 108 PCH_FLAG/loopTransform.o = $(PCH_FLAG/NO_PCH)
109 109 PCH_FLAG/sharedRuntimeTrig.o = $(PCH_FLAG/NO_PCH)
110 110 PCH_FLAG/sharedRuntimeTrans.o = $(PCH_FLAG/NO_PCH)
111 111
112 112 endif
113 113 else # ($(USE_CLANG), true)
114 114 # check for precompiled headers support
115 115 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
116 116 # Allow the user to turn off precompiled headers from the command line.
117 117 ifneq ($(USE_PRECOMPILED_HEADER),0)
118 118 PRECOMPILED_HEADER_DIR=.
119 119 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
120 120 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
121 121 endif
122 122 endif
123 123 endif
124 124
125 125 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
126 126 ifeq ($(USE_PRECOMPILED_HEADER),0)
127 127 CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
128 128 endif
129 129
130 130
131 131 #------------------------------------------------------------------------
132 132 # Compiler flags
133 133
134 134 # position-independent code
135 135 PICFLAG = -fPIC
136 136
137 137 VM_PICFLAG/LIBJVM = $(PICFLAG)
138 138 VM_PICFLAG/AOUT =
139 139 VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO))
140 140
141 141 ifeq ($(JVM_VARIANT_ZERO), true)
142 142 CFLAGS += $(LIBFFI_CFLAGS)
143 143 endif
144 144 ifeq ($(JVM_VARIANT_ZEROSHARK), true)
145 145 CFLAGS += $(LIBFFI_CFLAGS)
146 146 CFLAGS += $(LLVM_CFLAGS)
147 147 endif
148 148 CFLAGS += $(VM_PICFLAG)
149 149 CFLAGS += -fno-rtti
150 150 CFLAGS += -fno-exceptions
151 151 CFLAGS += -D_REENTRANT
152 152 ifeq ($(USE_CLANG),)
153 153 CFLAGS += -fcheck-new
154 154 # version 4 and above support fvisibility=hidden (matches jni_x86.h file)
155 155 # except 4.1.2 gives pointless warnings that can't be disabled (afaik)
156 156 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
157 157 CFLAGS += -fvisibility=hidden
158 158 endif
159 159 else
160 160 CFLAGS += -fvisibility=hidden
161 161 endif
162 162
163 163 ifeq ($(USE_CLANG), true)
164 164 # Before Clang 3.1, we had to pass the stack alignment specification directly to llvm with the help of '-mllvm'
165 165 # Starting with version 3.1, Clang understands the '-mstack-alignment' (and rejects '-mllvm -stack-alignment')
166 166 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 1 \) \))" "0"
167 167 STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mstack-alignment=16
168 168 else
169 169 STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mllvm -stack-alignment=16
170 170 endif
171 171 endif
172 172
173 173 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
174 174 ARCHFLAG/i486 = -m32 -march=i586
175 175 ARCHFLAG/amd64 = -m64 $(STACK_ALIGNMENT_OPT)
176 176 ARCHFLAG/ia64 =
177 177 ARCHFLAG/sparc = -m32 -mcpu=v9
178 178 ARCHFLAG/sparcv9 = -m64 -mcpu=v9
179 179 ARCHFLAG/zero = $(ZERO_ARCHFLAG)
180 180 ARCHFLAG/ppc64 = -m64
181 181
182 182 CFLAGS += $(ARCHFLAG)
183 183 AOUT_FLAGS += $(ARCHFLAG)
184 184 LFLAGS += $(ARCHFLAG)
185 185 ASFLAGS += $(ARCHFLAG)
186 186
187 187 # Use C++ Interpreter
188 188 ifdef CC_INTERP
189 189 CFLAGS += -DCC_INTERP
190 190 endif
191 191
192 192 # Keep temporary files (.ii, .s)
193 193 ifdef NEED_ASM
194 194 CFLAGS += -save-temps
195 195 else
196 196 CFLAGS += -pipe
197 197 endif
198 198
199 199 # Compiler warnings are treated as errors
200 200 WARNINGS_ARE_ERRORS = -Werror
201 201
202 202 ifeq ($(USE_CLANG), true)
203 203 # However we need to clean the code up before we can unrestrictedly enable this option with Clang
204 204 WARNINGS_ARE_ERRORS += -Wno-logical-op-parentheses -Wno-parentheses-equality -Wno-parentheses
205 205 WARNINGS_ARE_ERRORS += -Wno-switch -Wno-tautological-constant-out-of-range-compare -Wno-tautological-compare
206 206 WARNINGS_ARE_ERRORS += -Wno-delete-non-virtual-dtor -Wno-deprecated -Wno-format -Wno-dynamic-class-memaccess
207 207 WARNINGS_ARE_ERRORS += -Wno-return-type -Wno-empty-body
208 208 endif
209 209
210 210 WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value
211 211
212 212 ifeq ($(USE_CLANG),)
213 213 # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
214 214 # conversions which might affect the values. Only enable it in earlier versions.
215 215 ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
216 216 WARNING_FLAGS += -Wconversion
217 217 endif
218 218 endif
219 219
220 220 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS)
221 221 # Special cases
222 222 CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))
223 223
224 224 # The flags to use for an Optimized g++ build
225 225 OPT_CFLAGS/SIZE=-Os
226 226 OPT_CFLAGS/SPEED=-O3
227 227
228 228 # Hotspot uses very unstrict aliasing turn this optimization off
229 229 # This option is added to CFLAGS rather than OPT_CFLAGS
230 230 # so that OPT_CFLAGS overrides get this option too.
231 231 CFLAGS += -fno-strict-aliasing
232 232
233 233 OPT_CFLAGS_DEFAULT ?= SPEED
234 234
235 235 ifdef OPT_CFLAGS
236 236 ifneq ("$(origin OPT_CFLAGS)", "command line")
237 237 $(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.")
238 238 endif
239 239 endif
240 240
241 241 OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS)
242 242
243 243 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp
244 244 # if we use expensive-optimizations
245 245 ifeq ($(BUILDARCH), ia64)
246 246 OPT_CFLAGS += -fno-expensive-optimizations
247 247 endif
248 248
249 249 OPT_CFLAGS/NOOPT=-O0
250 250
251 251 # Work around some compiler bugs.
252 252 ifeq ($(USE_CLANG), true)
253 253 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1)
254 254 OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
255 255 endif
256 256 else
257 257 # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation.
258 258 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1)
259 259 OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT)
260 260 endif
261 261 endif
262 262
263 263 # Flags for generating make dependency flags.
264 264 DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
265 265 ifeq ($(USE_CLANG),)
266 266 ifneq ("${CC_VER_MAJOR}", "2")
267 267 DEPFLAGS += -fpch-deps
268 268 endif
269 269 endif
270 270
271 271 #------------------------------------------------------------------------
272 272 # Linker flags
273 273
274 274 # statically link libstdc++.so, work with gcc but ignored by g++
275 275 STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
276 276
277 277 ifeq ($(USE_CLANG),)
278 278 # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
279 279 ifneq ("${CC_VER_MAJOR}", "2")
280 280 STATIC_LIBGCC += -static-libgcc
281 281 endif
282 282
283 283 ifeq ($(BUILDARCH), ia64)
284 284 LFLAGS += -Wl,-relax
285 285 endif
286 286 endif
287 287
288 288 # Enable linker optimization
289 289 LFLAGS += -Xlinker -O1
290 290
291 291 ifeq ($(USE_CLANG),)
292 292 # If this is a --hash-style=gnu system, use --hash-style=both
293 293 # The gnu .hash section won't work on some Linux systems like SuSE 10.
294 294 _HAS_HASH_STYLE_GNU:=$(shell $(CC) -dumpspecs | grep -- '--hash-style=gnu')
295 295 ifneq ($(_HAS_HASH_STYLE_GNU),)
296 296 LDFLAGS_HASH_STYLE = -Wl,--hash-style=both
297 297 endif
298 298 else
299 299 # Don't know how to find out the 'hash style' of a system as '-dumpspecs'
300 300 # doesn't work for Clang. So for now we'll alwys use --hash-style=both
301 301 LDFLAGS_HASH_STYLE = -Wl,--hash-style=both
302 302 endif
303 303
304 304 LFLAGS += $(LDFLAGS_HASH_STYLE)
305 305
306 306 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
307 307 MAPFLAG = -Xlinker --version-script=FILENAME
308 308
309 309 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
310 310 SONAMEFLAG = -Xlinker -soname=SONAME
311 311
312 312 # Build shared library
313 313 SHARED_FLAG = -shared
314 314
315 315 # Keep symbols even they are not used
316 316 AOUT_FLAGS += -Xlinker -export-dynamic
317 317
318 318 #------------------------------------------------------------------------
319 319 # Debug flags
320 320
321 321 ifeq ($(USE_CLANG), true)
322 322 # Restrict the debug information created by Clang to avoid
323 323 # too big object files and speed the build up a little bit
324 324 # (see http://llvm.org/bugs/show_bug.cgi?id=7554)
325 325 CFLAGS += -flimit-debug-info
326 326 endif
327 327
328 328 # DEBUG_BINARIES uses full -g debug information for all configs
329 329 ifeq ($(DEBUG_BINARIES), true)
↓ open down ↓ |
329 lines elided |
↑ open up ↑ |
330 330 CFLAGS += -g
331 331 else
332 332 # Use the stabs format for debugging information (this is the default
333 333 # on gcc-2.91). It's good enough, has all the information about line
334 334 # numbers and local variables, and libjvm.so is only about 16M.
335 335 # Change this back to "-g" if you want the most expressive format.
336 336 # (warning: that could easily inflate libjvm.so to 150M!)
337 337 # Note: The Itanium gcc compiler crashes when using -gstabs.
338 338 DEBUG_CFLAGS/ia64 = -g
339 339 DEBUG_CFLAGS/amd64 = -g
340 - DEBUG_CFLAGS/arm = -g
341 - DEBUG_CFLAGS/ppc = -g
342 340 DEBUG_CFLAGS/ppc64 = -g
343 341 DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
344 342 ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
345 343 ifeq ($(USE_CLANG), true)
346 344 # Clang doesn't understand -gstabs
347 - DEBUG_CFLAGS += -g
345 + DEBUG_CFLAGS/$(BUILDARCH) = -g
348 346 else
349 - DEBUG_CFLAGS += -gstabs
347 + DEBUG_CFLAGS/$(BUILDARCH) = -gstabs
350 348 endif
351 349 endif
352 350
353 351 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
354 352 FASTDEBUG_CFLAGS/ia64 = -g
355 353 FASTDEBUG_CFLAGS/amd64 = -g
356 - FASTDEBUG_CFLAGS/arm = -g
357 - FASTDEBUG_CFLAGS/ppc = -g
358 354 FASTDEBUG_CFLAGS/ppc64 = -g
359 - FASTDEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
355 + FASTDEBUG_CFLAGS += $(FASTDEBUG_CFLAGS/$(BUILDARCH))
360 356 ifeq ($(FASTDEBUG_CFLAGS/$(BUILDARCH)),)
361 357 ifeq ($(USE_CLANG), true)
362 358 # Clang doesn't understand -gstabs
363 - FASTDEBUG_CFLAGS += -g
359 + FASTDEBUG_CFLAGS/$(BUILDARCH) = -g
364 360 else
365 - FASTDEBUG_CFLAGS += -gstabs
361 + FASTDEBUG_CFLAGS/$(BUILDARCH) = -gstabs
366 362 endif
367 363 endif
368 364
369 365 OPT_CFLAGS/ia64 = -g
370 366 OPT_CFLAGS/amd64 = -g
371 - OPT_CFLAGS/arm = -g
372 - OPT_CFLAGS/ppc = -g
373 367 OPT_CFLAGS/ppc64 = -g
374 368 OPT_CFLAGS += $(OPT_CFLAGS/$(BUILDARCH))
375 369 ifeq ($(OPT_CFLAGS/$(BUILDARCH)),)
376 370 ifeq ($(USE_CLANG), true)
377 371 # Clang doesn't understand -gstabs
378 - OPT_CFLAGS += -g
372 + OPT_CFLAGS/$(BUILDARCH) = -g
379 373 else
380 - OPT_CFLAGS += -gstabs
374 + OPT_CFLAGS/$(BUILDARCH) = -gstabs
381 375 endif
382 376 endif
383 377 endif
384 378 endif
385 379
386 380 # If we are building HEADLESS, pass on to VM
387 381 # so it can set the java.awt.headless property
388 382 ifdef HEADLESS
389 383 CFLAGS += -DHEADLESS
390 384 endif
391 385
392 386 # We are building Embedded for a small device
393 387 # favor code space over speed
394 388 ifdef MINIMIZE_RAM_USAGE
395 389 CFLAGS += -DMINIMIZE_RAM_USAGE
396 390 endif
397 391
398 392 # Stack walking in the JVM relies on frame pointer (%rbp) to walk thread stack.
399 393 # Explicitly specify -fno-omit-frame-pointer because it is off by default
400 394 # starting with gcc 4.6.
401 395 ifndef USE_SUNCC
402 396 CFLAGS += -fno-omit-frame-pointer
403 397 endif
404 398
405 399 -include $(HS_ALT_MAKE)/linux/makefiles/gcc.make
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX