--- old/make/hotspot/lib/CompileDtracePostJvm.gmk 2018-03-01 01:42:14.075518624 +0100 +++ new/make/hotspot/lib/CompileDtracePostJvm.gmk 2018-03-01 01:42:13.867518626 +0100 @@ -49,13 +49,9 @@ NAME := dtraceGenOffsets, \ TYPE := EXECUTABLE, \ SRC := $(TOPDIR)/make/hotspot/src/native/dtrace, \ - CC := $(BUILD_CXX), \ - CXX := $(BUILD_CXX), \ - LDEXE := $(BUILD_CXX), \ - generateJvmOffsets.cpp_CXXFLAGS := $(JVM_CFLAGS) -mt -xnolib -norunpath, \ - generateJvmOffsetsMain.c_CFLAGS := -mt -m64 -norunpath -z nodefs, \ + TOOLCHAIN := $(TOOLCHAIN_BUILD), \ LDFLAGS := -m64, \ - LIBS := -lc, \ + CFLAGS := -m64 $(JVM_CFLAGS), \ OBJECT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets/objs, \ OUTPUT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets, \ )) @@ -68,7 +64,7 @@ $1: $$(BUILD_DTRACE_GEN_OFFSETS) $$(call LogInfo, Generating dtrace $2 file $$(@F)) $$(call MakeDir, $$(@D)) - $$(call ExecuteWithLog, $$@, ( $$(DTRACE_GEN_OFFSETS_TOOL) -$$(strip $2) > $$@ ) ) + $$(call ExecuteWithLog, $$@, $$(DTRACE_GEN_OFFSETS_TOOL) -$$(strip $2) > $$@) TARGETS += $1 endef @@ -78,25 +74,12 @@ JVM_OFFSETS_INDEX_H := $(DTRACE_SUPPORT_DIR)/JvmOffsetsIndex.h # Run the dtrace-gen-offset tool to generate these three files. + # The generated JvmOffsets.cpp is compiled with the rest of libjvm. $(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_H), header)) $(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_INDEX_H), index)) $(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_CPP), table)) ############################################################################ - # Compile JVM_OFFSETS_OBJ which is linked with libjvm.so. - - # JvmOffsets.cpp is compiled without the common JVM_CFLAGS. Otherwise, the - # natural way would have been to included this source code in BUILD_LIBJVM. - JVM_OFFSETS_CFLAGS := -m64 - ifeq ($(OPENJDK_TARGET_CPU), sparcv9) - JVM_OFFSETS_CFLAGS += -xarch=sparc - endif - - $(JVM_OFFSETS_OBJ): $(JVM_OFFSETS_CPP) $(JVM_OFFSETS_H) - $(call LogInfo, Compiling dtrace file JvmOffsets.cpp (for libjvm.so)) - $(call ExecuteWithLog, $@, $(CXX) -c -I$( $(DTRACE_SUPPORT_DIR)/$(@F).d) $(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -xlazyload -o $@ \ -s $(DTRACE_SUPPORT_DIR)/$(@F).d $(sort $(DTRACE_INSTRUMENTED_OBJS))) @@ -158,20 +141,18 @@ # Unfortunately dtrace generates incorrect types for some symbols in # dtrace_jhelper.o, resulting in "warning: symbol X has differing types" # This is tracked in JDK-6890703. + # + # Make sure we run our selected compiler for preprocessing instead of letting + # the dtrace tool pick it on it's own. $(DTRACE_JHELPER_OBJ): $(TOPDIR)/src/hotspot/os/solaris/dtrace/jhelper.d \ $(JVM_OFFSETS_INDEX_H) $(call LogInfo, Running dtrace for $( $(DTRACE_SUPPORT_DIR)/$(@F).d) - # $(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -o $@ \ - # -s $(DTRACE_SUPPORT_DIR)/$(@F).d) + $(call MakeDir, $(DTRACE_SUPPORT_DIR)) + $(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).d, $(CPP) \ + $(DTRACE_CPP_FLAGS) -I$(DTRACE_SUPPORT_DIR) $^ \ + > $(DTRACE_SUPPORT_DIR)/$(@F).d) + $(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -o $@ \ + -s $(DTRACE_SUPPORT_DIR)/$(@F).d) ############################################################################ # Build the stand-alone dtrace libraries