author | acorn |
Mon, 28 Jan 2013 10:55:30 -0500 | |
changeset 15439 | a72c53517fe7 |
parent 15432 | 9d976ca484d8 |
child 20686 | 1fa9a75192c3 |
permissions | -rw-r--r-- |
10565 | 1 |
# |
15432 | 2 |
# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. |
10565 | 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 |
||
10739 | 25 |
# Rules to build jvm_db/dtrace, used by vm.make |
26 |
||
27 |
# We build libjvm_dtrace/libjvm_db/dtrace for COMPILER1 and COMPILER2 |
|
15432 | 28 |
# but not for CORE configuration. |
10739 | 29 |
|
30 |
ifneq ("${TYPE}", "CORE") |
|
31 |
||
32 |
ifeq ($(OS_VENDOR), Darwin) |
|
33 |
# we build dtrace for macosx using USDT2 probes |
|
34 |
||
35 |
DtraceOutDir = $(GENERATED)/dtracefiles |
|
36 |
||
37 |
# Bsd does not build libjvm_db, does not compile on macosx |
|
38 |
# disabled in build: rule in vm.make |
|
39 |
JVM_DB = libjvm_db |
|
14815
41114a74463a
7153050: remove crufty '_g' support from HotSpot repo makefiles
dcubed
parents:
13974
diff
changeset
|
40 |
LIBJVM_DB = libjvm_db.dylib |
10739 | 41 |
|
42 |
JVM_DTRACE = jvm_dtrace |
|
14815
41114a74463a
7153050: remove crufty '_g' support from HotSpot repo makefiles
dcubed
parents:
13974
diff
changeset
|
43 |
LIBJVM_DTRACE = libjvm_dtrace.dylib |
10739 | 44 |
|
45 |
JVMOFFS = JvmOffsets |
|
46 |
JVMOFFS.o = $(JVMOFFS).o |
|
47 |
GENOFFS = generate$(JVMOFFS) |
|
48 |
||
49 |
DTRACE_SRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/dtrace |
|
50 |
DTRACE = dtrace |
|
51 |
DTRACE.o = $(DTRACE).o |
|
52 |
||
53 |
# to remove '-g' option which causes link problems |
|
54 |
# also '-z nodefs' is used as workaround |
|
55 |
GENOFFS_CFLAGS = $(shell echo $(CFLAGS) | sed -e 's/ -g / /g' -e 's/ -g0 / /g';) |
|
56 |
||
57 |
ifdef LP64 |
|
58 |
DTRACE_OPTS = -D_LP64 |
|
59 |
endif |
|
60 |
||
61 |
# making libjvm_db |
|
62 |
||
63 |
# Use mapfile with libjvm_db.so |
|
64 |
LIBJVM_DB_MAPFILE = # no mapfile for usdt2 # $(MAKEFILES_DIR)/mapfile-vers-jvm_db |
|
65 |
#LFLAGS_JVM_DB += $(MAPFLAG:FILENAME=$(LIBJVM_DB_MAPFILE)) |
|
66 |
||
67 |
# Use mapfile with libjvm_dtrace.so |
|
68 |
LIBJVM_DTRACE_MAPFILE = # no mapfile for usdt2 # $(MAKEFILES_DIR)/mapfile-vers-jvm_dtrace |
|
69 |
#LFLAGS_JVM_DTRACE += $(MAPFLAG:FILENAME=$(LIBJVM_DTRACE_MAPFILE)) |
|
70 |
||
71 |
LFLAGS_JVM_DB += $(PICFLAG) # -D_REENTRANT |
|
72 |
LFLAGS_JVM_DTRACE += $(PICFLAG) # -D_REENTRANT |
|
73 |
||
74 |
ISA = $(subst i386,i486,$(BUILDARCH)) |
|
75 |
||
76 |
# Making 64/libjvm_db.so: 64-bit version of libjvm_db.so which handles 32-bit libjvm.so |
|
77 |
ifneq ("${ISA}","${BUILDARCH}") |
|
78 |
||
79 |
XLIBJVM_DB = 64/$(LIBJVM_DB) |
|
80 |
XLIBJVM_DTRACE = 64/$(LIBJVM_DTRACE) |
|
81 |
XARCH = $(subst sparcv9,v9,$(shell echo $(ISA))) |
|
82 |
||
83 |
$(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE) |
|
84 |
@echo Making $@ |
|
85 |
$(QUIETLY) mkdir -p 64/ ; \ |
|
86 |
$(CC) $(SYMFLAG) -xarch=$(XARCH) -D$(TYPE) -I. -I$(GENERATED) \ |
|
87 |
$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c #-lc |
|
88 |
||
89 |
$(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) |
|
90 |
@echo Making $@ |
|
91 |
$(QUIETLY) mkdir -p 64/ ; \ |
|
92 |
$(CC) $(SYMFLAG) -xarch=$(XARCH) -D$(TYPE) -I. \ |
|
93 |
$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c #-lc -lthread -ldoor |
|
94 |
||
95 |
endif # ifneq ("${ISA}","${BUILDARCH}") |
|
96 |
||
97 |
LFLAGS_GENOFFS += -L. |
|
98 |
||
99 |
lib$(GENOFFS).dylib: $(DTRACE_SRCDIR)/$(GENOFFS).cpp $(DTRACE_SRCDIR)/$(GENOFFS).h \ |
|
100 |
$(LIBJVM.o) |
|
11721
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10739
diff
changeset
|
101 |
$(QUIETLY) $(CXX) $(CXXFLAGS) $(GENOFFS_CFLAGS) $(SHARED_FLAG) $(PICFLAG) \ |
10739 | 102 |
$(LFLAGS_GENOFFS) -o $@ $(DTRACE_SRCDIR)/$(GENOFFS).cpp -ljvm |
103 |
||
104 |
$(GENOFFS): $(DTRACE_SRCDIR)/$(GENOFFS)Main.c lib$(GENOFFS).dylib |
|
11721
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10739
diff
changeset
|
105 |
$(QUIETLY) $(LINK.CXX) -o $@ $(DTRACE_SRCDIR)/$(GENOFFS)Main.c \ |
10739 | 106 |
./lib$(GENOFFS).dylib |
107 |
||
108 |
# $@.tmp is created first to avoid an empty $(JVMOFFS).h if an error occurs. |
|
109 |
$(JVMOFFS).h: $(GENOFFS) |
|
13966
7b818806118b
8000485: Hotspot build fails in Solaris Studio IDE when building dtrace
vlivanov
parents:
11721
diff
changeset
|
110 |
$(QUIETLY) DYLD_LIBRARY_PATH=.:$(DYLD_LIBRARY_PATH) ./$(GENOFFS) -header > $@.tmp; touch $@; \ |
10739 | 111 |
if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \ |
112 |
then rm -f $@; mv $@.tmp $@; \ |
|
113 |
else rm -f $@.tmp; \ |
|
114 |
fi |
|
115 |
||
116 |
$(JVMOFFS)Index.h: $(GENOFFS) |
|
13966
7b818806118b
8000485: Hotspot build fails in Solaris Studio IDE when building dtrace
vlivanov
parents:
11721
diff
changeset
|
117 |
$(QUIETLY) DYLD_LIBRARY_PATH=.:$(DYLD_LIBRARY_PATH) ./$(GENOFFS) -index > $@.tmp; touch $@; \ |
10739 | 118 |
if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \ |
119 |
then rm -f $@; mv $@.tmp $@; \ |
|
120 |
else rm -f $@.tmp; \ |
|
121 |
fi |
|
122 |
||
123 |
$(JVMOFFS).cpp: $(GENOFFS) $(JVMOFFS).h $(JVMOFFS)Index.h |
|
13966
7b818806118b
8000485: Hotspot build fails in Solaris Studio IDE when building dtrace
vlivanov
parents:
11721
diff
changeset
|
124 |
$(QUIETLY) DYLD_LIBRARY_PATH=.:$(DYLD_LIBRARY_PATH) ./$(GENOFFS) -table > $@.tmp; touch $@; \ |
10739 | 125 |
if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \ |
126 |
then rm -f $@; mv $@.tmp $@; \ |
|
127 |
else rm -f $@.tmp; \ |
|
128 |
fi |
|
129 |
||
130 |
$(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp |
|
11721
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10739
diff
changeset
|
131 |
$(QUIETLY) $(CXX) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp |
10739 | 132 |
|
133 |
$(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE) |
|
134 |
@echo Making $@ |
|
135 |
$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \ |
|
136 |
$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -Wall # -lc |
|
137 |
||
138 |
$(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) |
|
139 |
@echo Making $@ |
|
140 |
$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \ |
|
141 |
$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c #-lc -lthread -ldoor |
|
142 |
||
143 |
#$(DTRACE).d: $(DTRACE_SRCDIR)/hotspot.d $(DTRACE_SRCDIR)/hotspot_jni.d \ |
|
144 |
# $(DTRACE_SRCDIR)/hs_private.d $(DTRACE_SRCDIR)/jhelper.d |
|
145 |
# $(QUIETLY) cat $^ > $@ |
|
146 |
||
147 |
$(DtraceOutDir): |
|
148 |
mkdir $(DtraceOutDir) |
|
149 |
||
150 |
$(DtraceOutDir)/hotspot.h: $(DTRACE_SRCDIR)/hotspot.d | $(DtraceOutDir) |
|
151 |
$(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_SRCDIR)/hotspot.d |
|
152 |
||
153 |
$(DtraceOutDir)/hotspot_jni.h: $(DTRACE_SRCDIR)/hotspot_jni.d | $(DtraceOutDir) |
|
154 |
$(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_SRCDIR)/hotspot_jni.d |
|
10565 | 155 |
|
10739 | 156 |
$(DtraceOutDir)/hs_private.h: $(DTRACE_SRCDIR)/hs_private.d | $(DtraceOutDir) |
157 |
$(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_SRCDIR)/hs_private.d |
|
158 |
||
159 |
$(DtraceOutDir)/jhelper.h: $(DTRACE_SRCDIR)/jhelper.d $(JVMOFFS).o | $(DtraceOutDir) |
|
160 |
$(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_SRCDIR)/jhelper.d |
|
161 |
||
162 |
# jhelper currently disabled |
|
163 |
dtrace_gen_headers: $(DtraceOutDir)/hotspot.h $(DtraceOutDir)/hotspot_jni.h $(DtraceOutDir)/hs_private.h |
|
164 |
||
165 |
DTraced_Files = ciEnv.o \ |
|
166 |
classLoadingService.o \ |
|
167 |
compileBroker.o \ |
|
168 |
hashtable.o \ |
|
169 |
instanceKlass.o \ |
|
170 |
java.o \ |
|
171 |
jni.o \ |
|
172 |
jvm.o \ |
|
173 |
memoryManager.o \ |
|
174 |
nmethod.o \ |
|
175 |
objectMonitor.o \ |
|
176 |
runtimeService.o \ |
|
177 |
sharedRuntime.o \ |
|
178 |
synchronizer.o \ |
|
179 |
thread.o \ |
|
180 |
unsafe.o \ |
|
181 |
vmThread.o \ |
|
182 |
vmCMSOperations.o \ |
|
183 |
vmPSOperations.o \ |
|
184 |
vmGCOperations.o \ |
|
185 |
||
186 |
# Dtrace is available, so we build $(DTRACE.o) |
|
187 |
#$(DTRACE.o): $(DTRACE).d $(JVMOFFS).h $(JVMOFFS)Index.h $(DTraced_Files) |
|
188 |
# @echo Compiling $(DTRACE).d |
|
189 |
||
190 |
# $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -xlazyload -o $@ -s $(DTRACE).d \ |
|
191 |
# $(DTraced_Files) ||\ |
|
192 |
# STATUS=$$?;\ |
|
193 |
# if [ x"$$STATUS" = x"1" -a \ |
|
194 |
# x`uname -r` = x"5.10" -a \ |
|
195 |
# x`uname -p` = x"sparc" ]; then\ |
|
196 |
# echo "*****************************************************************";\ |
|
197 |
# echo "* If you are building server compiler, and the error message is ";\ |
|
198 |
# echo "* \"incorrect ELF machine type...\", you have run into solaris bug ";\ |
|
199 |
# echo "* 6213962, \"dtrace -G doesn't work on sparcv8+ object files\".";\ |
|
200 |
# echo "* Either patch/upgrade your system (>= S10u1_15), or set the ";\ |
|
201 |
# echo "* environment variable HOTSPOT_DISABLE_DTRACE_PROBES to disable ";\ |
|
202 |
# echo "* dtrace probes for this build.";\ |
|
203 |
# echo "*****************************************************************";\ |
|
204 |
# fi;\ |
|
205 |
# exit $$STATUS |
|
206 |
# Since some DTraced_Files are in LIBJVM.o and they are touched by this |
|
207 |
# command, and libgenerateJvmOffsets.so depends on LIBJVM.o, 'make' will |
|
208 |
# think it needs to rebuild libgenerateJvmOffsets.so and thus JvmOffsets* |
|
209 |
# files, but it doesn't, so we touch the necessary files to prevent later |
|
210 |
# recompilation. Note: we only touch the necessary files if they already |
|
211 |
# exist in order to close a race where an empty file can be created |
|
212 |
# before the real build rule is executed. |
|
213 |
# But, we can't touch the *.h files: This rule depends |
|
214 |
# on them, and that would cause an infinite cycle of rebuilding. |
|
215 |
# Neither the *.h or *.ccp files need to be touched, since they have |
|
216 |
# rules which do not update them when the generator file has not |
|
217 |
# changed their contents. |
|
218 |
# $(QUIETLY) if [ -f lib$(GENOFFS).so ]; then touch lib$(GENOFFS).so; fi |
|
219 |
# $(QUIETLY) if [ -f $(GENOFFS) ]; then touch $(GENOFFS); fi |
|
220 |
# $(QUIETLY) if [ -f $(JVMOFFS.o) ]; then touch $(JVMOFFS.o); fi |
|
221 |
||
222 |
.PHONY: dtraceCheck |
|
223 |
||
224 |
#SYSTEM_DTRACE_H = /usr/include/dtrace.h |
|
225 |
SYSTEM_DTRACE_PROG = /usr/sbin/dtrace |
|
226 |
#PATCH_DTRACE_PROG = /opt/SUNWdtrd/sbin/dtrace |
|
227 |
systemDtraceFound := $(wildcard ${SYSTEM_DTRACE_PROG}) |
|
228 |
#patchDtraceFound := $(wildcard ${PATCH_DTRACE_PROG}) |
|
229 |
#systemDtraceHdrFound := $(wildcard $(SYSTEM_DTRACE_H)) |
|
230 |
||
231 |
#ifneq ("$(systemDtraceHdrFound)", "") |
|
232 |
#CFLAGS += -DHAVE_DTRACE_H |
|
233 |
#endif |
|
234 |
||
235 |
#ifneq ("$(patchDtraceFound)", "") |
|
236 |
#DTRACE_PROG=$(PATCH_DTRACE_PROG) |
|
237 |
#DTRACE_INCL=-I/opt/SUNWdtrd/include |
|
238 |
#else |
|
239 |
ifneq ("$(systemDtraceFound)", "") |
|
240 |
DTRACE_PROG=$(SYSTEM_DTRACE_PROG) |
|
241 |
else |
|
242 |
||
243 |
endif # ifneq ("$(systemDtraceFound)", "") |
|
244 |
#endif # ifneq ("$(patchDtraceFound)", "") |
|
245 |
||
246 |
ifneq ("${DTRACE_PROG}", "") |
|
247 |
ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "") |
|
248 |
||
249 |
DTRACE_OBJS = $(DTRACE.o) #$(JVMOFFS.o) |
|
250 |
CFLAGS += -DDTRACE_ENABLED #$(DTRACE_INCL) |
|
251 |
#clangCFLAGS += -DDTRACE_ENABLED -fno-optimize-sibling-calls |
|
252 |
#MAPFILE_DTRACE_OPT = $(MAPFILE_DTRACE) |
|
253 |
||
254 |
||
255 |
dtraceCheck: |
|
256 |
||
257 |
dtrace_stuff: dtrace_gen_headers |
|
258 |
$(QUIETLY) echo "dtrace headers generated" |
|
259 |
||
260 |
||
261 |
else # manually disabled |
|
262 |
||
263 |
dtraceCheck: |
|
264 |
$(QUIETLY) echo "**NOTICE** Dtrace support disabled via environment variable" |
|
265 |
||
266 |
dtrace_stuff: |
|
267 |
||
268 |
endif # ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "") |
|
269 |
||
270 |
else # No dtrace program found |
|
271 |
||
272 |
dtraceCheck: |
|
273 |
$(QUIETLY) echo "**NOTICE** Dtrace support disabled: not supported by system" |
|
274 |
||
275 |
dtrace_stuff: |
|
276 |
||
277 |
endif # ifneq ("${dtraceFound}", "") |
|
278 |
||
279 |
endif # ifeq ($(OS_VENDOR), Darwin) |
|
280 |
||
281 |
||
282 |
else # CORE build |
|
283 |
||
284 |
dtraceCheck: |
|
285 |
$(QUIETLY) echo "**NOTICE** Dtrace support disabled for CORE builds" |
|
286 |
||
287 |
endif # ifneq ("${TYPE}", "CORE") |