author | hseigel |
Wed, 01 Mar 2017 08:00:02 -0500 | |
changeset 46194 | 5596e6f63072 |
parent 38255 | 5784bccf53b0 |
permissions | -rw-r--r-- |
37437 | 1 |
# |
2 |
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. |
|
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 |
$(eval $(call IncludeCustomExtension, hotspot, lib/JvmMapfile.gmk)) |
|
27 |
||
28 |
################################################################################ |
|
29 |
# Combine a list of static symbols |
|
30 |
||
31 |
ifneq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), windows-x86_64) |
|
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). |
|
38097 | 34 |
SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/make/symbols/symbols-shared |
37437 | 35 |
endif |
36 |
||
37 |
ifeq ($(OPENJDK_TARGET_OS_TYPE), unix) |
|
38097 | 38 |
SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/make/symbols/symbols-unix |
37437 | 39 |
endif |
40 |
||
38097 | 41 |
ifneq ($(wildcard $(HOTSPOT_TOPDIR)/make/symbols/symbols-$(OPENJDK_TARGET_OS)), ) |
42 |
SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/make/symbols/symbols-$(OPENJDK_TARGET_OS) |
|
37437 | 43 |
endif |
44 |
||
45 |
ifneq ($(findstring debug, $(DEBUG_LEVEL)), ) |
|
38097 | 46 |
ifneq ($(wildcard $(HOTSPOT_TOPDIR)/make/symbols/symbols-$(OPENJDK_TARGET_OS)-debug), ) |
47 |
SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/make/symbols/symbols-$(OPENJDK_TARGET_OS)-debug |
|
37437 | 48 |
endif |
49 |
endif |
|
50 |
||
51 |
ifeq ($(OPENJDK_TARGET_OS), solaris) |
|
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. |
|
38097 | 56 |
SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/make/symbols/symbols-solaris-dtrace-compiler2 |
37437 | 57 |
else ifeq ($(call check-jvm-feature, compiler1), true) |
38097 | 58 |
SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/make/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 |
||
67 |
ifeq ($(OPENJDK_TARGET_OS), linux) |
|
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 |
||
79 |
else ifeq ($(OPENJDK_TARGET_OS), solaris) |
|
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 |
||
93 |
else ifeq ($(OPENJDK_TARGET_OS), macosx) |
|
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) }' |
|
110 |
else ifeq ($(OPENJDK_TARGET_OS), aix) |
|
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 |
||
126 |
else ifeq ($(OPENJDK_TARGET_OS), windows) |
|
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 |
||
38255
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
156 |
ifeq ($(OPENJDK_TARGET_OS), macosx) |
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 |
5784bccf53b0
8148244: Finalize and integrate GTest implementation
iignatyev
parents:
38097
diff
changeset
|
161 |
else ifeq ($(OPENJDK_TARGET_OS), windows) |
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) |