1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
|
#
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
$(eval $(call IncludeCustomExtension, hotspot/lib/JvmMapfile.gmk))
################################################################################
# Combine a list of static symbols
ifeq ($(call And, $(call isTargetOs, windows) $(call isTargetCpu, x86_64)), false)
# On Windows x86_64, we should not have any symbols at all, since that
# results in duplicate warnings from the linker (JDK-8043491).
SYMBOLS_SRC += $(TOPDIR)/make/hotspot/symbols/symbols-shared
endif
ifeq ($(call isTargetOsType, unix), true)
SYMBOLS_SRC += $(TOPDIR)/make/hotspot/symbols/symbols-unix
endif
ifneq ($(wildcard $(TOPDIR)/make/hotspot/symbols/symbols-$(OPENJDK_TARGET_OS)), )
SYMBOLS_SRC += $(TOPDIR)/make/hotspot/symbols/symbols-$(OPENJDK_TARGET_OS)
endif
ifneq ($(findstring debug, $(DEBUG_LEVEL)), )
ifneq ($(wildcard $(TOPDIR)/make/hotspot/symbols/symbols-$(OPENJDK_TARGET_OS)-debug), )
SYMBOLS_SRC += $(TOPDIR)/make/hotspot/symbols/symbols-$(OPENJDK_TARGET_OS)-debug
endif
endif
ifeq ($(call isTargetOs, solaris), true)
ifeq ($(call check-jvm-feature, dtrace), true)
# Additional mapfiles that are only used when dtrace is enabled
ifeq ($(call check-jvm-feature, compiler2), true)
# This also covers the case of compiler1+compiler2.
SYMBOLS_SRC += $(TOPDIR)/make/hotspot/symbols/symbols-solaris-dtrace-compiler2
else ifeq ($(call check-jvm-feature, compiler1), true)
SYMBOLS_SRC += $(TOPDIR)/make/hotspot/symbols/symbols-solaris-dtrace-compiler1
endif
endif
endif
################################################################################
# Create a dynamic list of symbols from the built object files. This is highly
# platform dependent.
ifeq ($(call isTargetOs, linux), true)
DUMP_SYMBOLS_CMD := $(NM) --defined-only *.o
ifneq ($(FILTER_SYMBOLS_PATTERN), )
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)|
endif
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)^_ZTV|^gHotSpotVM|^UseSharedSpaces$$
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)|^_ZN9Arguments17SharedArchivePathE$$
FILTER_SYMBOLS_AWK_SCRIPT := \
'{ \
if ($$3 ~ /$(FILTER_SYMBOLS_PATTERN)/) print $$3; \
}'
else ifeq ($(call isTargetOs, solaris), true)
DUMP_SYMBOLS_CMD := $(NM) -p *.o
ifneq ($(FILTER_SYMBOLS_PATTERN), )
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)|
endif
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)^__1c.*__vtbl_$$|^gHotSpotVM
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)|^UseSharedSpaces$$
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)|^__1cJArgumentsRSharedArchivePath_$$
FILTER_SYMBOLS_AWK_SCRIPT := \
'{ \
if ($$2 == "U") next; \
if ($$3 ~ /$(FILTER_SYMBOLS_PATTERN)/) print $$3; \
}'
else ifeq ($(call isTargetOs, macosx), true)
# nm on macosx prints out "warning: nm: no name list" to stderr for
# files without symbols. Hide this, even at the expense of hiding real errors.
DUMP_SYMBOLS_CMD := $(NM) -Uj *.o 2> /dev/null
ifneq ($(FILTER_SYMBOLS_PATTERN), )
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)|
endif
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)^_ZTV|^gHotSpotVM
FILTER_SYMBOLS_AWK_SCRIPT := \
'{ \
if ($$3 ~ /$(FILTER_SYMBOLS_PATTERN)/) print $$3; \
}'
# NOTE: The script is from the old build. It is broken and finds no symbols.
# The script below might be what was intended, but it failes to link with tons
# of 'cannot export hidden symbol vtable for X'.
# '{ if ($$1 ~ /^__ZTV/ || $$1 ~ /^_gHotSpotVM/) print substr($$1, 2) }'
else ifeq ($(call isTargetOs, aix), true)
# NOTE: The old build had the solution below. This should to be fixed in
# configure instead.
# On AIX we have to prevent that we pick up the 'nm' version from the GNU binutils
# which may be installed under /opt/freeware/bin. So better use an absolute path here!
# NM=/usr/bin/nm
DUMP_SYMBOLS_CMD := $(NM) -X64 -B -C *.o
FILTER_SYMBOLS_AWK_SCRIPT := \
'{ \
if (($$2="d" || $$2="D") && ($$3 ~ /^__vft/ || $$3 ~ /^gHotSpotVM/)) print $$3; \
if ($$3 ~ /^UseSharedSpaces$$/) print $$3; \
if ($$3 ~ /^SharedArchivePath__9Arguments$$/) print $$3; \
}'
else ifeq ($(call isTargetOs, windows), true)
DUMP_SYMBOLS_CMD := $(DUMPBIN) -symbols *.obj
FILTER_SYMBOLS_AWK_SCRIPT := \
'{ \
if ($$7 ~ /??_7.*@@6B@/ && $$7 !~ /type_info/) print $$7; \
}'
else
$(error Unknown target OS $(OPENJDK_TARGET_OS) in JvmMapfile.gmk)
endif
# A more correct solution would be to send BUILD_LIBJVM_ALL_OBJS instead of
# cd && *.o, but this will result in very long command lines, which is
# problematic on some platforms.
$(JVM_OUTPUTDIR)/symbols-objects: $(BUILD_LIBJVM_ALL_OBJS)
$(call LogInfo, Generating symbol list from object files)
$(CD) $(JVM_OUTPUTDIR)/objs && \
$(DUMP_SYMBOLS_CMD) | $(NAWK) $(FILTER_SYMBOLS_AWK_SCRIPT) | $(SORT) -u > $@
SYMBOLS_SRC += $(JVM_OUTPUTDIR)/symbols-objects
################################################################################
# Now concatenate all symbol lists into a single file and remove comments.
$(JVM_OUTPUTDIR)/symbols: $(SYMBOLS_SRC)
$(SED) -e '/^#/d' $^ > $@
################################################################################
# Finally convert the symbol list into a platform-specific mapfile
ifeq ($(call isTargetOs, macosx), true)
# On macosx, we need to add a leading underscore
define create-mapfile-work
$(AWK) '{ if ($$0 ~ ".") { print " _" $$0 } }' < $^ > $@.tmp
endef
else ifeq ($(call isTargetOs, windows), true)
# On windows, add an 'EXPORTS' header
define create-mapfile-work
$(ECHO) "EXPORTS" > $@.tmp
$(AWK) '{ if ($$0 ~ ".") { print " " $$0 } }' < $^ >> $@.tmp
endef
else
# Assume standard linker script
define create-mapfile-work
$(PRINTF) "SUNWprivate_1.1 { \n global: \n" > $@.tmp
$(AWK) '{ if ($$0 ~ ".") { print " " $$0 ";" } }' < $^ >> $@.tmp
$(PRINTF) " local: \n *; \n }; \n" >> $@.tmp
endef
endif
define create-mapfile
$(call LogInfo, Creating mapfile)
$(call MakeDir, $(@D))
$(call create-mapfile-work)
$(RM) $@
$(MV) $@.tmp $@
endef
$(JVM_MAPFILE): $(JVM_OUTPUTDIR)/symbols
$(call create-mapfile)
|