Mercurial > hg > truffle
annotate make/solaris/makefiles/dtrace.make @ 2099:4537d449ba57
Merge
author | bobv |
---|---|
date | Fri, 07 Jan 2011 15:57:02 -0500 |
parents | f95d63e2154a |
children | da0999c4b733 |
rev | line source |
---|---|
0 | 1 # |
1972 | 2 # Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 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 # | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1123
diff
changeset
|
19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1123
diff
changeset
|
20 # or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1123
diff
changeset
|
21 # questions. |
0 | 22 # |
23 # | |
24 | |
25 # Rules to build jvm_db/dtrace, used by vm.make | |
26 | |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
27 # We build libjvm_dtrace/libjvm_db/dtrace for COMPILER1 and COMPILER2 |
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
28 # but not for CORE or KERNEL configurations. |
0 | 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 JVM_DB = libjvm_db | |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
41 LIBJVM_DB = libjvm_db.so |
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
42 LIBJVM_DB_G = libjvm$(G_SUFFIX)_db.so |
0 | 43 |
44 JVM_DTRACE = jvm_dtrace | |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
45 LIBJVM_DTRACE = libjvm_dtrace.so |
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
46 LIBJVM_DTRACE_G = libjvm$(G_SUFFIX)_dtrace.so |
0 | 47 |
48 JVMOFFS = JvmOffsets | |
49 JVMOFFS.o = $(JVMOFFS).o | |
50 GENOFFS = generate$(JVMOFFS) | |
51 | |
52 DTRACE_SRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/dtrace | |
53 DTRACE = dtrace | |
54 DTRACE.o = $(DTRACE).o | |
55 | |
56 # to remove '-g' option which causes link problems | |
57 # also '-z nodefs' is used as workaround | |
58 GENOFFS_CFLAGS = $(shell echo $(CFLAGS) | sed -e 's/ -g / /g' -e 's/ -g0 / /g';) | |
59 | |
60 ifdef LP64 | |
61 DTRACE_OPTS = -64 -D_LP64 | |
62 endif | |
63 | |
64 # making libjvm_db | |
65 | |
66 # Use mapfile with libjvm_db.so | |
67 LIBJVM_DB_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jvm_db | |
68 LFLAGS_JVM_DB += $(MAPFLAG:FILENAME=$(LIBJVM_DB_MAPFILE)) | |
69 | |
70 # Use mapfile with libjvm_dtrace.so | |
71 LIBJVM_DTRACE_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jvm_dtrace | |
72 LFLAGS_JVM_DTRACE += $(MAPFLAG:FILENAME=$(LIBJVM_DTRACE_MAPFILE)) | |
73 | |
74 ifdef USE_GCC | |
75 LFLAGS_JVM_DB += -D_REENTRANT $(PICFLAG) | |
76 LFLAGS_JVM_DTRACE += -D_REENTRANT $(PICFLAG) | |
77 else | |
78 LFLAGS_JVM_DB += -mt $(PICFLAG) -xnolib | |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
79 LFLAGS_JVM_DTRACE += -mt $(PICFLAG) -xnolib -ldl |
0 | 80 endif |
81 | |
82 ISA = $(subst i386,i486,$(shell isainfo -n)) | |
83 | |
84 # Making 64/libjvm_db.so: 64-bit version of libjvm_db.so which handles 32-bit libjvm.so | |
85 ifneq ("${ISA}","${BUILDARCH}") | |
86 | |
87 XLIBJVM_DB = 64/$(LIBJVM_DB) | |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
88 XLIBJVM_DB_G = 64/$(LIBJVM_DB_G) |
0 | 89 XLIBJVM_DTRACE = 64/$(LIBJVM_DTRACE) |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
90 XLIBJVM_DTRACE_G = 64/$(LIBJVM_DTRACE_G) |
0 | 91 |
92 $(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE) | |
93 @echo Making $@ | |
94 $(QUIETLY) mkdir -p 64/ ; \ | |
433
c1345e85f901
6767659: Conversion from i486 to x86 missed some entries in makefiles
kvn
parents:
196
diff
changeset
|
95 $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. -I$(GENERATED) \ |
0 | 96 $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
97 [ -f $(XLIBJVM_DB_G) ] || { ln -s $(LIBJVM_DB) $(XLIBJVM_DB_G); } |
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
98 |
0 | 99 $(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) |
100 @echo Making $@ | |
101 $(QUIETLY) mkdir -p 64/ ; \ | |
433
c1345e85f901
6767659: Conversion from i486 to x86 missed some entries in makefiles
kvn
parents:
196
diff
changeset
|
102 $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. \ |
0 | 103 $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
104 [ -f $(XLIBJVM_DTRACE_G) ] || { ln -s $(LIBJVM_DTRACE) $(XLIBJVM_DTRACE_G); } |
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
105 |
0 | 106 endif # ifneq ("${ISA}","${BUILDARCH}") |
107 | |
108 ifdef USE_GCC | |
109 LFLAGS_GENOFFS += -D_REENTRANT | |
110 else | |
111 LFLAGS_GENOFFS += -mt -xnolib -norunpath | |
112 endif | |
113 | |
114 lib$(GENOFFS).so: $(DTRACE_SRCDIR)/$(GENOFFS).cpp $(DTRACE_SRCDIR)/$(GENOFFS).h \ | |
1972 | 115 $(LIBJVM.o) |
0 | 116 $(QUIETLY) $(CCC) $(CPPFLAGS) $(GENOFFS_CFLAGS) $(SHARED_FLAG) $(PICFLAG) \ |
117 $(LFLAGS_GENOFFS) -o $@ $(DTRACE_SRCDIR)/$(GENOFFS).cpp -lc | |
118 | |
119 $(GENOFFS): $(DTRACE_SRCDIR)/$(GENOFFS)Main.c lib$(GENOFFS).so | |
120 $(QUIETLY) $(LINK.CC) -z nodefs -o $@ $(DTRACE_SRCDIR)/$(GENOFFS)Main.c \ | |
121 ./lib$(GENOFFS).so | |
122 | |
440
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
123 CONDITIONALLY_UPDATE_JVMOFFS_TARGET = \ |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
124 cmp -s $@ $@.tmp; \ |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
125 case $$? in \ |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
126 0) rm -f $@.tmp;; \ |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
127 *) rm -f $@ && mv $@.tmp $@ && echo Updated $@;; \ |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
128 esac |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
129 |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
130 # $@.tmp is created first to avoid an empty $(JVMOFFS).h if an error occurs. |
0 | 131 $(JVMOFFS).h: $(GENOFFS) |
440
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
132 $(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -header > $@.tmp |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
133 $(QUIETLY) $(CONDITIONALLY_UPDATE_JVMOFFS_TARGET) |
0 | 134 |
135 $(JVMOFFS)Index.h: $(GENOFFS) | |
440
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
136 $(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -index > $@.tmp |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
137 $(QUIETLY) $(CONDITIONALLY_UPDATE_JVMOFFS_TARGET) |
0 | 138 |
139 $(JVMOFFS).cpp: $(GENOFFS) $(JVMOFFS).h $(JVMOFFS)Index.h | |
440
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
140 $(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -table > $@.tmp |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
141 $(QUIETLY) $(CONDITIONALLY_UPDATE_JVMOFFS_TARGET) |
0 | 142 |
143 $(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp | |
144 $(QUIETLY) $(CCC) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp | |
145 | |
146 $(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE) | |
147 @echo Making $@ | |
148 $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \ | |
149 $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc | |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
150 [ -f $(LIBJVM_DB_G) ] || { ln -s $@ $(LIBJVM_DB_G); } |
0 | 151 |
152 $(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) | |
153 @echo Making $@ | |
154 $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \ | |
155 $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor | |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
443
diff
changeset
|
156 [ -f $(LIBJVM_DTRACE_G) ] || { ln -s $@ $(LIBJVM_DTRACE_G); } |
0 | 157 |
158 $(DTRACE).d: $(DTRACE_SRCDIR)/hotspot.d $(DTRACE_SRCDIR)/hotspot_jni.d \ | |
159 $(DTRACE_SRCDIR)/hs_private.d $(DTRACE_SRCDIR)/jhelper.d | |
160 $(QUIETLY) cat $^ > $@ | |
161 | |
1972 | 162 DTraced_Files = ciEnv.o \ |
163 classLoadingService.o \ | |
164 compileBroker.o \ | |
165 hashtable.o \ | |
166 instanceKlass.o \ | |
167 java.o \ | |
168 jni.o \ | |
169 jvm.o \ | |
170 memoryManager.o \ | |
171 nmethod.o \ | |
172 objectMonitor.o \ | |
173 runtimeService.o \ | |
174 sharedRuntime.o \ | |
175 synchronizer.o \ | |
176 thread.o \ | |
177 unsafe.o \ | |
178 vmThread.o \ | |
179 vmCMSOperations.o \ | |
180 vmPSOperations.o \ | |
181 vmGCOperations.o \ | |
182 | |
0 | 183 # Dtrace is available, so we build $(DTRACE.o) |
184 $(DTRACE.o): $(DTRACE).d $(JVMOFFS).h $(JVMOFFS)Index.h $(DTraced_Files) | |
185 @echo Compiling $(DTRACE).d | |
186 | |
1799
4094f07967ca
6974813: JVM needs to use demand loading for its DTrace probes
kamg
parents:
1552
diff
changeset
|
187 $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -xlazyload -o $@ -s $(DTRACE).d \ |
0 | 188 $(DTraced_Files) ||\ |
189 STATUS=$$?;\ | |
190 if [ x"$$STATUS" = x"1" -a \ | |
191 x`uname -r` = x"5.10" -a \ | |
192 x`uname -p` = x"sparc" ]; then\ | |
193 echo "*****************************************************************";\ | |
194 echo "* If you are building server compiler, and the error message is ";\ | |
195 echo "* \"incorrect ELF machine type...\", you have run into solaris bug ";\ | |
196 echo "* 6213962, \"dtrace -G doesn't work on sparcv8+ object files\".";\ | |
197 echo "* Either patch/upgrade your system (>= S10u1_15), or set the ";\ | |
198 echo "* environment variable HOTSPOT_DISABLE_DTRACE_PROBES to disable ";\ | |
199 echo "* dtrace probes for this build.";\ | |
200 echo "*****************************************************************";\ | |
201 fi;\ | |
202 exit $$STATUS | |
203 # Since some DTraced_Files are in LIBJVM.o and they are touched by this | |
204 # command, and libgenerateJvmOffsets.so depends on LIBJVM.o, 'make' will | |
205 # think it needs to rebuild libgenerateJvmOffsets.so and thus JvmOffsets* | |
206 # files, but it doesn't, so we touch the necessary files to prevent later | |
207 # recompilation. Note: we only touch the necessary files if they already | |
208 # exist in order to close a race where an empty file can be created | |
209 # before the real build rule is executed. | |
210 # But, we can't touch the *.h files: This rule depends | |
211 # on them, and that would cause an infinite cycle of rebuilding. | |
212 # Neither the *.h or *.ccp files need to be touched, since they have | |
213 # rules which do not update them when the generator file has not | |
214 # changed their contents. | |
215 $(QUIETLY) if [ -f lib$(GENOFFS).so ]; then touch lib$(GENOFFS).so; fi | |
216 $(QUIETLY) if [ -f $(GENOFFS) ]; then touch $(GENOFFS); fi | |
217 $(QUIETLY) if [ -f $(JVMOFFS.o) ]; then touch $(JVMOFFS.o); fi | |
218 | |
219 .PHONY: dtraceCheck | |
220 | |
116
018d5b58dd4f
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
91
diff
changeset
|
221 SYSTEM_DTRACE_H = /usr/include/dtrace.h |
0 | 222 SYSTEM_DTRACE_PROG = /usr/sbin/dtrace |
223 PATCH_DTRACE_PROG = /opt/SUNWdtrd/sbin/dtrace | |
224 systemDtraceFound := $(wildcard ${SYSTEM_DTRACE_PROG}) | |
225 patchDtraceFound := $(wildcard ${PATCH_DTRACE_PROG}) | |
116
018d5b58dd4f
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
91
diff
changeset
|
226 systemDtraceHdrFound := $(wildcard $(SYSTEM_DTRACE_H)) |
018d5b58dd4f
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
91
diff
changeset
|
227 |
018d5b58dd4f
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
91
diff
changeset
|
228 ifneq ("$(systemDtraceHdrFound)", "") |
018d5b58dd4f
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
91
diff
changeset
|
229 CFLAGS += -DHAVE_DTRACE_H |
018d5b58dd4f
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
91
diff
changeset
|
230 endif |
0 | 231 |
232 ifneq ("$(patchDtraceFound)", "") | |
233 DTRACE_PROG=$(PATCH_DTRACE_PROG) | |
234 DTRACE_INCL=-I/opt/SUNWdtrd/include | |
235 else | |
236 ifneq ("$(systemDtraceFound)", "") | |
237 DTRACE_PROG=$(SYSTEM_DTRACE_PROG) | |
238 else | |
239 | |
240 endif # ifneq ("$(systemDtraceFound)", "") | |
241 endif # ifneq ("$(patchDtraceFound)", "") | |
242 | |
243 ifneq ("${DTRACE_PROG}", "") | |
244 ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "") | |
245 | |
246 DTRACE_OBJS = $(DTRACE.o) $(JVMOFFS.o) | |
247 CFLAGS += $(DTRACE_INCL) -DDTRACE_ENABLED | |
248 MAPFILE_DTRACE_OPT = $(MAPFILE_DTRACE) | |
249 | |
250 dtraceCheck: | |
251 | |
252 else # manually disabled | |
253 | |
254 dtraceCheck: | |
255 $(QUIETLY) echo "**NOTICE** Dtrace support disabled via environment variable" | |
256 | |
257 endif # ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "") | |
258 | |
259 else # No dtrace program found | |
260 | |
261 dtraceCheck: | |
262 $(QUIETLY) echo "**NOTICE** Dtrace support disabled: not supported by system" | |
263 | |
264 endif # ifneq ("${dtraceFound}", "") | |
265 | |
266 endif # ifdef USE_GCC | |
267 | |
268 else # KERNEL build | |
269 | |
270 dtraceCheck: | |
271 $(QUIETLY) echo "**NOTICE** Dtrace support disabled for KERNEL builds" | |
272 | |
273 endif # ifneq ("${TYPE}", "KERNEL") | |
274 | |
275 else # CORE build | |
276 | |
277 dtraceCheck: | |
278 $(QUIETLY) echo "**NOTICE** Dtrace support disabled for CORE builds" | |
279 | |
280 endif # ifneq ("${TYPE}", "CORE") |