Mercurial > hg > truffle
annotate make/solaris/makefiles/dtrace.make @ 440:96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
Reviewed-by: xlu
author | jcoomes |
---|---|
date | Fri, 07 Nov 2008 12:52:16 -0800 |
parents | d1605aabd0a1 |
children | b5e603f2e024 |
rev | line source |
---|---|
0 | 1 # |
196 | 2 # Copyright 2005-2008 Sun Microsystems, Inc. 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 # | |
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/ ; \ | |
158
a49545cab84a
6563752: Build and test JDK7 with Sun Studio 12 Express compilers (prep makefiles)
ohair
parents:
116
diff
changeset
|
95 $(CC) $(SYMFLAG) $(ARCHFLAG/$(XARCH)) -D$(TYPE) -I. -I$(GENERATED) \ |
0 | 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/ ; \ | |
158
a49545cab84a
6563752: Build and test JDK7 with Sun Studio 12 Express compilers (prep makefiles)
ohair
parents:
116
diff
changeset
|
100 $(CC) $(SYMFLAG) $(ARCHFLAG/$(XARCH)) -D$(TYPE) -I. \ |
0 | 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 | |
440
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
119 CONDITIONALLY_UPDATE_JVMOFFS_TARGET = \ |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
120 cmp -s $@ $@.tmp; \ |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
121 case $$? in \ |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
122 0) rm -f $@.tmp;; \ |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
123 *) rm -f $@ && mv $@.tmp $@ && echo Updated $@;; \ |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
124 esac |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
125 |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
126 # $@.tmp is created first to avoid an empty $(JVMOFFS).h if an error occurs. |
0 | 127 $(JVMOFFS).h: $(GENOFFS) |
440
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
128 $(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -header > $@.tmp |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
129 $(QUIETLY) $(CONDITIONALLY_UPDATE_JVMOFFS_TARGET) |
0 | 130 |
131 $(JVMOFFS)Index.h: $(GENOFFS) | |
440
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
132 $(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -index > $@.tmp |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
133 $(QUIETLY) $(CONDITIONALLY_UPDATE_JVMOFFS_TARGET) |
0 | 134 |
135 $(JVMOFFS).cpp: $(GENOFFS) $(JVMOFFS).h $(JVMOFFS)Index.h | |
440
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
136 $(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -table > $@.tmp |
96c6da8f095c
6769128: failure to run generateJvmOffsets is ignored
jcoomes
parents:
196
diff
changeset
|
137 $(QUIETLY) $(CONDITIONALLY_UPDATE_JVMOFFS_TARGET) |
0 | 138 |
139 $(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp | |
140 $(QUIETLY) $(CCC) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp | |
141 | |
142 $(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE) | |
143 @echo Making $@ | |
144 $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \ | |
145 $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc | |
146 | |
147 $(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) | |
148 @echo Making $@ | |
149 $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \ | |
150 $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor | |
151 | |
152 $(DTRACE).d: $(DTRACE_SRCDIR)/hotspot.d $(DTRACE_SRCDIR)/hotspot_jni.d \ | |
153 $(DTRACE_SRCDIR)/hs_private.d $(DTRACE_SRCDIR)/jhelper.d | |
154 $(QUIETLY) cat $^ > $@ | |
155 | |
156 # Dtrace is available, so we build $(DTRACE.o) | |
157 $(DTRACE.o): $(DTRACE).d $(JVMOFFS).h $(JVMOFFS)Index.h $(DTraced_Files) | |
158 @echo Compiling $(DTRACE).d | |
159 | |
160 $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -o $@ -s $(DTRACE).d \ | |
161 $(DTraced_Files) ||\ | |
162 STATUS=$$?;\ | |
163 if [ x"$$STATUS" = x"1" -a \ | |
164 x`uname -r` = x"5.10" -a \ | |
165 x`uname -p` = x"sparc" ]; then\ | |
166 echo "*****************************************************************";\ | |
167 echo "* If you are building server compiler, and the error message is ";\ | |
168 echo "* \"incorrect ELF machine type...\", you have run into solaris bug ";\ | |
169 echo "* 6213962, \"dtrace -G doesn't work on sparcv8+ object files\".";\ | |
170 echo "* Either patch/upgrade your system (>= S10u1_15), or set the ";\ | |
171 echo "* environment variable HOTSPOT_DISABLE_DTRACE_PROBES to disable ";\ | |
172 echo "* dtrace probes for this build.";\ | |
173 echo "*****************************************************************";\ | |
174 fi;\ | |
175 exit $$STATUS | |
176 # Since some DTraced_Files are in LIBJVM.o and they are touched by this | |
177 # command, and libgenerateJvmOffsets.so depends on LIBJVM.o, 'make' will | |
178 # think it needs to rebuild libgenerateJvmOffsets.so and thus JvmOffsets* | |
179 # files, but it doesn't, so we touch the necessary files to prevent later | |
180 # recompilation. Note: we only touch the necessary files if they already | |
181 # exist in order to close a race where an empty file can be created | |
182 # before the real build rule is executed. | |
183 # But, we can't touch the *.h files: This rule depends | |
184 # on them, and that would cause an infinite cycle of rebuilding. | |
185 # Neither the *.h or *.ccp files need to be touched, since they have | |
186 # rules which do not update them when the generator file has not | |
187 # changed their contents. | |
188 $(QUIETLY) if [ -f lib$(GENOFFS).so ]; then touch lib$(GENOFFS).so; fi | |
189 $(QUIETLY) if [ -f $(GENOFFS) ]; then touch $(GENOFFS); fi | |
190 $(QUIETLY) if [ -f $(JVMOFFS.o) ]; then touch $(JVMOFFS.o); fi | |
191 | |
192 .PHONY: dtraceCheck | |
193 | |
116
018d5b58dd4f
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
91
diff
changeset
|
194 SYSTEM_DTRACE_H = /usr/include/dtrace.h |
0 | 195 SYSTEM_DTRACE_PROG = /usr/sbin/dtrace |
196 PATCH_DTRACE_PROG = /opt/SUNWdtrd/sbin/dtrace | |
197 systemDtraceFound := $(wildcard ${SYSTEM_DTRACE_PROG}) | |
198 patchDtraceFound := $(wildcard ${PATCH_DTRACE_PROG}) | |
116
018d5b58dd4f
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
91
diff
changeset
|
199 systemDtraceHdrFound := $(wildcard $(SYSTEM_DTRACE_H)) |
018d5b58dd4f
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
91
diff
changeset
|
200 |
018d5b58dd4f
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
91
diff
changeset
|
201 ifneq ("$(systemDtraceHdrFound)", "") |
018d5b58dd4f
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
91
diff
changeset
|
202 CFLAGS += -DHAVE_DTRACE_H |
018d5b58dd4f
6537506: Provide a mechanism for specifying Java-level USDT-like dtrace probes
kamg
parents:
91
diff
changeset
|
203 endif |
0 | 204 |
205 ifneq ("$(patchDtraceFound)", "") | |
206 DTRACE_PROG=$(PATCH_DTRACE_PROG) | |
207 DTRACE_INCL=-I/opt/SUNWdtrd/include | |
208 else | |
209 ifneq ("$(systemDtraceFound)", "") | |
210 DTRACE_PROG=$(SYSTEM_DTRACE_PROG) | |
211 else | |
212 | |
213 endif # ifneq ("$(systemDtraceFound)", "") | |
214 endif # ifneq ("$(patchDtraceFound)", "") | |
215 | |
216 ifneq ("${DTRACE_PROG}", "") | |
217 ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "") | |
218 | |
219 DTRACE_OBJS = $(DTRACE.o) $(JVMOFFS.o) | |
220 CFLAGS += $(DTRACE_INCL) -DDTRACE_ENABLED | |
221 MAPFILE_DTRACE_OPT = $(MAPFILE_DTRACE) | |
222 | |
223 dtraceCheck: | |
224 | |
225 else # manually disabled | |
226 | |
227 dtraceCheck: | |
228 $(QUIETLY) echo "**NOTICE** Dtrace support disabled via environment variable" | |
229 | |
230 endif # ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "") | |
231 | |
232 else # No dtrace program found | |
233 | |
234 dtraceCheck: | |
235 $(QUIETLY) echo "**NOTICE** Dtrace support disabled: not supported by system" | |
236 | |
237 endif # ifneq ("${dtraceFound}", "") | |
238 | |
239 endif # ifdef USE_GCC | |
240 | |
241 else # KERNEL build | |
242 | |
243 dtraceCheck: | |
244 $(QUIETLY) echo "**NOTICE** Dtrace support disabled for KERNEL builds" | |
245 | |
246 endif # ifneq ("${TYPE}", "KERNEL") | |
247 | |
248 else # CORE build | |
249 | |
250 dtraceCheck: | |
251 $(QUIETLY) echo "**NOTICE** Dtrace support disabled for CORE builds" | |
252 | |
253 endif # ifneq ("${TYPE}", "CORE") |