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