2796N/A#
4170N/A# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
2796N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2796N/A#
2796N/A# This code is free software; you can redistribute it and/or modify it
2796N/A# under the terms of the GNU General Public License version 2 only, as
2796N/A# published by the Free Software Foundation.
2796N/A#
2796N/A# This code is distributed in the hope that it will be useful, but WITHOUT
2796N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2796N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2796N/A# version 2 for more details (a copy is included in the LICENSE file that
2796N/A# accompanied this code).
2796N/A#
2796N/A# You should have received a copy of the GNU General Public License version
2796N/A# 2 along with this work; if not, write to the Free Software Foundation,
2796N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2796N/A#
2796N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2796N/A# or visit www.oracle.com if you need additional information or have any
2796N/A# questions.
2796N/A#
2796N/A#
2796N/A
2842N/A# Rules to build jvm_db/dtrace, used by vm.make
2842N/A
2842N/A# We build libjvm_dtrace/libjvm_db/dtrace for COMPILER1 and COMPILER2
4170N/A# but not for CORE configuration.
2842N/A
2842N/Aifneq ("${TYPE}", "CORE")
2842N/A
2842N/Aifeq ($(OS_VENDOR), Darwin)
2842N/A# we build dtrace for macosx using USDT2 probes
2842N/A
2842N/ADtraceOutDir = $(GENERATED)/dtracefiles
2842N/A
2842N/A# Bsd does not build libjvm_db, does not compile on macosx
2842N/A# disabled in build: rule in vm.make
2842N/AJVM_DB = libjvm_db
2842N/A#LIBJVM_DB = libjvm_db.dylib
2842N/ALIBJVM_DB = libjvm$(G_SUFFIX)_db.dylib
2842N/A
2842N/AJVM_DTRACE = jvm_dtrace
2842N/A#LIBJVM_DTRACE = libjvm_dtrace.dylib
2842N/ALIBJVM_DTRACE = libjvm$(G_SUFFIX)_dtrace.dylib
2842N/A
2842N/AJVMOFFS = JvmOffsets
2842N/AJVMOFFS.o = $(JVMOFFS).o
2842N/AGENOFFS = generate$(JVMOFFS)
2842N/A
2842N/ADTRACE_SRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/dtrace
2842N/ADTRACE = dtrace
2842N/ADTRACE.o = $(DTRACE).o
2842N/A
2842N/A# to remove '-g' option which causes link problems
2842N/A# also '-z nodefs' is used as workaround
2842N/AGENOFFS_CFLAGS = $(shell echo $(CFLAGS) | sed -e 's/ -g / /g' -e 's/ -g0 / /g';)
2842N/A
2842N/Aifdef LP64
2842N/ADTRACE_OPTS = -D_LP64
2842N/Aendif
2842N/A
2842N/A# making libjvm_db
2842N/A
2842N/A# Use mapfile with libjvm_db.so
2842N/ALIBJVM_DB_MAPFILE = # no mapfile for usdt2 # $(MAKEFILES_DIR)/mapfile-vers-jvm_db
2842N/A#LFLAGS_JVM_DB += $(MAPFLAG:FILENAME=$(LIBJVM_DB_MAPFILE))
2842N/A
2842N/A# Use mapfile with libjvm_dtrace.so
2842N/ALIBJVM_DTRACE_MAPFILE = # no mapfile for usdt2 # $(MAKEFILES_DIR)/mapfile-vers-jvm_dtrace
2842N/A#LFLAGS_JVM_DTRACE += $(MAPFLAG:FILENAME=$(LIBJVM_DTRACE_MAPFILE))
2842N/A
2842N/ALFLAGS_JVM_DB += $(PICFLAG) # -D_REENTRANT
2842N/ALFLAGS_JVM_DTRACE += $(PICFLAG) # -D_REENTRANT
2842N/A
2842N/AISA = $(subst i386,i486,$(BUILDARCH))
2842N/A
2842N/A# Making 64/libjvm_db.so: 64-bit version of libjvm_db.so which handles 32-bit libjvm.so
2842N/Aifneq ("${ISA}","${BUILDARCH}")
2842N/A
2842N/AXLIBJVM_DB = 64/$(LIBJVM_DB)
2842N/AXLIBJVM_DB_G = 64/$(LIBJVM_DB_G)
2842N/AXLIBJVM_DTRACE = 64/$(LIBJVM_DTRACE)
2842N/AXLIBJVM_DTRACE_G = 64/$(LIBJVM_DTRACE_G)
2842N/AXARCH = $(subst sparcv9,v9,$(shell echo $(ISA)))
2842N/A
2842N/A$(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE)
2842N/A @echo Making $@
2842N/A $(QUIETLY) mkdir -p 64/ ; \
2842N/A $(CC) $(SYMFLAG) -xarch=$(XARCH) -D$(TYPE) -I. -I$(GENERATED) \
2842N/A $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c #-lc
2842N/A# [ -f $(XLIBJVM_DB_G) ] || { ln -s $(LIBJVM_DB) $(XLIBJVM_DB_G); }
2842N/A
2842N/A$(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
2842N/A @echo Making $@
2842N/A $(QUIETLY) mkdir -p 64/ ; \
2842N/A $(CC) $(SYMFLAG) -xarch=$(XARCH) -D$(TYPE) -I. \
2842N/A $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c #-lc -lthread -ldoor
2842N/A# [ -f $(XLIBJVM_DTRACE_G) ] || { ln -s $(LIBJVM_DTRACE) $(XLIBJVM_DTRACE_G); }
2842N/A
2842N/Aendif # ifneq ("${ISA}","${BUILDARCH}")
2842N/A
2842N/ALFLAGS_GENOFFS += -L.
2842N/A
2842N/Alib$(GENOFFS).dylib: $(DTRACE_SRCDIR)/$(GENOFFS).cpp $(DTRACE_SRCDIR)/$(GENOFFS).h \
2842N/A $(LIBJVM.o)
3178N/A $(QUIETLY) $(CXX) $(CXXFLAGS) $(GENOFFS_CFLAGS) $(SHARED_FLAG) $(PICFLAG) \
2842N/A $(LFLAGS_GENOFFS) -o $@ $(DTRACE_SRCDIR)/$(GENOFFS).cpp -ljvm
2842N/A
2842N/A$(GENOFFS): $(DTRACE_SRCDIR)/$(GENOFFS)Main.c lib$(GENOFFS).dylib
3178N/A $(QUIETLY) $(LINK.CXX) -o $@ $(DTRACE_SRCDIR)/$(GENOFFS)Main.c \
2842N/A ./lib$(GENOFFS).dylib
2842N/A
2842N/A# $@.tmp is created first to avoid an empty $(JVMOFFS).h if an error occurs.
2842N/A$(JVMOFFS).h: $(GENOFFS)
4029N/A $(QUIETLY) DYLD_LIBRARY_PATH=.:$(DYLD_LIBRARY_PATH) ./$(GENOFFS) -header > $@.tmp; touch $@; \
2842N/A if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \
2842N/A then rm -f $@; mv $@.tmp $@; \
2842N/A else rm -f $@.tmp; \
2842N/A fi
2842N/A
2842N/A$(JVMOFFS)Index.h: $(GENOFFS)
4029N/A $(QUIETLY) DYLD_LIBRARY_PATH=.:$(DYLD_LIBRARY_PATH) ./$(GENOFFS) -index > $@.tmp; touch $@; \
2842N/A if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \
2842N/A then rm -f $@; mv $@.tmp $@; \
2842N/A else rm -f $@.tmp; \
2842N/A fi
2842N/A
2842N/A$(JVMOFFS).cpp: $(GENOFFS) $(JVMOFFS).h $(JVMOFFS)Index.h
4029N/A $(QUIETLY) DYLD_LIBRARY_PATH=.:$(DYLD_LIBRARY_PATH) ./$(GENOFFS) -table > $@.tmp; touch $@; \
2842N/A if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \
2842N/A then rm -f $@; mv $@.tmp $@; \
2842N/A else rm -f $@.tmp; \
2842N/A fi
2842N/A
2842N/A$(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp
3178N/A $(QUIETLY) $(CXX) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp
2842N/A
2842N/A$(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE)
2842N/A @echo Making $@
2842N/A $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \
2842N/A $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -Wall # -lc
2842N/A# [ -f $(LIBJVM_DB_G) ] || { ln -s $@ $(LIBJVM_DB_G); }
2842N/A
2842N/A$(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
2842N/A @echo Making $@
2842N/A $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \
2842N/A $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c #-lc -lthread -ldoor
2842N/A# [ -f $(LIBJVM_DTRACE_G) ] || { ln -s $@ $(LIBJVM_DTRACE_G); }
2842N/A
2842N/A#$(DTRACE).d: $(DTRACE_SRCDIR)/hotspot.d $(DTRACE_SRCDIR)/hotspot_jni.d \
2842N/A# $(DTRACE_SRCDIR)/hs_private.d $(DTRACE_SRCDIR)/jhelper.d
2842N/A# $(QUIETLY) cat $^ > $@
2842N/A
2842N/A$(DtraceOutDir):
2842N/A mkdir $(DtraceOutDir)
2842N/A
2842N/A$(DtraceOutDir)/hotspot.h: $(DTRACE_SRCDIR)/hotspot.d | $(DtraceOutDir)
2842N/A $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_SRCDIR)/hotspot.d
2842N/A
2842N/A$(DtraceOutDir)/hotspot_jni.h: $(DTRACE_SRCDIR)/hotspot_jni.d | $(DtraceOutDir)
2842N/A $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_SRCDIR)/hotspot_jni.d
2796N/A
2842N/A$(DtraceOutDir)/hs_private.h: $(DTRACE_SRCDIR)/hs_private.d | $(DtraceOutDir)
2842N/A $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_SRCDIR)/hs_private.d
2842N/A
2842N/A$(DtraceOutDir)/jhelper.h: $(DTRACE_SRCDIR)/jhelper.d $(JVMOFFS).o | $(DtraceOutDir)
2842N/A $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_SRCDIR)/jhelper.d
2842N/A
2842N/A# jhelper currently disabled
2842N/Adtrace_gen_headers: $(DtraceOutDir)/hotspot.h $(DtraceOutDir)/hotspot_jni.h $(DtraceOutDir)/hs_private.h
2842N/A
2842N/ADTraced_Files = ciEnv.o \
2842N/A classLoadingService.o \
2842N/A compileBroker.o \
2842N/A hashtable.o \
2842N/A instanceKlass.o \
2842N/A java.o \
2842N/A jni.o \
2842N/A jvm.o \
2842N/A memoryManager.o \
2842N/A nmethod.o \
2842N/A objectMonitor.o \
2842N/A runtimeService.o \
2842N/A sharedRuntime.o \
2842N/A synchronizer.o \
2842N/A thread.o \
2842N/A unsafe.o \
2842N/A vmThread.o \
2842N/A vmCMSOperations.o \
2842N/A vmPSOperations.o \
2842N/A vmGCOperations.o \
2842N/A
2842N/A# Dtrace is available, so we build $(DTRACE.o)
2842N/A#$(DTRACE.o): $(DTRACE).d $(JVMOFFS).h $(JVMOFFS)Index.h $(DTraced_Files)
2842N/A# @echo Compiling $(DTRACE).d
2842N/A
2842N/A# $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -xlazyload -o $@ -s $(DTRACE).d \
2842N/A# $(DTraced_Files) ||\
2842N/A# STATUS=$$?;\
2842N/A# if [ x"$$STATUS" = x"1" -a \
2842N/A# x`uname -r` = x"5.10" -a \
2842N/A# x`uname -p` = x"sparc" ]; then\
2842N/A# echo "*****************************************************************";\
2842N/A# echo "* If you are building server compiler, and the error message is ";\
2842N/A# echo "* \"incorrect ELF machine type...\", you have run into solaris bug ";\
2842N/A# echo "* 6213962, \"dtrace -G doesn't work on sparcv8+ object files\".";\
2842N/A# echo "* Either patch/upgrade your system (>= S10u1_15), or set the ";\
2842N/A# echo "* environment variable HOTSPOT_DISABLE_DTRACE_PROBES to disable ";\
2842N/A# echo "* dtrace probes for this build.";\
2842N/A# echo "*****************************************************************";\
2842N/A# fi;\
2842N/A# exit $$STATUS
2842N/A # Since some DTraced_Files are in LIBJVM.o and they are touched by this
2842N/A # command, and libgenerateJvmOffsets.so depends on LIBJVM.o, 'make' will
2842N/A # think it needs to rebuild libgenerateJvmOffsets.so and thus JvmOffsets*
2842N/A # files, but it doesn't, so we touch the necessary files to prevent later
2842N/A # recompilation. Note: we only touch the necessary files if they already
2842N/A # exist in order to close a race where an empty file can be created
2842N/A # before the real build rule is executed.
2842N/A # But, we can't touch the *.h files: This rule depends
2842N/A # on them, and that would cause an infinite cycle of rebuilding.
2842N/A # Neither the *.h or *.ccp files need to be touched, since they have
2842N/A # rules which do not update them when the generator file has not
2842N/A # changed their contents.
2842N/A# $(QUIETLY) if [ -f lib$(GENOFFS).so ]; then touch lib$(GENOFFS).so; fi
2842N/A# $(QUIETLY) if [ -f $(GENOFFS) ]; then touch $(GENOFFS); fi
2842N/A# $(QUIETLY) if [ -f $(JVMOFFS.o) ]; then touch $(JVMOFFS.o); fi
2842N/A
2842N/A.PHONY: dtraceCheck
2842N/A
2842N/A#SYSTEM_DTRACE_H = /usr/include/dtrace.h
2842N/ASYSTEM_DTRACE_PROG = /usr/sbin/dtrace
2842N/A#PATCH_DTRACE_PROG = /opt/SUNWdtrd/sbin/dtrace
2842N/AsystemDtraceFound := $(wildcard ${SYSTEM_DTRACE_PROG})
2842N/A#patchDtraceFound := $(wildcard ${PATCH_DTRACE_PROG})
2842N/A#systemDtraceHdrFound := $(wildcard $(SYSTEM_DTRACE_H))
2842N/A
2842N/A#ifneq ("$(systemDtraceHdrFound)", "")
2842N/A#CFLAGS += -DHAVE_DTRACE_H
2842N/A#endif
2842N/A
2842N/A#ifneq ("$(patchDtraceFound)", "")
2842N/A#DTRACE_PROG=$(PATCH_DTRACE_PROG)
2842N/A#DTRACE_INCL=-I/opt/SUNWdtrd/include
2842N/A#else
2842N/Aifneq ("$(systemDtraceFound)", "")
2842N/ADTRACE_PROG=$(SYSTEM_DTRACE_PROG)
2842N/Aelse
2842N/A
2842N/Aendif # ifneq ("$(systemDtraceFound)", "")
2842N/A#endif # ifneq ("$(patchDtraceFound)", "")
2842N/A
2842N/Aifneq ("${DTRACE_PROG}", "")
2842N/Aifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "")
2842N/A
2842N/ADTRACE_OBJS = $(DTRACE.o) #$(JVMOFFS.o)
2842N/ACFLAGS += -DDTRACE_ENABLED #$(DTRACE_INCL)
2842N/A#clangCFLAGS += -DDTRACE_ENABLED -fno-optimize-sibling-calls
2842N/A#MAPFILE_DTRACE_OPT = $(MAPFILE_DTRACE)
2842N/A
2842N/A
2842N/AdtraceCheck:
2842N/A
2842N/Adtrace_stuff: dtrace_gen_headers
2842N/A $(QUIETLY) echo "dtrace headers generated"
2842N/A
2842N/A
2842N/Aelse # manually disabled
2842N/A
2842N/AdtraceCheck:
2842N/A $(QUIETLY) echo "**NOTICE** Dtrace support disabled via environment variable"
2842N/A
2842N/Adtrace_stuff:
2842N/A
2842N/Aendif # ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "")
2842N/A
2842N/Aelse # No dtrace program found
2842N/A
2842N/AdtraceCheck:
2842N/A $(QUIETLY) echo "**NOTICE** Dtrace support disabled: not supported by system"
2842N/A
2842N/Adtrace_stuff:
2842N/A
2842N/Aendif # ifneq ("${dtraceFound}", "")
2842N/A
2842N/Aendif # ifeq ($(OS_VENDOR), Darwin)
2842N/A
2842N/A
2842N/Aelse # CORE build
2842N/A
2842N/AdtraceCheck:
2842N/A $(QUIETLY) echo "**NOTICE** Dtrace support disabled for CORE builds"
2842N/A
2842N/Aendif # ifneq ("${TYPE}", "CORE")