author | darcy |
Tue, 12 Nov 2019 10:45:23 -0800 | |
changeset 59037 | 3d2575331a41 |
parent 58908 | 73bb9c4002cc |
permissions | -rw-r--r-- |
37437 | 1 |
# |
58908
73bb9c4002cc
8233381: Update copyright year in build system files
ihse
parents:
53683
diff
changeset
|
2 |
# Copyright (c) 2013, 2019, 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 |
||
47314 | 26 |
$(eval $(call IncludeCustomExtension, hotspot/lib/JvmMapfile.gmk)) |
37437 | 27 |
|
28 |
################################################################################ |
|
29 |
# Combine a list of static symbols |
|
30 |
||
53683 | 31 |
ifeq ($(call And, $(call isTargetOs, windows) $(call isTargetCpu, x86_64)), false) |
37437 | 32 |
# On Windows x86_64, we should not have any symbols at all, since that |
33 |
# results in duplicate warnings from the linker (JDK-8043491). |
|
47217 | 34 |
SYMBOLS_SRC += $(TOPDIR)/make/hotspot/symbols/symbols-shared |
37437 | 35 |
endif |
36 |
||
53683 | 37 |
ifeq ($(call isTargetOsType, unix), true) |
47217 | 38 |
SYMBOLS_SRC += $(TOPDIR)/make/hotspot/symbols/symbols-unix |
37437 | 39 |
endif |
40 |
||
47217 | 41 |
ifneq ($(wildcard $(TOPDIR)/make/hotspot/symbols/symbols-$(OPENJDK_TARGET_OS)), ) |
42 |
SYMBOLS_SRC += $(TOPDIR)/make/hotspot/symbols/symbols-$(OPENJDK_TARGET_OS) |
|
37437 | 43 |
endif |
44 |
||
45 |
ifneq ($(findstring debug, $(DEBUG_LEVEL)), ) |
|
47217 | 46 |
ifneq ($(wildcard $(TOPDIR)/make/hotspot/symbols/symbols-$(OPENJDK_TARGET_OS)-debug), ) |
47 |
SYMBOLS_SRC += $(TOPDIR)/make/hotspot/symbols/symbols-$(OPENJDK_TARGET_OS)-debug |
|
37437 | 48 |
endif |
49 |
endif |
|
50 |
||
53683 | 51 |
ifeq ($(call isTargetOs, solaris), true) |
37437 | 52 |
ifeq ($(call check-jvm-feature, dtrace), true) |
53 |
# Additional mapfiles that are only used when dtrace is enabled |
|
54 |
ifeq ($(call check-jvm-feature, compiler2), true) |
|
55 |
# This also covers the case of compiler1+compiler2. |
|
47217 | 56 |
SYMBOLS_SRC += $(TOPDIR)/make/hotspot/symbols/symbols-solaris-dtrace-compiler2 |
37437 | 57 |
else ifeq ($(call check-jvm-feature, compiler1), true) |
47217 | 58 |
SYMBOLS_SRC += $(TOPDIR)/make/hotspot/symbols/symbols-solaris-dtrace-compiler1 |
37437 | 59 |
endif |
60 |
endif |
|
61 |
endif |
|
62 |
||
63 |
################################################################################ |
|
64 |
# Create a dynamic list of symbols from the built object files. This is highly |
|
65 |
# platform dependent. |
|
66 |
||
53683 | 67 |
ifeq ($(call isTargetOs, linux), true) |
37437 | 68 |
DUMP_SYMBOLS_CMD := $(NM) --defined-only *.o |
69 |
ifneq ($(FILTER_SYMBOLS_PATTERN), ) |
|
70 |
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)| |
|
71 |
endif |
|
72 |
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)^_ZTV|^gHotSpotVM|^UseSharedSpaces$$ |
|
73 |
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)|^_ZN9Arguments17SharedArchivePathE$$ |
|
74 |
FILTER_SYMBOLS_AWK_SCRIPT := \ |
|
75 |
'{ \ |
|
76 |
if ($$3 ~ /$(FILTER_SYMBOLS_PATTERN)/) print $$3; \ |
|
77 |
}' |
|
78 |
||
53683 | 79 |
else ifeq ($(call isTargetOs, solaris), true) |
37437 | 80 |
DUMP_SYMBOLS_CMD := $(NM) -p *.o |
81 |
ifneq ($(FILTER_SYMBOLS_PATTERN), ) |
|
82 |
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)| |
|
83 |
endif |
|
84 |
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)^__1c.*__vtbl_$$|^gHotSpotVM |
|
85 |
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)|^UseSharedSpaces$$ |
|
86 |
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)|^__1cJArgumentsRSharedArchivePath_$$ |
|
87 |
FILTER_SYMBOLS_AWK_SCRIPT := \ |
|
88 |
'{ \ |
|
89 |
if ($$2 == "U") next; \ |
|
90 |
if ($$3 ~ /$(FILTER_SYMBOLS_PATTERN)/) print $$3; \ |
|
91 |
}' |
|
92 |
||
53683 | 93 |
else ifeq ($(call isTargetOs, macosx), true) |
37437 | 94 |
# nm on macosx prints out "warning: nm: no name list" to stderr for |
95 |
# files without symbols. Hide this, even at the expense of hiding real errors. |
|
96 |
DUMP_SYMBOLS_CMD := $(NM) -Uj *.o 2> /dev/null |
|
97 |
ifneq ($(FILTER_SYMBOLS_PATTERN), ) |
|
98 |
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)| |
|
99 |
endif |
|
100 |
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)^_ZTV|^gHotSpotVM |
|
101 |
FILTER_SYMBOLS_AWK_SCRIPT := \ |
|
102 |
'{ \ |
|
103 |
if ($$3 ~ /$(FILTER_SYMBOLS_PATTERN)/) print $$3; \ |
|
104 |
}' |
|
105 |
||
106 |
# NOTE: The script is from the old build. It is broken and finds no symbols. |
|
107 |
# The script below might be what was intended, but it failes to link with tons |
|
108 |
# of 'cannot export hidden symbol vtable for X'. |
|
109 |
# '{ if ($$1 ~ /^__ZTV/ || $$1 ~ /^_gHotSpotVM/) print substr($$1, 2) }' |
|
53683 | 110 |
else ifeq ($(call isTargetOs, aix), true) |
37437 | 111 |
# NOTE: The old build had the solution below. This should to be fixed in |
112 |
# configure instead. |
|
113 |
||
114 |
# On AIX we have to prevent that we pick up the 'nm' version from the GNU binutils |
|
115 |
# which may be installed under /opt/freeware/bin. So better use an absolute path here! |
|
116 |
# NM=/usr/bin/nm |
|
117 |
||
118 |
DUMP_SYMBOLS_CMD := $(NM) -X64 -B -C *.o |
|
119 |
FILTER_SYMBOLS_AWK_SCRIPT := \ |
|
120 |
'{ \ |
|
121 |
if (($$2="d" || $$2="D") && ($$3 ~ /^__vft/ || $$3 ~ /^gHotSpotVM/)) print $$3; \ |
|
122 |
if ($$3 ~ /^UseSharedSpaces$$/) print $$3; \ |
|
123 |
if ($$3 ~ /^SharedArchivePath__9Arguments$$/) print $$3; \ |
|
124 |
}' |
|
125 |
||
53683 | 126 |
else ifeq ($(call isTargetOs, windows), true) |
37437 | 127 |
DUMP_SYMBOLS_CMD := $(DUMPBIN) -symbols *.obj |
128 |
FILTER_SYMBOLS_AWK_SCRIPT := \ |
|
129 |
'{ \ |
|
130 |
if ($$7 ~ /??_7.*@@6B@/ && $$7 !~ /type_info/) print $$7; \ |
|
131 |
}' |
|
132 |
||
133 |
else |
|
134 |
$(error Unknown target OS $(OPENJDK_TARGET_OS) in JvmMapfile.gmk) |
|
135 |
endif |
|
136 |
||
137 |
# A more correct solution would be to send BUILD_LIBJVM_ALL_OBJS instead of |
|
138 |
# cd && *.o, but this will result in very long command lines, which is |
|
139 |
# problematic on some platforms. |
|
140 |
$(JVM_OUTPUTDIR)/symbols-objects: $(BUILD_LIBJVM_ALL_OBJS) |
|
141 |
$(call LogInfo, Generating symbol list from object files) |
|
142 |
$(CD) $(JVM_OUTPUTDIR)/objs && \ |
|
143 |
$(DUMP_SYMBOLS_CMD) | $(NAWK) $(FILTER_SYMBOLS_AWK_SCRIPT) | $(SORT) -u > $@ |
|
144 |
||
145 |
SYMBOLS_SRC += $(JVM_OUTPUTDIR)/symbols-objects |
|
146 |
||
147 |
################################################################################ |
|
148 |
# Now concatenate all symbol lists into a single file and remove comments. |
|
149 |
||
150 |
$(JVM_OUTPUTDIR)/symbols: $(SYMBOLS_SRC) |
|
151 |
$(SED) -e '/^#/d' $^ > $@ |
|
152 |
||
153 |
################################################################################ |
|
154 |
# Finally convert the symbol list into a platform-specific mapfile |
|
155 |
||
53683 | 156 |
ifeq ($(call isTargetOs, macosx), true) |
38255
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
157 |
# On macosx, we need to add a leading underscore |
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
158 |
define create-mapfile-work |
37437 | 159 |
$(AWK) '{ if ($$0 ~ ".") { print " _" $$0 } }' < $^ > $@.tmp |
38255
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
160 |
endef |
53683 | 161 |
else ifeq ($(call isTargetOs, windows), true) |
38255
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
162 |
# On windows, add an 'EXPORTS' header |
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
163 |
define create-mapfile-work |
37437 | 164 |
$(ECHO) "EXPORTS" > $@.tmp |
165 |
$(AWK) '{ if ($$0 ~ ".") { print " " $$0 } }' < $^ >> $@.tmp |
|
38255
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
166 |
endef |
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
167 |
else |
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
168 |
# Assume standard linker script |
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
169 |
define create-mapfile-work |
37437 | 170 |
$(PRINTF) "SUNWprivate_1.1 { \n global: \n" > $@.tmp |
171 |
$(AWK) '{ if ($$0 ~ ".") { print " " $$0 ";" } }' < $^ >> $@.tmp |
|
172 |
$(PRINTF) " local: \n *; \n }; \n" >> $@.tmp |
|
38255
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
173 |
endef |
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
174 |
endif |
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
175 |
|
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
176 |
define create-mapfile |
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
177 |
$(call LogInfo, Creating mapfile) |
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
178 |
$(call MakeDir, $(@D)) |
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
179 |
$(call create-mapfile-work) |
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
180 |
$(RM) $@ |
37437 | 181 |
$(MV) $@.tmp $@ |
38255
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
182 |
endef |
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
183 |
|
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
184 |
$(JVM_MAPFILE): $(JVM_OUTPUTDIR)/symbols |
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
185 |
$(call create-mapfile) |