7 # published by the Free Software Foundation. Oracle designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Oracle in the LICENSE file that accompanied this code.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any
23 # questions.
24 #
25
26 ifeq ($(call check-jvm-feature, dtrace), true)
27 ifeq ($(OPENJDK_TARGET_OS), solaris)
28
29 ############################################################################
30 # Integrate with libjvm. Here we generate two object files which are
31 # linked with libjvm.so. This step is complicated from a dependency
32 # perspective. We add these two files to the linking of libjvm using
33 # EXTRA_OBJECT_FILES, but they need to be created outside the call to
34 # SetupNativeCompilation. Also, one of the files is dependent on compiled
35 # object files from the libjvm compilation, so this generation must happen
36 # as a part of the libjvm compilation.
37
38 DTRACE_OBJ := $(JVM_OUTPUTDIR)/objs/dtrace.o
39 DTRACE_JHELPER_OBJ := $(JVM_OUTPUTDIR)/objs/dtrace_jhelper.o
40
41 DTRACE_EXTRA_OBJECT_FILES := $(DTRACE_OBJ) $(DTRACE_JHELPER_OBJ)
42
43 ############################################################################
44 # Generate DTRACE_OBJ which is linked with libjvm.so. It depends on a set of
45 # object files from the compilation.
46
47 # Concatenate all *.d files into a single file
114 # Unfortunately dtrace generates incorrect types for some symbols in
115 # dtrace_jhelper.o, resulting in "warning: symbol X has differing types"
116 # See JDK-6890703 for details.
117 # We work around this by fixing the types for these symbols using elfedit,
118 # after dtrace has generated the .o file.
119 GetElfeditCommands = \
120 $(foreach symbol, \
121 $(shell $(GREP) ^extern $(JHELPER_DTRACE_SRC) | $(AWK) '{ gsub(";","") ; print $$3 }'), \
122 -e 'sym:st_type $(symbol) 1')
123
124 # Make sure we run our selected compiler for preprocessing instead of letting
125 # the dtrace tool pick it on it's own.
126 $(DTRACE_JHELPER_OBJ): $(JHELPER_DTRACE_SRC) $(JVM_OFFSETS_INDEX_H)
127 $(call LogInfo, Running dtrace for $(<F))
128 $(call MakeDir, $(DTRACE_SUPPORT_DIR))
129 $(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).d, \
130 ($(CPP) $(DTRACE_CPP_FLAGS) -I$(DTRACE_GENSRC_DIR) $^ \
131 > $(DTRACE_SUPPORT_DIR)/$(@F).d))
132 $(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -o $@ \
133 -s $(DTRACE_SUPPORT_DIR)/$(@F).d)
134 ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
135 $(call ExecuteWithLog, $@.elfedit, $(ELFEDIT) $(call GetElfeditCommands) $@)
136 endif
137
138 endif
139 endif
|
7 # published by the Free Software Foundation. Oracle designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Oracle in the LICENSE file that accompanied this code.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any
23 # questions.
24 #
25
26 ifeq ($(call check-jvm-feature, dtrace), true)
27 ifeq ($(call isTargetOs, solaris), true)
28
29 ############################################################################
30 # Integrate with libjvm. Here we generate two object files which are
31 # linked with libjvm.so. This step is complicated from a dependency
32 # perspective. We add these two files to the linking of libjvm using
33 # EXTRA_OBJECT_FILES, but they need to be created outside the call to
34 # SetupNativeCompilation. Also, one of the files is dependent on compiled
35 # object files from the libjvm compilation, so this generation must happen
36 # as a part of the libjvm compilation.
37
38 DTRACE_OBJ := $(JVM_OUTPUTDIR)/objs/dtrace.o
39 DTRACE_JHELPER_OBJ := $(JVM_OUTPUTDIR)/objs/dtrace_jhelper.o
40
41 DTRACE_EXTRA_OBJECT_FILES := $(DTRACE_OBJ) $(DTRACE_JHELPER_OBJ)
42
43 ############################################################################
44 # Generate DTRACE_OBJ which is linked with libjvm.so. It depends on a set of
45 # object files from the compilation.
46
47 # Concatenate all *.d files into a single file
114 # Unfortunately dtrace generates incorrect types for some symbols in
115 # dtrace_jhelper.o, resulting in "warning: symbol X has differing types"
116 # See JDK-6890703 for details.
117 # We work around this by fixing the types for these symbols using elfedit,
118 # after dtrace has generated the .o file.
119 GetElfeditCommands = \
120 $(foreach symbol, \
121 $(shell $(GREP) ^extern $(JHELPER_DTRACE_SRC) | $(AWK) '{ gsub(";","") ; print $$3 }'), \
122 -e 'sym:st_type $(symbol) 1')
123
124 # Make sure we run our selected compiler for preprocessing instead of letting
125 # the dtrace tool pick it on it's own.
126 $(DTRACE_JHELPER_OBJ): $(JHELPER_DTRACE_SRC) $(JVM_OFFSETS_INDEX_H)
127 $(call LogInfo, Running dtrace for $(<F))
128 $(call MakeDir, $(DTRACE_SUPPORT_DIR))
129 $(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).d, \
130 ($(CPP) $(DTRACE_CPP_FLAGS) -I$(DTRACE_GENSRC_DIR) $^ \
131 > $(DTRACE_SUPPORT_DIR)/$(@F).d))
132 $(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -o $@ \
133 -s $(DTRACE_SUPPORT_DIR)/$(@F).d)
134 ifeq ($(call isTargetCpuArch, sparc), true)
135 $(call ExecuteWithLog, $@.elfedit, $(ELFEDIT) $(call GetElfeditCommands) $@)
136 endif
137
138 endif
139 endif
|