author | erikj |
Fri, 22 Mar 2019 08:14:21 -0700 | |
changeset 54250 | 601326fead41 |
parent 53683 | 48ff68e2fe5c |
child 55017 | 5dc15cb1405c |
permissions | -rw-r--r-- |
37437 | 1 |
# |
49070
d7859531621b
8198751: Refactor SetupNativeCompilation to take NAME and TYPE
ihse
parents:
47217
diff
changeset
|
2 |
# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. |
37437 | 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. 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) |
|
53683 | 27 |
ifeq ($(call isTargetOs, solaris), true) |
37437 | 28 |
|
29 |
############################################################################ |
|
49553 | 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. |
|
37437 | 46 |
|
47 |
# Concatenate all *.d files into a single file |
|
47217 | 48 |
DTRACE_SOURCE_FILES := $(addprefix $(TOPDIR)/src/hotspot/os/posix/dtrace/, \ |
37437 | 49 |
hotspot_jni.d \ |
50 |
hotspot.d \ |
|
51 |
hs_private.d \ |
|
52 |
) |
|
53 |
||
54 |
$(JVM_OUTPUTDIR)/objs/dtrace.d: $(DTRACE_SOURCE_FILES) |
|
55 |
$(call LogInfo, Generating $(@F)) |
|
56 |
$(call MakeDir, $(@D)) |
|
57 |
$(CAT) $^ > $@ |
|
58 |
||
59 |
DTRACE_INSTRUMENTED_OBJS := $(addprefix $(JVM_OUTPUTDIR)/objs/, \ |
|
60 |
ciEnv.o \ |
|
61 |
classLoadingService.o \ |
|
62 |
compileBroker.o \ |
|
52876
2d17750d41e7
8214791: Consistently name gc files containing VM operations
tschatzl
parents:
49982
diff
changeset
|
63 |
gcVMOperations.o \ |
37437 | 64 |
hashtable.o \ |
65 |
instanceKlass.o \ |
|
66 |
java.o \ |
|
67 |
jni.o \ |
|
68 |
jvm.o \ |
|
69 |
memoryManager.o \ |
|
70 |
nmethod.o \ |
|
71 |
objectMonitor.o \ |
|
72 |
runtimeService.o \ |
|
73 |
sharedRuntime.o \ |
|
74 |
synchronizer.o \ |
|
75 |
thread.o \ |
|
76 |
unsafe.o \ |
|
77 |
vmThread.o \ |
|
78 |
) |
|
79 |
||
49982 | 80 |
ifeq ($(call check-jvm-feature, cmsgc), true) |
37437 | 81 |
DTRACE_INSTRUMENTED_OBJS += $(addprefix $(JVM_OUTPUTDIR)/objs/, \ |
52876
2d17750d41e7
8214791: Consistently name gc files containing VM operations
tschatzl
parents:
49982
diff
changeset
|
82 |
cmsVMOperations.o \ |
49982 | 83 |
) |
84 |
endif |
|
85 |
||
86 |
ifeq ($(call check-jvm-feature, parallelgc), true) |
|
87 |
DTRACE_INSTRUMENTED_OBJS += $(addprefix $(JVM_OUTPUTDIR)/objs/, \ |
|
52876
2d17750d41e7
8214791: Consistently name gc files containing VM operations
tschatzl
parents:
49982
diff
changeset
|
88 |
psVMOperations.o \ |
37437 | 89 |
) |
90 |
endif |
|
91 |
||
92 |
DTRACE_FLAGS := -64 -G |
|
93 |
DTRACE_CPP_FLAGS := -D_LP64 |
|
94 |
||
95 |
# Make sure we run our selected compiler for preprocessing instead of letting |
|
96 |
# the dtrace tool pick it on it's own. |
|
97 |
$(DTRACE_OBJ): $(JVM_OUTPUTDIR)/objs/dtrace.d $(DTRACE_INSTRUMENTED_OBJS) |
|
98 |
$(call LogInfo, Generating $(@F) from $(<F) and object files) |
|
99 |
$(call MakeDir, $(DTRACE_SUPPORT_DIR)) |
|
49124
6abbc1f5c2a1
8198862: Stop doing funky compilation stuff for dtrace
ihse
parents:
49078
diff
changeset
|
100 |
$(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).d, \ |
6abbc1f5c2a1
8198862: Stop doing funky compilation stuff for dtrace
ihse
parents:
49078
diff
changeset
|
101 |
($(CPP) $(DTRACE_CPP_FLAGS) $< > $(DTRACE_SUPPORT_DIR)/$(@F).d)) |
37437 | 102 |
$(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -xlazyload -o $@ \ |
103 |
-s $(DTRACE_SUPPORT_DIR)/$(@F).d $(sort $(DTRACE_INSTRUMENTED_OBJS))) |
|
104 |
||
105 |
############################################################################ |
|
106 |
# Generate DTRACE_JHELPER_OBJ which is linked with libjvm.so. |
|
107 |
||
49553 | 108 |
JHELPER_DTRACE_SRC := $(TOPDIR)/src/hotspot/os/solaris/dtrace/jhelper.d |
109 |
||
110 |
# jhelper.d includes JvmOffsetsIndex.h which was created by the gensrc step. |
|
111 |
DTRACE_GENSRC_DIR := $(JVM_VARIANT_OUTPUTDIR)/gensrc/dtracefiles |
|
112 |
JVM_OFFSETS_INDEX_H := $(DTRACE_GENSRC_DIR)/JvmOffsetsIndex.h |
|
113 |
||
37437 | 114 |
# Unfortunately dtrace generates incorrect types for some symbols in |
115 |
# dtrace_jhelper.o, resulting in "warning: symbol X has differing types" |
|
49078
039e63e471e1
8198859: Use elfedit to silence linker warnings on solaris
ihse
parents:
49070
diff
changeset
|
116 |
# See JDK-6890703 for details. |
039e63e471e1
8198859: Use elfedit to silence linker warnings on solaris
ihse
parents:
49070
diff
changeset
|
117 |
# We work around this by fixing the types for these symbols using elfedit, |
039e63e471e1
8198859: Use elfedit to silence linker warnings on solaris
ihse
parents:
49070
diff
changeset
|
118 |
# after dtrace has generated the .o file. |
49124
6abbc1f5c2a1
8198862: Stop doing funky compilation stuff for dtrace
ihse
parents:
49078
diff
changeset
|
119 |
GetElfeditCommands = \ |
6abbc1f5c2a1
8198862: Stop doing funky compilation stuff for dtrace
ihse
parents:
49078
diff
changeset
|
120 |
$(foreach symbol, \ |
6abbc1f5c2a1
8198862: Stop doing funky compilation stuff for dtrace
ihse
parents:
49078
diff
changeset
|
121 |
$(shell $(GREP) ^extern $(JHELPER_DTRACE_SRC) | $(AWK) '{ gsub(";","") ; print $$3 }'), \ |
6abbc1f5c2a1
8198862: Stop doing funky compilation stuff for dtrace
ihse
parents:
49078
diff
changeset
|
122 |
-e 'sym:st_type $(symbol) 1') |
6abbc1f5c2a1
8198862: Stop doing funky compilation stuff for dtrace
ihse
parents:
49078
diff
changeset
|
123 |
|
6abbc1f5c2a1
8198862: Stop doing funky compilation stuff for dtrace
ihse
parents:
49078
diff
changeset
|
124 |
# Make sure we run our selected compiler for preprocessing instead of letting |
6abbc1f5c2a1
8198862: Stop doing funky compilation stuff for dtrace
ihse
parents:
49078
diff
changeset
|
125 |
# the dtrace tool pick it on it's own. |
49078
039e63e471e1
8198859: Use elfedit to silence linker warnings on solaris
ihse
parents:
49070
diff
changeset
|
126 |
$(DTRACE_JHELPER_OBJ): $(JHELPER_DTRACE_SRC) $(JVM_OFFSETS_INDEX_H) |
37437 | 127 |
$(call LogInfo, Running dtrace for $(<F)) |
49124
6abbc1f5c2a1
8198862: Stop doing funky compilation stuff for dtrace
ihse
parents:
49078
diff
changeset
|
128 |
$(call MakeDir, $(DTRACE_SUPPORT_DIR)) |
6abbc1f5c2a1
8198862: Stop doing funky compilation stuff for dtrace
ihse
parents:
49078
diff
changeset
|
129 |
$(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).d, \ |
49553 | 130 |
($(CPP) $(DTRACE_CPP_FLAGS) -I$(DTRACE_GENSRC_DIR) $^ \ |
49124
6abbc1f5c2a1
8198862: Stop doing funky compilation stuff for dtrace
ihse
parents:
49078
diff
changeset
|
131 |
> $(DTRACE_SUPPORT_DIR)/$(@F).d)) |
6abbc1f5c2a1
8198862: Stop doing funky compilation stuff for dtrace
ihse
parents:
49078
diff
changeset
|
132 |
$(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -o $@ \ |
6abbc1f5c2a1
8198862: Stop doing funky compilation stuff for dtrace
ihse
parents:
49078
diff
changeset
|
133 |
-s $(DTRACE_SUPPORT_DIR)/$(@F).d) |
53683 | 134 |
ifeq ($(call isTargetCpuArch, sparc), true) |
49157 | 135 |
$(call ExecuteWithLog, $@.elfedit, $(ELFEDIT) $(call GetElfeditCommands) $@) |
136 |
endif |
|
37437 | 137 |
|
138 |
endif |
|
139 |
endif |