1 #
2 # Copyright (c) 2005, 2013, Oracle and/or its affiliates. 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 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 #
41 JVM_DB = libjvm_db
42 LIBJVM_DB = libjvm_db.so
43
44 LIBJVM_DB_DEBUGINFO = libjvm_db.debuginfo
45 LIBJVM_DB_DIZ = libjvm_db.diz
46
47 JVM_DTRACE = jvm_dtrace
48 LIBJVM_DTRACE = libjvm_dtrace.so
49
50 LIBJVM_DTRACE_DEBUGINFO = libjvm_dtrace.debuginfo
51 LIBJVM_DTRACE_DIZ = libjvm_dtrace.diz
52
53 JVMOFFS = JvmOffsets
54 JVMOFFS.o = $(JVMOFFS).o
55 GENOFFS = generate$(JVMOFFS)
56
57 DTRACE_SRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/dtrace
58 DTRACE_COMMON_SRCDIR = $(GAMMADIR)/src/os/posix/dtrace
59 DTRACE = dtrace
60 DTRACE.o = $(DTRACE).o
61
62 # to remove '-g' option which causes link problems
63 # also '-z nodefs' is used as workaround
64 GENOFFS_CFLAGS = $(shell echo $(CFLAGS) | sed -e 's/ -g / /g' -e 's/ -g0 / /g';)
65
66 ifdef LP64
67 DTRACE_OPTS = -64 -D_LP64
68 endif
69
70 # making libjvm_db
71
72 # Use mapfile with libjvm_db.so
73 LIBJVM_DB_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jvm_db
74 LFLAGS_JVM_DB += $(MAPFLAG:FILENAME=$(LIBJVM_DB_MAPFILE))
75
76 # Use mapfile with libjvm_dtrace.so
77 LIBJVM_DTRACE_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jvm_dtrace
78 LFLAGS_JVM_DTRACE += $(MAPFLAG:FILENAME=$(LIBJVM_DTRACE_MAPFILE))
79
80 ifdef USE_GCC
238 $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
239 $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DTRACE_DEBUGINFO)
240 # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
241 # $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@
242 $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DTRACE_DEBUGINFO) $@
243 ifeq ($(STRIP_POLICY),all_strip)
244 $(QUIETLY) $(STRIP) $@
245 else
246 ifeq ($(STRIP_POLICY),min_strip)
247 $(QUIETLY) $(STRIP) -x $@
248 # implied else here is no stripping at all
249 endif
250 endif
251 ifeq ($(ZIP_DEBUGINFO_FILES),1)
252 $(ZIPEXE) -q -y $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_DEBUGINFO)
253 $(RM) $(LIBJVM_DTRACE_DEBUGINFO)
254 endif
255 endif
256
257 $(DTRACE).d: $(DTRACE_COMMON_SRCDIR)/hotspot.d $(DTRACE_COMMON_SRCDIR)/hotspot_jni.d \
258 $(DTRACE_COMMON_SRCDIR)/hs_private.d $(DTRACE_SRCDIR)/jhelper.d
259 $(QUIETLY) cat $^ > $@
260
261 DTraced_Files = ciEnv.o \
262 classLoadingService.o \
263 compileBroker.o \
264 hashtable.o \
265 instanceKlass.o \
266 java.o \
267 jni.o \
268 jvm.o \
269 memoryManager.o \
270 nmethod.o \
271 objectMonitor.o \
272 runtimeService.o \
273 sharedRuntime.o \
274 synchronizer.o \
275 thread.o \
276 unsafe.o \
277 vmThread.o \
278 vmCMSOperations.o \
279 vmPSOperations.o \
280 vmGCOperations.o \
281
282 # Dtrace is available, so we build $(DTRACE.o)
283 $(DTRACE.o): $(DTRACE).d $(JVMOFFS).h $(JVMOFFS)Index.h $(DTraced_Files)
284 @echo Compiling $(DTRACE).d
285
286 $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -xlazyload -o $@ -s $(DTRACE).d \
287 $(DTraced_Files) ||\
288 STATUS=$$?;\
289 if [ x"$$STATUS" = x"1" ]; then \
290 if [ x`uname -r` = x"5.10" -a \
291 x`uname -p` = x"sparc" ]; then\
292 echo "*****************************************************************";\
293 echo "* If you are building server compiler, and the error message is ";\
294 echo "* \"incorrect ELF machine type...\", you have run into solaris bug ";\
295 echo "* 6213962, \"dtrace -G doesn't work on sparcv8+ object files\".";\
296 echo "* Either patch/upgrade your system (>= S10u1_15), or set the ";\
297 echo "* environment variable HOTSPOT_DISABLE_DTRACE_PROBES to disable ";\
298 echo "* dtrace probes for this build.";\
299 echo "*****************************************************************";\
300 elif [ x`uname -r` = x"5.10" ]; then\
301 echo "*****************************************************************";\
302 echo "* If you are seeing 'syntax error near \"umpiconninfo_t\"' on Solaris";\
303 echo "* 10, try doing 'cd /usr/lib/dtrace && gzip mpi.d' as root, ";\
316 # Since some DTraced_Files are in LIBJVM.o and they are touched by this
317 # command, and libgenerateJvmOffsets.so depends on LIBJVM.o, 'make' will
318 # think it needs to rebuild libgenerateJvmOffsets.so and thus JvmOffsets*
319 # files, but it doesn't, so we touch the necessary files to prevent later
320 # recompilation. Note: we only touch the necessary files if they already
321 # exist in order to close a race where an empty file can be created
322 # before the real build rule is executed.
323 # But, we can't touch the *.h files: This rule depends
324 # on them, and that would cause an infinite cycle of rebuilding.
325 # Neither the *.h or *.ccp files need to be touched, since they have
326 # rules which do not update them when the generator file has not
327 # changed their contents.
328 $(QUIETLY) if [ -f lib$(GENOFFS).so ]; then touch lib$(GENOFFS).so; fi
329 $(QUIETLY) if [ -f $(GENOFFS) ]; then touch $(GENOFFS); fi
330 $(QUIETLY) if [ -f $(JVMOFFS.o) ]; then touch $(JVMOFFS.o); fi
331
332
333 $(DtraceOutDir):
334 mkdir $(DtraceOutDir)
335
336 $(DtraceOutDir)/hotspot.h: $(DTRACE_COMMON_SRCDIR)/hotspot.d
337 $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_COMMON_SRCDIR)/hotspot.d
338
339 $(DtraceOutDir)/hotspot_jni.h: $(DTRACE_COMMON_SRCDIR)/hotspot_jni.d
340 $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_COMMON_SRCDIR)/hotspot_jni.d
341
342 $(DtraceOutDir)/hs_private.h: $(DTRACE_COMMON_SRCDIR)/hs_private.d
343 $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_COMMON_SRCDIR)/hs_private.d
344
345 dtrace_gen_headers: $(DtraceOutDir) $(DtraceOutDir)/hotspot.h $(DtraceOutDir)/hotspot_jni.h $(DtraceOutDir)/hs_private.h
346
347
348 .PHONY: dtraceCheck
349
350 SYSTEM_DTRACE_H = /usr/include/dtrace.h
351 SYSTEM_DTRACE_PROG = /usr/sbin/dtrace
352 PATCH_DTRACE_PROG = /opt/SUNWdtrd/sbin/dtrace
353 systemDtraceFound := $(wildcard ${SYSTEM_DTRACE_PROG})
354 patchDtraceFound := $(wildcard ${PATCH_DTRACE_PROG})
355 systemDtraceHdrFound := $(wildcard $(SYSTEM_DTRACE_H))
356
357 ifneq ("$(systemDtraceHdrFound)", "")
358 CFLAGS += -DHAVE_DTRACE_H
359 endif
360
361 ifneq ("$(patchDtraceFound)", "")
362 DTRACE_PROG=$(PATCH_DTRACE_PROG)
363 DTRACE_INCL=-I/opt/SUNWdtrd/include
364 else
365 ifneq ("$(systemDtraceFound)", "")
366 DTRACE_PROG=$(SYSTEM_DTRACE_PROG)
367 else
368
369 endif # ifneq ("$(systemDtraceFound)", "")
370 endif # ifneq ("$(patchDtraceFound)", "")
371
372 ifneq ("${DTRACE_PROG}", "")
373 ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "")
374
375 DTRACE_OBJS = $(DTRACE.o) $(JVMOFFS.o)
376 CFLAGS += $(DTRACE_INCL) -DDTRACE_ENABLED
377 MAPFILE_DTRACE_OPT = $(MAPFILE_DTRACE)
378
379 dtraceCheck:
380
381 else # manually disabled
382
383 dtraceCheck:
384 $(QUIETLY) echo "**NOTICE** Dtrace support disabled via environment variable"
385
386 endif # ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "")
387
388 else # No dtrace program found
389
390 dtraceCheck:
391 $(QUIETLY) echo "**NOTICE** Dtrace support disabled: not supported by system"
392
393 endif # ifneq ("${dtraceFound}", "")
394
395 endif # ifdef USE_GCC
|
1 #
2 # Copyright (c) 2005, 2014, Oracle and/or its affiliates. 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 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 #
41 JVM_DB = libjvm_db
42 LIBJVM_DB = libjvm_db.so
43
44 LIBJVM_DB_DEBUGINFO = libjvm_db.debuginfo
45 LIBJVM_DB_DIZ = libjvm_db.diz
46
47 JVM_DTRACE = jvm_dtrace
48 LIBJVM_DTRACE = libjvm_dtrace.so
49
50 LIBJVM_DTRACE_DEBUGINFO = libjvm_dtrace.debuginfo
51 LIBJVM_DTRACE_DIZ = libjvm_dtrace.diz
52
53 JVMOFFS = JvmOffsets
54 JVMOFFS.o = $(JVMOFFS).o
55 GENOFFS = generate$(JVMOFFS)
56
57 DTRACE_SRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/dtrace
58 DTRACE_COMMON_SRCDIR = $(GAMMADIR)/src/os/posix/dtrace
59 DTRACE = dtrace
60 DTRACE.o = $(DTRACE).o
61 DTRACE_JHELPER = dtrace_jhelper
62 DTRACE_JHELPER.o = $(DTRACE_JHELPER).o
63
64 # to remove '-g' option which causes link problems
65 # also '-z nodefs' is used as workaround
66 GENOFFS_CFLAGS = $(shell echo $(CFLAGS) | sed -e 's/ -g / /g' -e 's/ -g0 / /g';)
67
68 ifdef LP64
69 DTRACE_OPTS = -64 -D_LP64
70 endif
71
72 # making libjvm_db
73
74 # Use mapfile with libjvm_db.so
75 LIBJVM_DB_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jvm_db
76 LFLAGS_JVM_DB += $(MAPFLAG:FILENAME=$(LIBJVM_DB_MAPFILE))
77
78 # Use mapfile with libjvm_dtrace.so
79 LIBJVM_DTRACE_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jvm_dtrace
80 LFLAGS_JVM_DTRACE += $(MAPFLAG:FILENAME=$(LIBJVM_DTRACE_MAPFILE))
81
82 ifdef USE_GCC
240 $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
241 $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DTRACE_DEBUGINFO)
242 # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
243 # $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@
244 $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DTRACE_DEBUGINFO) $@
245 ifeq ($(STRIP_POLICY),all_strip)
246 $(QUIETLY) $(STRIP) $@
247 else
248 ifeq ($(STRIP_POLICY),min_strip)
249 $(QUIETLY) $(STRIP) -x $@
250 # implied else here is no stripping at all
251 endif
252 endif
253 ifeq ($(ZIP_DEBUGINFO_FILES),1)
254 $(ZIPEXE) -q -y $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_DEBUGINFO)
255 $(RM) $(LIBJVM_DTRACE_DEBUGINFO)
256 endif
257 endif
258
259 $(DTRACE).d: $(DTRACE_COMMON_SRCDIR)/hotspot.d $(DTRACE_COMMON_SRCDIR)/hotspot_jni.d \
260 $(DTRACE_COMMON_SRCDIR)/hs_private.d
261 $(QUIETLY) cat $^ > $@
262
263 $(DTRACE_JHELPER).d: $(DTRACE_SRCDIR)/jhelper.d
264 $(QUIETLY) cat $^ > $@
265
266 DTraced_Files = ciEnv.o \
267 classLoadingService.o \
268 compileBroker.o \
269 hashtable.o \
270 instanceKlass.o \
271 java.o \
272 jni.o \
273 jvm.o \
274 memoryManager.o \
275 nmethod.o \
276 objectMonitor.o \
277 runtimeService.o \
278 sharedRuntime.o \
279 synchronizer.o \
280 thread.o \
281 unsafe.o \
282 vmThread.o \
283 vmCMSOperations.o \
284 vmPSOperations.o \
285 vmGCOperations.o \
286
287 # Dtrace is available, so we build $(DTRACE.o)
288 $(DTRACE.o): $(DTRACE).d $(DTraced_Files)
289 @echo Compiling $(DTRACE).d
290
291 $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -xlazyload -o $@ -s $(DTRACE).d \
292 $(DTraced_Files) ||\
293 STATUS=$$?;\
294 if [ x"$$STATUS" = x"1" ]; then \
295 if [ x`uname -r` = x"5.10" -a \
296 x`uname -p` = x"sparc" ]; then\
297 echo "*****************************************************************";\
298 echo "* If you are building server compiler, and the error message is ";\
299 echo "* \"incorrect ELF machine type...\", you have run into solaris bug ";\
300 echo "* 6213962, \"dtrace -G doesn't work on sparcv8+ object files\".";\
301 echo "* Either patch/upgrade your system (>= S10u1_15), or set the ";\
302 echo "* environment variable HOTSPOT_DISABLE_DTRACE_PROBES to disable ";\
303 echo "* dtrace probes for this build.";\
304 echo "*****************************************************************";\
305 elif [ x`uname -r` = x"5.10" ]; then\
306 echo "*****************************************************************";\
307 echo "* If you are seeing 'syntax error near \"umpiconninfo_t\"' on Solaris";\
308 echo "* 10, try doing 'cd /usr/lib/dtrace && gzip mpi.d' as root, ";\
321 # Since some DTraced_Files are in LIBJVM.o and they are touched by this
322 # command, and libgenerateJvmOffsets.so depends on LIBJVM.o, 'make' will
323 # think it needs to rebuild libgenerateJvmOffsets.so and thus JvmOffsets*
324 # files, but it doesn't, so we touch the necessary files to prevent later
325 # recompilation. Note: we only touch the necessary files if they already
326 # exist in order to close a race where an empty file can be created
327 # before the real build rule is executed.
328 # But, we can't touch the *.h files: This rule depends
329 # on them, and that would cause an infinite cycle of rebuilding.
330 # Neither the *.h or *.ccp files need to be touched, since they have
331 # rules which do not update them when the generator file has not
332 # changed their contents.
333 $(QUIETLY) if [ -f lib$(GENOFFS).so ]; then touch lib$(GENOFFS).so; fi
334 $(QUIETLY) if [ -f $(GENOFFS) ]; then touch $(GENOFFS); fi
335 $(QUIETLY) if [ -f $(JVMOFFS.o) ]; then touch $(JVMOFFS.o); fi
336
337
338 $(DtraceOutDir):
339 mkdir $(DtraceOutDir)
340
341 $(DtraceOutDir)/hotspot.h: $(DTRACE_COMMON_SRCDIR)/hotspot.d | $(DtraceOutDir)
342 $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_COMMON_SRCDIR)/hotspot.d
343
344 $(DtraceOutDir)/hotspot_jni.h: $(DTRACE_COMMON_SRCDIR)/hotspot_jni.d | $(DtraceOutDir)
345 $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_COMMON_SRCDIR)/hotspot_jni.d
346
347 $(DtraceOutDir)/hs_private.h: $(DTRACE_COMMON_SRCDIR)/hs_private.d | $(DtraceOutDir)
348 $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_COMMON_SRCDIR)/hs_private.d
349
350 dtrace_gen_headers: $(DtraceOutDir)/hotspot.h $(DtraceOutDir)/hotspot_jni.h $(DtraceOutDir)/hs_private.h
351
352 # The jhelper.d and hotspot probes are separated into two different SUNW_dof sections.
353 # Now the jhelper.d is built without the -Xlazyload flag.
354 $(DTRACE_JHELPER.o) : $(DTRACE_JHELPER).d $(JVMOFFS).h $(JVMOFFS)Index.h
355 @echo Compiling $(DTRACE_JHELPER).d
356 $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -o $@ -s $(DTRACE_JHELPER).d
357
358 .PHONY: dtraceCheck
359
360 SYSTEM_DTRACE_H = /usr/include/dtrace.h
361 SYSTEM_DTRACE_PROG = /usr/sbin/dtrace
362 PATCH_DTRACE_PROG = /opt/SUNWdtrd/sbin/dtrace
363 systemDtraceFound := $(wildcard ${SYSTEM_DTRACE_PROG})
364 patchDtraceFound := $(wildcard ${PATCH_DTRACE_PROG})
365 systemDtraceHdrFound := $(wildcard $(SYSTEM_DTRACE_H))
366
367 ifneq ("$(systemDtraceHdrFound)", "")
368 CFLAGS += -DHAVE_DTRACE_H
369 endif
370
371 ifneq ("$(patchDtraceFound)", "")
372 DTRACE_PROG=$(PATCH_DTRACE_PROG)
373 DTRACE_INCL=-I/opt/SUNWdtrd/include
374 else
375 ifneq ("$(systemDtraceFound)", "")
376 DTRACE_PROG=$(SYSTEM_DTRACE_PROG)
377 else
378
379 endif # ifneq ("$(systemDtraceFound)", "")
380 endif # ifneq ("$(patchDtraceFound)", "")
381
382 ifneq ("${DTRACE_PROG}", "")
383 ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "")
384
385 DTRACE_OBJS = $(DTRACE.o) $(JVMOFFS.o) $(DTRACE_JHELPER.o)
386 CFLAGS += $(DTRACE_INCL) -DDTRACE_ENABLED
387 MAPFILE_DTRACE_OPT = $(MAPFILE_DTRACE)
388
389 dtraceCheck:
390
391 else # manually disabled
392
393 dtraceCheck:
394 $(QUIETLY) echo "**NOTICE** Dtrace support disabled via environment variable"
395
396 endif # ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "")
397
398 else # No dtrace program found
399
400 dtraceCheck:
401 $(QUIETLY) echo "**NOTICE** Dtrace support disabled: not supported by system"
402
403 endif # ifneq ("${dtraceFound}", "")
404
405 endif # ifdef USE_GCC
|