author | xlu |
Tue, 24 Jun 2008 16:52:31 -0700 | |
changeset 774 | e71318ea23e8 |
parent 584 | 02175b2b64e6 |
child 670 | ddf3e9583f2f |
permissions | -rw-r--r-- |
1 | 1 |
# |
2 |
# Copyright 2005-2007 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 |
# |
|
24 |
||
25 |
# Rules to build jvm_db/dtrace, used by vm.make |
|
26 |
||
27 |
# we build libjvm_dtrace/libjvm_db/dtrace for COMPILER1 and COMPILER2 |
|
28 |
# but not for CORE configuration |
|
29 |
||
30 |
ifneq ("${TYPE}", "CORE") |
|
31 |
ifneq ("${TYPE}", "KERNEL") |
|
32 |
||
33 |
ifdef USE_GCC |
|
34 |
||
35 |
dtraceCheck: |
|
36 |
$(QUIETLY) echo "**NOTICE** Dtrace support disabled for gcc builds" |
|
37 |
||
38 |
else |
|
39 |
||
40 |
||
41 |
JVM_DB = libjvm_db |
|
42 |
LIBJVM_DB = libjvm$(G_SUFFIX)_db.so |
|
43 |
||
44 |
JVM_DTRACE = jvm_dtrace |
|
45 |
LIBJVM_DTRACE = libjvm$(G_SUFFIX)_dtrace.so |
|
46 |
||
47 |
JVMOFFS = JvmOffsets |
|
48 |
JVMOFFS.o = $(JVMOFFS).o |
|
49 |
GENOFFS = generate$(JVMOFFS) |
|
50 |
||
51 |
DTRACE_SRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/dtrace |
|
52 |
DTRACE = dtrace |
|
53 |
DTRACE.o = $(DTRACE).o |
|
54 |
||
55 |
# to remove '-g' option which causes link problems |
|
56 |
# also '-z nodefs' is used as workaround |
|
57 |
GENOFFS_CFLAGS = $(shell echo $(CFLAGS) | sed -e 's/ -g / /g' -e 's/ -g0 / /g';) |
|
58 |
||
59 |
ifdef LP64 |
|
60 |
DTRACE_OPTS = -64 -D_LP64 |
|
61 |
endif |
|
62 |
||
63 |
# making libjvm_db |
|
64 |
||
65 |
INCLS = $(GENERATED)/incls |
|
66 |
||
67 |
# Use mapfile with libjvm_db.so |
|
68 |
LIBJVM_DB_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jvm_db |
|
69 |
LFLAGS_JVM_DB += $(MAPFLAG:FILENAME=$(LIBJVM_DB_MAPFILE)) |
|
70 |
||
71 |
# Use mapfile with libjvm_dtrace.so |
|
72 |
LIBJVM_DTRACE_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jvm_dtrace |
|
73 |
LFLAGS_JVM_DTRACE += $(MAPFLAG:FILENAME=$(LIBJVM_DTRACE_MAPFILE)) |
|
74 |
||
75 |
ifdef USE_GCC |
|
76 |
LFLAGS_JVM_DB += -D_REENTRANT $(PICFLAG) |
|
77 |
LFLAGS_JVM_DTRACE += -D_REENTRANT $(PICFLAG) |
|
78 |
else |
|
79 |
LFLAGS_JVM_DB += -mt $(PICFLAG) -xnolib |
|
80 |
LFLAGS_JVM_DTRACE += -mt $(PICFLAG) -xnolib |
|
81 |
endif |
|
82 |
||
83 |
ISA = $(subst i386,i486,$(shell isainfo -n)) |
|
84 |
||
85 |
# Making 64/libjvm_db.so: 64-bit version of libjvm_db.so which handles 32-bit libjvm.so |
|
86 |
ifneq ("${ISA}","${BUILDARCH}") |
|
87 |
||
88 |
XLIBJVM_DB = 64/$(LIBJVM_DB) |
|
89 |
XLIBJVM_DTRACE = 64/$(LIBJVM_DTRACE) |
|
90 |
XARCH = $(subst sparcv9,v9,$(shell echo $(ISA))) |
|
91 |
||
92 |
$(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE) |
|
93 |
@echo Making $@ |
|
94 |
$(QUIETLY) mkdir -p 64/ ; \ |
|
584
02175b2b64e6
6563752: Build and test JDK7 with Sun Studio 12 Express compilers (prep makefiles)
ohair
parents:
363
diff
changeset
|
95 |
$(CC) $(SYMFLAG) $(ARCHFLAG/$(XARCH)) -D$(TYPE) -I. -I$(GENERATED) \ |
1 | 96 |
$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc |
97 |
$(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) |
|
98 |
@echo Making $@ |
|
99 |
$(QUIETLY) mkdir -p 64/ ; \ |
|
584
02175b2b64e6
6563752: Build and test JDK7 with Sun Studio 12 Express compilers (prep makefiles)
ohair
parents:
363
diff
changeset
|
100 |
$(CC) $(SYMFLAG) $(ARCHFLAG/$(XARCH)) -D$(TYPE) -I. \ |
1 | 101 |
$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor |
102 |
endif # ifneq ("${ISA}","${BUILDARCH}") |
|
103 |
||
104 |
ifdef USE_GCC |
|
105 |
LFLAGS_GENOFFS += -D_REENTRANT |
|
106 |
else |
|
107 |
LFLAGS_GENOFFS += -mt -xnolib -norunpath |
|
108 |
endif |
|
109 |
||
110 |
lib$(GENOFFS).so: $(DTRACE_SRCDIR)/$(GENOFFS).cpp $(DTRACE_SRCDIR)/$(GENOFFS).h \ |
|
111 |
$(INCLS)/_vmStructs.cpp.incl $(LIBJVM.o) |
|
112 |
$(QUIETLY) $(CCC) $(CPPFLAGS) $(GENOFFS_CFLAGS) $(SHARED_FLAG) $(PICFLAG) \ |
|
113 |
$(LFLAGS_GENOFFS) -o $@ $(DTRACE_SRCDIR)/$(GENOFFS).cpp -lc |
|
114 |
||
115 |
$(GENOFFS): $(DTRACE_SRCDIR)/$(GENOFFS)Main.c lib$(GENOFFS).so |
|
116 |
$(QUIETLY) $(LINK.CC) -z nodefs -o $@ $(DTRACE_SRCDIR)/$(GENOFFS)Main.c \ |
|
117 |
./lib$(GENOFFS).so |
|
118 |
||
119 |
# $@.tmp is created first. It's to avoid empty $(JVMOFFS).h produced in error case. |
|
120 |
$(JVMOFFS).h: $(GENOFFS) |
|
121 |
$(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -header > $@.tmp ; \ |
|
122 |
if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \ |
|
123 |
then rm -f $@; mv $@.tmp $@; echo Updated $@ ; \ |
|
124 |
else rm -f $@.tmp; \ |
|
125 |
fi |
|
126 |
||
127 |
$(JVMOFFS)Index.h: $(GENOFFS) |
|
128 |
$(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -index > $@.tmp ; \ |
|
129 |
if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \ |
|
130 |
then rm -f $@; mv $@.tmp $@; echo Updated $@ ; \ |
|
131 |
else rm -f $@.tmp; \ |
|
132 |
fi |
|
133 |
||
134 |
$(JVMOFFS).cpp: $(GENOFFS) $(JVMOFFS).h $(JVMOFFS)Index.h |
|
135 |
$(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -table > $@.tmp ; \ |
|
136 |
if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \ |
|
137 |
then rm -f $@; mv $@.tmp $@; echo Updated $@ ; \ |
|
138 |
else rm -f $@.tmp; \ |
|
139 |
fi |
|
140 |
||
141 |
$(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp |
|
142 |
$(QUIETLY) $(CCC) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp |
|
143 |
||
144 |
$(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE) |
|
145 |
@echo Making $@ |
|
146 |
$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \ |
|
147 |
$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc |
|
148 |
||
149 |
$(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) |
|
150 |
@echo Making $@ |
|
151 |
$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \ |
|
152 |
$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor |
|
153 |
||
154 |
$(DTRACE).d: $(DTRACE_SRCDIR)/hotspot.d $(DTRACE_SRCDIR)/hotspot_jni.d \ |
|
155 |
$(DTRACE_SRCDIR)/hs_private.d $(DTRACE_SRCDIR)/jhelper.d |
|
156 |
$(QUIETLY) cat $^ > $@ |
|
157 |
||
158 |
# Dtrace is available, so we build $(DTRACE.o) |
|
159 |
$(DTRACE.o): $(DTRACE).d $(JVMOFFS).h $(JVMOFFS)Index.h $(DTraced_Files) |
|
160 |
@echo Compiling $(DTRACE).d |
|
161 |
||
162 |
$(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -o $@ -s $(DTRACE).d \ |
|
163 |
$(DTraced_Files) ||\ |
|
164 |
STATUS=$$?;\ |
|
165 |
if [ x"$$STATUS" = x"1" -a \ |
|
166 |
x`uname -r` = x"5.10" -a \ |
|
167 |
x`uname -p` = x"sparc" ]; then\ |
|
168 |
echo "*****************************************************************";\ |
|
169 |
echo "* If you are building server compiler, and the error message is ";\ |
|
170 |
echo "* \"incorrect ELF machine type...\", you have run into solaris bug ";\ |
|
171 |
echo "* 6213962, \"dtrace -G doesn't work on sparcv8+ object files\".";\ |
|
172 |
echo "* Either patch/upgrade your system (>= S10u1_15), or set the ";\ |
|
173 |
echo "* environment variable HOTSPOT_DISABLE_DTRACE_PROBES to disable ";\ |
|
174 |
echo "* dtrace probes for this build.";\ |
|
175 |
echo "*****************************************************************";\ |
|
176 |
fi;\ |
|
177 |
exit $$STATUS |
|
178 |
# Since some DTraced_Files are in LIBJVM.o and they are touched by this |
|
179 |
# command, and libgenerateJvmOffsets.so depends on LIBJVM.o, 'make' will |
|
180 |
# think it needs to rebuild libgenerateJvmOffsets.so and thus JvmOffsets* |
|
181 |
# files, but it doesn't, so we touch the necessary files to prevent later |
|
182 |
# recompilation. Note: we only touch the necessary files if they already |
|
183 |
# exist in order to close a race where an empty file can be created |
|
184 |
# before the real build rule is executed. |
|
185 |
# But, we can't touch the *.h files: This rule depends |
|
186 |
# on them, and that would cause an infinite cycle of rebuilding. |
|
187 |
# Neither the *.h or *.ccp files need to be touched, since they have |
|
188 |
# rules which do not update them when the generator file has not |
|
189 |
# changed their contents. |
|
190 |
$(QUIETLY) if [ -f lib$(GENOFFS).so ]; then touch lib$(GENOFFS).so; fi |
|
191 |
$(QUIETLY) if [ -f $(GENOFFS) ]; then touch $(GENOFFS); fi |
|
192 |
$(QUIETLY) if [ -f $(JVMOFFS.o) ]; then touch $(JVMOFFS.o); fi |
|
193 |
||
194 |
.PHONY: dtraceCheck |
|
195 |
||
363
99d43e8a76ad
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
338
diff
changeset
|
196 |
SYSTEM_DTRACE_H = /usr/include/dtrace.h |
1 | 197 |
SYSTEM_DTRACE_PROG = /usr/sbin/dtrace |
198 |
PATCH_DTRACE_PROG = /opt/SUNWdtrd/sbin/dtrace |
|
199 |
systemDtraceFound := $(wildcard ${SYSTEM_DTRACE_PROG}) |
|
200 |
patchDtraceFound := $(wildcard ${PATCH_DTRACE_PROG}) |
|
363
99d43e8a76ad
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
338
diff
changeset
|
201 |
systemDtraceHdrFound := $(wildcard $(SYSTEM_DTRACE_H)) |
99d43e8a76ad
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
338
diff
changeset
|
202 |
|
99d43e8a76ad
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
338
diff
changeset
|
203 |
ifneq ("$(systemDtraceHdrFound)", "") |
99d43e8a76ad
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
338
diff
changeset
|
204 |
CFLAGS += -DHAVE_DTRACE_H |
99d43e8a76ad
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
338
diff
changeset
|
205 |
endif |
1 | 206 |
|
207 |
ifneq ("$(patchDtraceFound)", "") |
|
208 |
DTRACE_PROG=$(PATCH_DTRACE_PROG) |
|
209 |
DTRACE_INCL=-I/opt/SUNWdtrd/include |
|
210 |
else |
|
211 |
ifneq ("$(systemDtraceFound)", "") |
|
212 |
DTRACE_PROG=$(SYSTEM_DTRACE_PROG) |
|
213 |
else |
|
214 |
||
215 |
endif # ifneq ("$(systemDtraceFound)", "") |
|
216 |
endif # ifneq ("$(patchDtraceFound)", "") |
|
217 |
||
218 |
ifneq ("${DTRACE_PROG}", "") |
|
219 |
ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "") |
|
220 |
||
221 |
DTRACE_OBJS = $(DTRACE.o) $(JVMOFFS.o) |
|
222 |
CFLAGS += $(DTRACE_INCL) -DDTRACE_ENABLED |
|
223 |
MAPFILE_DTRACE_OPT = $(MAPFILE_DTRACE) |
|
224 |
||
225 |
dtraceCheck: |
|
226 |
||
227 |
else # manually disabled |
|
228 |
||
229 |
dtraceCheck: |
|
230 |
$(QUIETLY) echo "**NOTICE** Dtrace support disabled via environment variable" |
|
231 |
||
232 |
endif # ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "") |
|
233 |
||
234 |
else # No dtrace program found |
|
235 |
||
236 |
dtraceCheck: |
|
237 |
$(QUIETLY) echo "**NOTICE** Dtrace support disabled: not supported by system" |
|
238 |
||
239 |
endif # ifneq ("${dtraceFound}", "") |
|
240 |
||
241 |
endif # ifdef USE_GCC |
|
242 |
||
243 |
else # KERNEL build |
|
244 |
||
245 |
dtraceCheck: |
|
246 |
$(QUIETLY) echo "**NOTICE** Dtrace support disabled for KERNEL builds" |
|
247 |
||
248 |
endif # ifneq ("${TYPE}", "KERNEL") |
|
249 |
||
250 |
else # CORE build |
|
251 |
||
252 |
dtraceCheck: |
|
253 |
$(QUIETLY) echo "**NOTICE** Dtrace support disabled for CORE builds" |
|
254 |
||
255 |
endif # ifneq ("${TYPE}", "CORE") |