Thu, 23 Oct 2008 10:13:01 -0700
Added tag jdk7-b38 for changeset d9bc824aa078
1 #
2 # Copyright 1998-2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 # CA 95054 USA or visit www.sun.com if you need additional information or
21 # have any questions.
22 #
23 #
25 # Compiler-specific flags for sparcworks.
27 # tell make which C and C++ compilers to use
28 CC = cc
29 CPP = CC
31 # Note that this 'as' is an older version of the Sun Studio 'fbe', and will
32 # use the older style options. The 'fbe' options will match 'cc' and 'CC'.
33 AS = /usr/ccs/bin/as
35 NM = /usr/ccs/bin/nm
36 NAWK = /bin/nawk
38 REORDER_FLAG = -xF
40 # Check for the versions of C++ and C compilers ($CPP and $CC) used.
42 # Get the last thing on the line that looks like x.x+ (x is a digit).
43 COMPILER_REV := \
44 $(shell $(CPP) -V 2>&1 | sed -e 's/^.*\([1-9]\.[0-9][0-9]*\).*/\1/')
45 C_COMPILER_REV := \
46 $(shell $(CC) -V 2>&1 | grep -i "cc:" | sed -e 's/^.*\([1-9]\.[0-9][0-9]*\).*/\1/')
48 # Pick which compiler is validated
49 ifeq ($(JDK_MINOR_VERSION),6)
50 # Validated compiler for JDK6 is SS11 (5.8)
51 VALIDATED_COMPILER_REV := 5.8
52 VALIDATED_C_COMPILER_REV := 5.8
53 else
54 # Validated compiler for JDK7 is SS12 (5.9)
55 VALIDATED_COMPILER_REV := 5.9
56 VALIDATED_C_COMPILER_REV := 5.9
57 endif
59 # Warning messages about not using the above validated version
60 ENFORCE_COMPILER_REV${ENFORCE_COMPILER_REV} := ${VALIDATED_COMPILER_REV}
61 ifneq (${COMPILER_REV},${ENFORCE_COMPILER_REV})
62 dummy_target_to_enforce_compiler_rev:=\
63 $(info WARNING: You are using CC version ${COMPILER_REV} \
64 and should be using version ${ENFORCE_COMPILER_REV})
65 endif
67 ENFORCE_C_COMPILER_REV${ENFORCE_C_COMPILER_REV} := ${VALIDATED_C_COMPILER_REV}
68 ifneq (${C_COMPILER_REV},${ENFORCE_C_COMPILER_REV})
69 dummy_target_to_enforce_c_compiler_rev:=\
70 $(info WARNING: You are using cc version ${C_COMPILER_REV} \
71 and should be using version ${ENFORCE_C_COMPILER_REV})
72 endif
74 # Fail the build if __fabsf is used. __fabsf exists only in Solaris 8 2/04
75 # and newer; objects with a dependency on this symbol will not run on older
76 # Solaris 8.
77 JVM_FAIL_IF_UNDEFINED = __fabsf
79 JVM_CHECK_SYMBOLS = $(NM) -u -p $(LIBJVM.o) | \
80 $(NAWK) -v f="${JVM_FAIL_IF_UNDEFINED}" \
81 'BEGIN { c=split(f,s); rc=0; } \
82 /:$$/ { file = $$1; } \
83 /[^:]$$/ { for(n=1;n<=c;++n) { \
84 if($$1==s[n]) { \
85 printf("JVM_CHECK_SYMBOLS: %s contains illegal symbol %s\n", \
86 file,$$1); \
87 rc=1; \
88 } \
89 } \
90 } \
91 END { exit rc; }'
93 LINK_LIB.CC/PRE_HOOK += $(JVM_CHECK_SYMBOLS) || exit 1;
95 # Some interfaces (_lwp_create) changed with LP64 and Solaris 7
96 SOLARIS_7_OR_LATER := \
97 $(shell uname -r | awk -F. '{ if ($$2 >= 7) print "-DSOLARIS_7_OR_LATER"; }')
98 CFLAGS += ${SOLARIS_7_OR_LATER}
100 # New architecture options started in SS12 (5.9), we need both styles to build.
101 # The older arch options for SS11 (5.8) or older and also for /usr/ccs/bin/as.
102 # Note: SS12 default for 32bit sparc is now the same as v8plus, so the
103 # settings below have changed all SS12 32bit sparc builds to be v8plus.
104 # The older SS11 (5.8) settings have remained as they always have been.
105 ifeq ($(TYPE),COMPILER2)
106 ARCHFLAG_OLD/sparc = -xarch=v8plus
107 else
108 ifeq ($(TYPE),TIERED)
109 ARCHFLAG_OLD/sparc = -xarch=v8plus
110 else
111 ARCHFLAG_OLD/sparc = -xarch=v8
112 endif
113 endif
114 ARCHFLAG_NEW/sparc = -m32 -xarch=sparc
115 ARCHFLAG_OLD/sparcv9 = -xarch=v9
116 ARCHFLAG_NEW/sparcv9 = -m64 -xarch=sparc
117 ARCHFLAG_OLD/i486 =
118 ARCHFLAG_NEW/i486 = -m32
119 ARCHFLAG_OLD/amd64 = -xarch=amd64
120 ARCHFLAG_NEW/amd64 = -m64
122 # Select the ARCHFLAGs and other SS12 (5.9) options
123 ifeq ($(shell expr $(COMPILER_REV) \>= 5.9), 1)
124 ARCHFLAG/sparc = $(ARCHFLAG_NEW/sparc)
125 ARCHFLAG/sparcv9 = $(ARCHFLAG_NEW/sparcv9)
126 ARCHFLAG/i486 = $(ARCHFLAG_NEW/i486)
127 ARCHFLAG/amd64 = $(ARCHFLAG_NEW/amd64)
128 else
129 ARCHFLAG/sparc = $(ARCHFLAG_OLD/sparc)
130 ARCHFLAG/sparcv9 = $(ARCHFLAG_OLD/sparcv9)
131 ARCHFLAG/i486 = $(ARCHFLAG_OLD/i486)
132 ARCHFLAG/amd64 = $(ARCHFLAG_OLD/amd64)
133 endif
135 # ARCHFLAGS for the current build arch
136 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
137 AS_ARCHFLAG = $(ARCHFLAG_OLD/$(BUILDARCH))
139 # Optional sub-directory in /usr/lib where BUILDARCH libraries are kept.
140 ISA_DIR=$(ISA_DIR/$(BUILDARCH))
141 ISA_DIR/sparcv9=/sparcv9
142 ISA_DIR/amd64=/amd64
144 # Use these to work around compiler bugs:
145 OPT_CFLAGS/SLOWER=-xO3
146 OPT_CFLAGS/O2=-xO2
147 OPT_CFLAGS/NOOPT=-xO1
149 #################################################
150 # Begin current (>=5.6) Forte compiler options #
151 #################################################
153 ifeq ($(shell expr $(COMPILER_REV) \>= 5.6), 1)
155 ifeq ("${Platform_arch}", "sparc")
157 # We MUST allow data alignment of 4 for sparc (sparcv9 is ok at 8s)
158 ifndef LP64
159 CFLAGS += -xmemalign=4s
160 endif
162 endif
164 endif
166 #################################################
167 # Begin current (>=5.5) Forte compiler options #
168 #################################################
170 ifeq ($(shell expr $(COMPILER_REV) \>= 5.5), 1)
172 CFLAGS += $(ARCHFLAG)
173 AOUT_FLAGS += $(ARCHFLAG)
174 LIB_FLAGS += $(ARCHFLAG)
175 LFLAGS += $(ARCHFLAG)
177 ifeq ("${Platform_arch}", "sparc")
179 # Flags for Optimization
181 # [phh] Commented out pending verification that we do indeed want
182 # to potentially bias against u1 and u3 targets.
183 #CFLAGS += -xchip=ultra2
185 OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS)
187 endif # sparc
189 ifeq ("${Platform_arch_model}", "x86_32")
191 OPT_CFLAGS=-xtarget=pentium $(EXTRA_OPT_CFLAGS)
193 # UBE (CC 5.5) has bug 4923569 with -xO4
194 OPT_CFLAGS+=-xO3
196 endif # 32bit x86
198 ifeq ("${Platform_arch_model}", "x86_64")
200 ASFLAGS += $(AS_ARCHFLAG)
201 CFLAGS += $(ARCHFLAG/amd64)
202 # this one seemed useless
203 LFLAGS_VM += $(ARCHFLAG/amd64)
204 # this one worked
205 LFLAGS += $(ARCHFLAG/amd64)
206 AOUT_FLAGS += $(ARCHFLAG/amd64)
208 # -xO3 is faster than -xO4 on specjbb with SS10 compiler
209 OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS)
211 endif # 64bit x86
213 # Inline functions
214 CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_${Platform_arch}/vm/solaris_${Platform_arch_model}.il
216 # no more exceptions
217 CFLAGS/NOEX=-features=no%except
220 # avoid compilation problems arising from fact that C++ compiler tries
221 # to search for external template definition by just compiling additional
222 # source files in th same context
223 CFLAGS += -template=no%extdef
225 # Reduce code bloat by reverting back to 5.0 behavior for static initializers
226 CFLAGS += -features=no%split_init
228 # Use -D_Crun_inline_placement so we don't get references to
229 # __1c2n6FIpv_0_ or void*operator new(unsigned,void*)
230 # This avoids the hard requirement of the newer Solaris C++ runtime patches.
231 # NOTE: This is an undocumented feature of the SS10 compiler. See 6306698.
232 CFLAGS += -D_Crun_inline_placement
234 # PIC is safer for SPARC, and is considerably slower
235 # a file foo.o which wants to compile -pic can set "PICFLAG/foo.o = -PIC"
236 PICFLAG = -KPIC
237 PICFLAG/DEFAULT = $(PICFLAG)
238 # [RGV] Need to figure which files to remove to get link to work
239 #PICFLAG/BETTER = -pic
240 PICFLAG/BETTER = $(PICFLAG/DEFAULT)
241 PICFLAG/BYFILE = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@))
243 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
244 MAPFLAG = -M FILENAME
246 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
247 SONAMEFLAG = -h SONAME
249 # Build shared library
250 SHARED_FLAG = -G
252 # We don't need libCstd.so and librwtools7.so, only libCrun.so
253 CFLAGS += -library=%none
254 LFLAGS += -library=%none
256 LFLAGS += -mt
258 endif # COMPILER_REV >= 5.5
260 ######################################
261 # End 5.5 Forte compiler options #
262 ######################################
264 ######################################
265 # Begin 5.2 Forte compiler options #
266 ######################################
268 ifeq ($(COMPILER_REV), 5.2)
270 CFLAGS += $(ARCHFLAG)
271 AOUT_FLAGS += $(ARCHFLAG)
272 LIB_FLAGS += $(ARCHFLAG)
273 LFLAGS += $(ARCHFLAG)
275 ifeq ("${Platform_arch}", "sparc")
277 # Flags for Optimization
279 # [phh] Commented out pending verification that we do indeed want
280 # to potentially bias against u1 and u3 targets.
281 #CFLAGS += -xchip=ultra2
283 ifdef LP64
284 # SC5.0 tools on v9 are flakey at -xO4
285 # [phh] Is this still true for 6.1?
286 OPT_CFLAGS=-xO3 $(EXTRA_OPT_CFLAGS)
287 else
288 OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS)
289 endif
291 CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_sparc/vm/solaris_sparc.il
293 endif # sparc
295 ifeq ("${Platform_arch_model}", "x86_32")
297 OPT_CFLAGS=-xtarget=pentium $(EXTRA_OPT_CFLAGS)
299 # SC5.0 tools on x86 are flakey at -xO4
300 # [phh] Is this still true for 6.1?
301 OPT_CFLAGS+=-xO3
303 CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_x86/vm/solaris_x86_32.il
305 endif # 32bit x86
307 # no more exceptions
308 CFLAGS/NOEX=-noex
310 # Reduce code bloat by reverting back to 5.0 behavior for static initializers
311 CFLAGS += -Qoption ccfe -one_static_init
313 # PIC is safer for SPARC, and is considerably slower
314 # a file foo.o which wants to compile -pic can set "PICFLAG/foo.o = -PIC"
315 PICFLAG = -KPIC
316 PICFLAG/DEFAULT = $(PICFLAG)
317 # [RGV] Need to figure which files to remove to get link to work
318 #PICFLAG/BETTER = -pic
319 PICFLAG/BETTER = $(PICFLAG/DEFAULT)
320 PICFLAG/BYFILE = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@))
322 # Would be better if these weren't needed, since we link with CC, but
323 # at present removing them causes run-time errors
324 LFLAGS += -library=Crun
325 LIBS += -library=Crun -lCrun
327 endif # COMPILER_REV == 5.2
329 ##################################
330 # End 5.2 Forte compiler options #
331 ##################################
333 ##################################
334 # Begin old 5.1 compiler options #
335 ##################################
336 ifeq ($(COMPILER_REV), 5.1)
338 _JUNK_ := $(shell echo >&2 \
339 "*** ERROR: sparkWorks.make incomplete for 5.1 compiler")
340 @exit 1
341 endif
342 ##################################
343 # End old 5.1 compiler options #
344 ##################################
346 ##################################
347 # Begin old 5.0 compiler options #
348 ##################################
350 ifeq (${COMPILER_REV}, 5.0)
352 # Had to hoist this higher apparently because of other changes. Must
353 # come before -xarch specification.
354 # NOTE: native says optimize for the machine doing the compile, bad news.
355 CFLAGS += -xtarget=native
357 CFLAGS += $(ARCHFLAG)
358 AOUT_FLAGS += $(ARCHFLAG)
359 LIB_FLAGS += $(ARCHFLAG)
360 LFLAGS += $(ARCHFLAG)
362 CFLAGS += -library=iostream
363 LFLAGS += -library=iostream -library=Crun
364 LIBS += -library=iostream -library=Crun -lCrun
366 # Flags for Optimization
367 ifdef LP64
368 # SC5.0 tools on v9 are flakey at -xO4
369 OPT_CFLAGS=-xO3 $(EXTRA_OPT_CFLAGS)
370 else
371 OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS)
372 endif
374 ifeq ("${Platform_arch}", "sparc")
376 CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.il
378 endif # sparc
380 ifeq ("${Platform_arch_model}", "x86_32")
381 OPT_CFLAGS=-xtarget=pentium $(EXTRA_OPT_CFLAGS)
382 ifeq ("${COMPILER_REV}", "5.0")
383 # SC5.0 tools on x86 are flakey at -xO4
384 OPT_CFLAGS+=-xO3
385 else
386 OPT_CFLAGS+=-xO4
387 endif
389 CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_x86/vm/solaris_x86_32.il
391 endif # 32bit x86
393 # The following options run into misaligned ldd problem (raj)
394 #OPT_CFLAGS = -fast -O4 $(ARCHFLAG/sparc) -xchip=ultra
396 # no more exceptions
397 CFLAGS/NOEX=-noex
399 # PIC is safer for SPARC, and is considerably slower
400 # a file foo.o which wants to compile -pic can set "PICFLAG/foo.o = -PIC"
401 PICFLAG = -PIC
402 PICFLAG/DEFAULT = $(PICFLAG)
403 # [RGV] Need to figure which files to remove to get link to work
404 #PICFLAG/BETTER = -pic
405 PICFLAG/BETTER = $(PICFLAG/DEFAULT)
406 PICFLAG/BYFILE = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@))
408 endif # COMPILER_REV = 5.0
410 ################################
411 # End old 5.0 compiler options #
412 ################################
414 ifeq ("${COMPILER_REV}", "4.2")
415 # 4.2 COMPILERS SHOULD NO LONGER BE USED
416 _JUNK_ := $(shell echo >&2 \
417 "*** ERROR: SC4.2 compilers are not supported by this code base!")
418 @exit 1
419 endif
421 # do not include shared lib path in a.outs
422 AOUT_FLAGS += -norunpath
423 LFLAGS_VM = -norunpath -z noversion
425 # need position-indep-code for shared libraries
426 # (ild appears to get errors on PIC code, so we'll try non-PIC for debug)
427 ifeq ($(PICFLAGS),DEFAULT)
428 VM_PICFLAG/LIBJVM = $(PICFLAG/DEFAULT)
429 else
430 VM_PICFLAG/LIBJVM = $(PICFLAG/BYFILE)
431 endif
432 VM_PICFLAG/AOUT =
434 VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO))
435 CFLAGS += $(VM_PICFLAG)
437 # less dynamic linking (no PLTs, please)
438 #LIB_FLAGS += $(LINK_MODE)
439 # %%%%% despite -znodefs, -Bsymbolic gets link errors -- Rose
441 LINK_MODE = $(LINK_MODE/$(VERSION))
442 LINK_MODE/debug =
443 LINK_MODE/optimized = -Bsymbolic -znodefs
445 # Have thread local errnos
446 ifeq ($(shell expr $(COMPILER_REV) \>= 5.5), 1)
447 CFLAGS += -mt
448 else
449 CFLAGS += -D_REENTRANT
450 endif
452 ifdef CC_INTERP
453 # C++ Interpreter
454 CFLAGS += -DCC_INTERP
455 endif
457 # Flags for Debugging
458 DEBUG_CFLAGS = -g
459 FASTDEBUG_CFLAGS = -g0
460 # The -g0 setting allows the C++ frontend to inline, which is a big win.
462 # Special global options for SS12
463 ifeq ($(COMPILER_REV),5.9)
464 # There appears to be multiple issues with the new Dwarf2 debug format, so
465 # we tell the compiler to use the older 'stabs' debug format all the time.
466 # Note that this needs to be used in optimized compiles too to be 100%.
467 # This is a workaround for SS12 (5.9) bug 6694600
468 CFLAGS += -xdebugformat=stabs
469 endif
471 # Enable the following CFLAGS additions if you need to compare the
472 # built ELF objects.
473 #
474 # The -g option makes static data global and the "-Qoption ccfe
475 # -xglobalstatic" option tells the compiler to not globalize static
476 # data using a unique globalization prefix. Instead force the use of
477 # a static globalization prefix based on the source filepath so the
478 # objects from two identical compilations are the same.
479 #DEBUG_CFLAGS += -Qoption ccfe -xglobalstatic
480 #FASTDEBUG_CFLAGS += -Qoption ccfe -xglobalstatic
482 ifeq (${COMPILER_REV}, 5.2)
483 COMPILER_DATE := $(shell $(CPP) -V 2>&1 | awk '{ print $$NF; }')
484 ifeq (${COMPILER_DATE}, 2001/01/31)
485 # disable -g0 in fastdebug since SC6.1 dated 2001/01/31 seems to be buggy
486 # use an innocuous value because it will get -g if it's empty
487 FASTDEBUG_CFLAGS = -c
488 endif
489 endif
491 # Uncomment or 'gmake CFLAGS_BROWSE=-sbfast' to get source browser information.
492 # CFLAGS_BROWSE = -sbfast
493 CFLAGS += $(CFLAGS_BROWSE)
495 # ILD is gone as of SS11 (5.8), not supportted in SS10 (5.7)
496 ifeq ($(shell expr $(COMPILER_REV) \< 5.7), 1)
497 # use ild when debugging (but when optimizing we want reproducible results)
498 ILDFLAG = $(ILDFLAG/$(VERSION))
499 ILDFLAG/debug = -xildon
500 ILDFLAG/optimized =
501 AOUT_FLAGS += $(ILDFLAG)
502 endif
504 # Where to put the *.o files (a.out, or shared library)?
505 LINK_INTO = $(LINK_INTO/$(VERSION))
506 LINK_INTO/debug = LIBJVM
507 LINK_INTO/optimized = LIBJVM
509 # We link the debug version into the a.out because:
510 # 1. ild works on a.out but not shared libraries, and using ild
511 # can cut rebuild times by 25% for small changes. (ILD is gone in SS11)
512 # 2. dbx cannot gracefully set breakpoints in shared libraries
513 #
515 # apply this setting to link into the shared library even in the debug version:
516 ifdef LP64
517 LINK_INTO = LIBJVM
518 else
519 #LINK_INTO = LIBJVM
520 endif
522 MCS = /usr/ccs/bin/mcs
523 STRIP = /usr/ccs/bin/strip
525 # Solaris platforms collect lots of redundant file-ident lines,
526 # to the point of wasting a significant percentage of file space.
527 # (The text is stored in ELF .comment sections, contributed by
528 # all "#pragma ident" directives in header and source files.)
529 # This command "compresses" the .comment sections simply by
530 # removing repeated lines. The data can be extracted from
531 # binaries in the field by using "mcs -p libjvm.so" or the older
532 # command "what libjvm.so".
533 LINK_LIB.CC/POST_HOOK += $(MCS) -c $@ || exit 1;
534 # (The exit 1 is necessary to cause a build failure if the command fails and
535 # multiple commands are strung together, and the final semicolon is necessary
536 # since the hook must terminate itself as a valid command.)
538 # Also, strip debug and line number information (worth about 1.7Mb).
539 STRIP_LIB.CC/POST_HOOK = $(STRIP) -x $@ || exit 1;
540 # STRIP_LIB.CC/POST_HOOK is incorporated into LINK_LIB.CC/POST_HOOK
541 # in certain configurations, such as product.make. Other configurations,
542 # such as debug.make, do not include the strip operation.