< prev index next >

make/hotspot/lib/CompileDtracePostJvm.gmk

Print this page

        

@@ -47,17 +47,13 @@
     # this would preferrably have been done as a part of GensrcDtrace.gmk.
     $(eval $(call SetupNativeCompilation, BUILD_DTRACE_GEN_OFFSETS, \
         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, \
     ))
 
     DTRACE_GEN_OFFSETS_TOOL := $(BUILD_DTRACE_GEN_OFFSETS_TARGET)

@@ -76,29 +72,16 @@
     JVM_OFFSETS_H := $(DTRACE_SUPPORT_DIR)/JvmOffsets.h
     JVM_OFFSETS_CPP := $(DTRACE_SUPPORT_DIR)/JvmOffsets.cpp
     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$(<D) -o $@ $(JVM_OFFSETS_CFLAGS) $<)
-
-    ############################################################################
     # Generate DTRACE_OBJ which is linked with libjvm.so.
 
     # Concatenate all *.d files into a single file
     DTRACE_SOURCE_FILES := $(addprefix $(TOPDIR)/src/hotspot/os/posix/dtrace/, \
         hotspot_jni.d \

@@ -145,12 +128,12 @@
     # Make sure we run our selected compiler for preprocessing instead of letting
     # the dtrace tool pick it on it's own.
     $(DTRACE_OBJ): $(JVM_OUTPUTDIR)/objs/dtrace.d $(DTRACE_INSTRUMENTED_OBJS)
         $(call LogInfo, Generating $(@F) from $(<F) and object files)
         $(call MakeDir, $(DTRACE_SUPPORT_DIR))
-        $(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).d, $(CC) -E \
-            $(DTRACE_CPP_FLAGS) $< > $(DTRACE_SUPPORT_DIR)/$(@F).d)
+        $(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).d, \
+            ($(CPP) $(DTRACE_CPP_FLAGS) $< > $(DTRACE_SUPPORT_DIR)/$(@F).d))
         $(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -xlazyload -o $@ \
             -s $(DTRACE_SUPPORT_DIR)/$(@F).d $(sort $(DTRACE_INSTRUMENTED_OBJS)))
 
     ############################################################################
     # Generate DTRACE_JHELPER_OBJ which is linked with libjvm.so.

@@ -159,19 +142,27 @@
     # dtrace_jhelper.o, resulting in "warning: symbol X has differing types"
     # See JDK-6890703 for details.
     # We work around this by fixing the types for these symbols using elfedit,
     # after dtrace has generated the .o file.
     JHELPER_DTRACE_SRC := $(TOPDIR)/src/hotspot/os/solaris/dtrace/jhelper.d
-    DTRACE_EXTERNAL_SYMBOLS := $(shell $(GREP) ^extern $(JHELPER_DTRACE_SRC) | $(AWK) '{ gsub(";","") ; print $$3 }')
-    DTRACE_ELFEDIT_COMMANDS := $(foreach symbol, $(DTRACE_EXTERNAL_SYMBOLS), \
+
+    GetElfeditCommands = \
+      $(foreach symbol, \
+          $(shell $(GREP) ^extern $(JHELPER_DTRACE_SRC) | $(AWK) '{ gsub(";","") ; print $$3 }'), \
       -e 'sym:st_type $(symbol) 1')
 
+    # Make sure we run our selected compiler for preprocessing instead of letting
+    # the dtrace tool pick it on it's own.
     $(DTRACE_JHELPER_OBJ): $(JHELPER_DTRACE_SRC) $(JVM_OFFSETS_INDEX_H)
         $(call LogInfo, Running dtrace for $(<F))
-        $(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) $(DTRACE_CPP_FLAGS) -C \
-            -I$(DTRACE_SUPPORT_DIR) -o $@ -s $<)
-        $(call ExecuteWithLog, $@.elfedit, $(ELFEDIT) $(DTRACE_ELFEDIT_COMMANDS) $@)
+        $(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)
+        $(call ExecuteWithLog, $@.elfedit, $(ELFEDIT) $(call GetElfeditCommands) $@)
 
     ############################################################################
     # Build the stand-alone dtrace libraries
 
     LIBJVM_DTRACE_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/libjvm_dtrace
< prev index next >