author | darcy |
Tue, 12 Nov 2019 10:45:23 -0800 | |
changeset 59037 | 3d2575331a41 |
parent 58746 | a3d208fc1b10 |
child 59122 | 5d73255c2d52 |
permissions | -rw-r--r-- |
37437 | 1 |
# |
54380 | 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 |
||
26 |
# Include support files that will setup compiler flags due to the selected |
|
49553 | 27 |
# jvm feature set, specific file overrides, and general flags. |
37437 | 28 |
include lib/JvmFeatures.gmk |
29 |
include lib/JvmOverrideFiles.gmk |
|
49553 | 30 |
include lib/JvmFlags.gmk |
37437 | 31 |
|
49553 | 32 |
# Include support files that will setup DTRACE_EXTRA_OBJECT_FILES. |
33 |
include lib/JvmDtraceObjects.gmk |
|
37437 | 34 |
|
35 |
################################################################################ |
|
36 |
# Setup compilation of the main Hotspot native library (libjvm). |
|
37 |
||
38 |
JVM_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/libjvm |
|
39 |
JVM_MAPFILE := $(JVM_OUTPUTDIR)/mapfile |
|
40 |
||
41 |
################################################################################ |
|
42 |
# Platform independent setup |
|
43 |
||
44 |
JVM_LDFLAGS += \ |
|
45 |
$(SHARED_LIBRARY_FLAGS) \ |
|
46 |
$(JVM_LDFLAGS_FEATURES) \ |
|
47 |
$(EXTRA_LDFLAGS) \ |
|
48 |
# |
|
49 |
||
55748
c6923eaecd7b
8227397: Add --with-extra-asflags configure option
sgehwolf
parents:
55738
diff
changeset
|
50 |
JVM_ASFLAGS += $(EXTRA_ASFLAGS) |
c6923eaecd7b
8227397: Add --with-extra-asflags configure option
sgehwolf
parents:
55738
diff
changeset
|
51 |
|
37437 | 52 |
JVM_LIBS += \ |
53 |
$(JVM_LIBS_FEATURES) \ |
|
54 |
# |
|
55 |
||
56 |
# These files and directories are always excluded |
|
48093 | 57 |
JVM_EXCLUDE_FILES += args.cc |
37437 | 58 |
JVM_EXCLUDES += adlc |
59 |
||
60 |
# Needed by vm_version.cpp |
|
53683 | 61 |
ifeq ($(call isTargetCpu, x86_64), true) |
37437 | 62 |
OPENJDK_TARGET_CPU_VM_VERSION := amd64 |
53683 | 63 |
else ifeq ($(call isTargetCpu, sparcv9), true) |
37437 | 64 |
OPENJDK_TARGET_CPU_VM_VERSION := sparc |
65 |
else |
|
66 |
OPENJDK_TARGET_CPU_VM_VERSION := $(OPENJDK_TARGET_CPU) |
|
67 |
endif |
|
68 |
||
69 |
CFLAGS_VM_VERSION := \ |
|
70 |
$(VERSION_CFLAGS) \ |
|
71 |
-DHOTSPOT_VERSION_STRING='"$(VERSION_STRING)"' \ |
|
72 |
-DDEBUG_LEVEL='"$(DEBUG_LEVEL)"' \ |
|
73 |
-DHOTSPOT_BUILD_USER='"$(USERNAME)"' \ |
|
74 |
-DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \ |
|
75 |
-DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \ |
|
76 |
# |
|
77 |
||
78 |
################################################################################ |
|
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
50128
diff
changeset
|
79 |
# Disabled warnings |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
50128
diff
changeset
|
80 |
|
58746 | 81 |
DISABLED_WARNINGS_gcc := parentheses comment unknown-pragmas address \ |
51853
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
82 |
delete-non-virtual-dtor char-subscripts array-bounds int-in-bool-context \ |
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
83 |
ignored-qualifiers missing-field-initializers implicit-fallthrough \ |
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
84 |
empty-body strict-overflow sequence-point maybe-uninitialized \ |
58746 | 85 |
misleading-indentation cast-function-type |
51853
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
86 |
|
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
50128
diff
changeset
|
87 |
ifeq ($(call check-jvm-feature, zero), true) |
58746 | 88 |
DISABLED_WARNINGS_gcc += return-type switch clobbered |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
50128
diff
changeset
|
89 |
endif |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
50128
diff
changeset
|
90 |
|
52026
286389b60292
8211296: Remove HotSpot deprecation warning suppression for Mac/clang
kbarrett
parents:
52022
diff
changeset
|
91 |
DISABLED_WARNINGS_clang := tautological-compare \ |
51853
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
92 |
undefined-var-template sometimes-uninitialized unknown-pragmas \ |
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
93 |
delete-non-virtual-dtor missing-braces char-subscripts \ |
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
94 |
ignored-qualifiers missing-field-initializers mismatched-tags |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
50128
diff
changeset
|
95 |
|
51853
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
96 |
DISABLED_WARNINGS_solstudio := labelnotused hidef w_novirtualdescr inlafteruse \ |
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
97 |
unknownpragma doubunder w_enumnotused w_toomanyenumnotused \ |
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
98 |
wvarhidenmem wunreachable wnoretvalue notemsource |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
50128
diff
changeset
|
99 |
|
57481
aaa83519e723
8228426: xlc: switch to clang-style warning disabling
mbaesken
parents:
55748
diff
changeset
|
100 |
DISABLED_WARNINGS_xlc := tautological-compare shift-negative-value |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
50128
diff
changeset
|
101 |
|
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
50128
diff
changeset
|
102 |
DISABLED_WARNINGS_microsoft := |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
50128
diff
changeset
|
103 |
|
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
50128
diff
changeset
|
104 |
|
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
50128
diff
changeset
|
105 |
|
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
50128
diff
changeset
|
106 |
################################################################################ |
37437 | 107 |
# Platform specific setup |
108 |
||
42664 | 109 |
# ARM source selection |
110 |
||
53683 | 111 |
ifeq ($(call And, $(call isTargetOs, linux) $(call isTargetCpu, arm)), true) |
42664 | 112 |
JVM_EXCLUDE_PATTERNS += arm_64 |
113 |
||
53683 | 114 |
else ifeq ($(call And, $(call isTargetOs, linux) $(call isTargetCpu, aarch64)), true) |
43402
caa829a4272a
8004842: Unify values of boolean make variables set in configure to true/false
ihse
parents:
42664
diff
changeset
|
115 |
# For 64-bit arm builds, we use the 64 bit hotspot/src/cpu/arm |
42664 | 116 |
# hotspot sources if HOTSPOT_TARGET_CPU_ARCH is set to arm. |
117 |
# Exclude the aarch64 and 32 bit arm files for this build. |
|
118 |
ifeq ($(HOTSPOT_TARGET_CPU_ARCH), arm) |
|
119 |
JVM_EXCLUDE_PATTERNS += arm_32 aarch64 |
|
120 |
endif |
|
121 |
endif |
|
122 |
||
53683 | 123 |
ifeq ($(call isTargetOs, linux macosx windows), true) |
47217 | 124 |
JVM_PRECOMPILED_HEADER := $(TOPDIR)/src/hotspot/share/precompiled/precompiled.hpp |
37437 | 125 |
endif |
126 |
||
53683 | 127 |
ifeq ($(call isTargetCpu, x86), true) |
37437 | 128 |
JVM_EXCLUDE_PATTERNS += x86_64 |
53683 | 129 |
else ifeq ($(call isTargetCpu, x86_64), true) |
37437 | 130 |
JVM_EXCLUDE_PATTERNS += x86_32 |
131 |
endif |
|
132 |
||
133 |
# Inline assembly for solaris |
|
53683 | 134 |
ifeq ($(call isTargetOs, solaris), true) |
135 |
ifeq ($(call isTargetCpu, x86_64), true) |
|
47217 | 136 |
JVM_CFLAGS += $(TOPDIR)/src/hotspot/os_cpu/solaris_x86/solaris_x86_64.il |
53683 | 137 |
else ifeq ($(call isTargetCpu, sparcv9), true) |
47217 | 138 |
JVM_CFLAGS += $(TOPDIR)/src/hotspot/os_cpu/solaris_sparc/solaris_sparc.il |
37437 | 139 |
endif |
49678
fa26e7c6efb7
8199782: Fix compilation warnings detected by Solaris Developer Studio 12.6
gadams
parents:
49412
diff
changeset
|
140 |
# Exclude warnings in devstudio 12.6 |
fa26e7c6efb7
8199782: Fix compilation warnings detected by Solaris Developer Studio 12.6
gadams
parents:
49412
diff
changeset
|
141 |
ifeq ($(CC_VERSION_NUMBER), 5.15) |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
50128
diff
changeset
|
142 |
DISABLED_WARNINGS_solstudio += SEC_ARR_OUTSIDE_BOUND_READ \ |
49678
fa26e7c6efb7
8199782: Fix compilation warnings detected by Solaris Developer Studio 12.6
gadams
parents:
49412
diff
changeset
|
143 |
SEC_ARR_OUTSIDE_BOUND_WRITE |
fa26e7c6efb7
8199782: Fix compilation warnings detected by Solaris Developer Studio 12.6
gadams
parents:
49412
diff
changeset
|
144 |
endif |
37437 | 145 |
endif |
146 |
||
53683 | 147 |
ifeq ($(call And, $(call isTargetOs, solaris) $(call isTargetCpu, sparcv9)), true) |
37437 | 148 |
ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), false) |
149 |
# NOTE: In the old build, we weirdly enough set -g/-g0 always, regardless |
|
150 |
# of if debug symbols were needed. Without it, compilation fails on |
|
151 |
# sparc! :-( |
|
152 |
JVM_CFLAGS += -g0 |
|
153 |
endif |
|
154 |
endif |
|
155 |
||
53683 | 156 |
ifeq ($(call isTargetOs, windows), true) |
157 |
ifeq ($(call isTargetCpuBits, 64), true) |
|
37437 | 158 |
RC_DESC := 64-Bit$(SPACE) |
159 |
endif |
|
160 |
JVM_RCFLAGS += -D"HS_FILEDESC=$(HOTSPOT_VM_DISTRO) $(RC_DESC)$(JVM_VARIANT) VM" |
|
161 |
endif |
|
162 |
||
163 |
JVM_OPTIMIZATION ?= HIGHEST_JVM |
|
164 |
||
41674
8ff2f216109b
8164120: The minimal VM should be stripped using --strip-unneeded
erikj
parents:
40010
diff
changeset
|
165 |
# Need to set JVM_STRIPFLAGS to the default value from SPEC since the STRIPFLAGS |
8ff2f216109b
8164120: The minimal VM should be stripped using --strip-unneeded
erikj
parents:
40010
diff
changeset
|
166 |
# parameter to SetupNativeCompilation allows an empty value to override the |
8ff2f216109b
8164120: The minimal VM should be stripped using --strip-unneeded
erikj
parents:
40010
diff
changeset
|
167 |
# default. |
8ff2f216109b
8164120: The minimal VM should be stripped using --strip-unneeded
erikj
parents:
40010
diff
changeset
|
168 |
JVM_STRIPFLAGS ?= $(STRIPFLAGS) |
8ff2f216109b
8164120: The minimal VM should be stripped using --strip-unneeded
erikj
parents:
40010
diff
changeset
|
169 |
|
54076
4b4745d185eb
8220383: Incremental build is broken and inefficient
erikj
parents:
53683
diff
changeset
|
170 |
# This source set is reused so save in cache. |
54380 | 171 |
$(call FillFindCache, $(JVM_SRC_DIRS)) |
54076
4b4745d185eb
8220383: Incremental build is broken and inefficient
erikj
parents:
53683
diff
changeset
|
172 |
|
37437 | 173 |
################################################################################ |
174 |
# Now set up the actual compilation of the main hotspot native library |
|
175 |
||
176 |
$(eval $(call SetupNativeCompilation, BUILD_LIBJVM, \ |
|
49070
d7859531621b
8198751: Refactor SetupNativeCompilation to take NAME and TYPE
ihse
parents:
48608
diff
changeset
|
177 |
NAME := jvm, \ |
41193
9e274c9c3047
8160630: libjimage.so and others should link statically to libgcc
erikj
parents:
40010
diff
changeset
|
178 |
TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ |
41277 | 179 |
OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \ |
37437 | 180 |
SRC := $(JVM_SRC_DIRS), \ |
181 |
EXCLUDES := $(JVM_EXCLUDES), \ |
|
182 |
EXCLUDE_FILES := $(JVM_EXCLUDE_FILES), \ |
|
183 |
EXCLUDE_PATTERNS := $(JVM_EXCLUDE_PATTERNS), \ |
|
184 |
EXTRA_OBJECT_FILES := $(DTRACE_EXTRA_OBJECT_FILES), \ |
|
185 |
CFLAGS := $(JVM_CFLAGS), \ |
|
186 |
vm_version.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \ |
|
48598
c7eea4b541d1
8189761: COMPANY_NAME, IMPLEMENTOR, BUNDLE_VENDOR, VENDOR, but no configure flag
simonis
parents:
48300
diff
changeset
|
187 |
arguments.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \ |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
50128
diff
changeset
|
188 |
DISABLED_WARNINGS_gcc := $(DISABLED_WARNINGS_gcc), \ |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
50128
diff
changeset
|
189 |
DISABLED_WARNINGS_clang := $(DISABLED_WARNINGS_clang), \ |
49678
fa26e7c6efb7
8199782: Fix compilation warnings detected by Solaris Developer Studio 12.6
gadams
parents:
49412
diff
changeset
|
190 |
DISABLED_WARNINGS_solstudio := $(DISABLED_WARNINGS_solstudio), \ |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
50128
diff
changeset
|
191 |
DISABLED_WARNINGS_xlc := $(DISABLED_WARNINGS_xlc), \ |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
50128
diff
changeset
|
192 |
DISABLED_WARNINGS_microsoft := $(DISABLED_WARNINGS_microsoft), \ |
37437 | 193 |
ASFLAGS := $(JVM_ASFLAGS), \ |
194 |
LDFLAGS := $(JVM_LDFLAGS), \ |
|
195 |
LIBS := $(JVM_LIBS), \ |
|
196 |
OPTIMIZATION := $(JVM_OPTIMIZATION), \ |
|
197 |
OBJECT_DIR := $(JVM_OUTPUTDIR)/objs, \ |
|
198 |
MAPFILE := $(JVM_MAPFILE), \ |
|
199 |
USE_MAPFILE_FOR_SYMBOLS := true, \ |
|
41674
8ff2f216109b
8164120: The minimal VM should be stripped using --strip-unneeded
erikj
parents:
40010
diff
changeset
|
200 |
STRIPFLAGS := $(JVM_STRIPFLAGS), \ |
37437 | 201 |
EMBED_MANIFEST := true, \ |
202 |
RC_FLAGS := $(JVM_RCFLAGS), \ |
|
47217 | 203 |
VERSIONINFO_RESOURCE := $(TOPDIR)/src/hotspot/os/windows/version.rc, \ |
37437 | 204 |
PRECOMPILED_HEADER := $(JVM_PRECOMPILED_HEADER), \ |
205 |
PRECOMPILED_HEADER_EXCLUDE := $(JVM_PRECOMPILED_HEADER_EXCLUDE), \ |
|
54490
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
54380
diff
changeset
|
206 |
DEFINE_THIS_FILE := false, \ |
37437 | 207 |
)) |
208 |
||
50128
ea4e6d3dbf60
8202738: vm_version Abstract_VM_Version::internal_vm_info_string() returns same string for different incremental builds
erikj
parents:
49681
diff
changeset
|
209 |
# Always recompile vm_version.cpp if libjvm needs to be relinked. This ensures |
ea4e6d3dbf60
8202738: vm_version Abstract_VM_Version::internal_vm_info_string() returns same string for different incremental builds
erikj
parents:
49681
diff
changeset
|
210 |
# that the internal vm version is updated as it relies on __DATE__ and __TIME__ |
ea4e6d3dbf60
8202738: vm_version Abstract_VM_Version::internal_vm_info_string() returns same string for different incremental builds
erikj
parents:
49681
diff
changeset
|
211 |
# macros. |
ea4e6d3dbf60
8202738: vm_version Abstract_VM_Version::internal_vm_info_string() returns same string for different incremental builds
erikj
parents:
49681
diff
changeset
|
212 |
VM_VERSION_OBJ := $(JVM_OUTPUTDIR)/objs/vm_version$(OBJ_SUFFIX) |
ea4e6d3dbf60
8202738: vm_version Abstract_VM_Version::internal_vm_info_string() returns same string for different incremental builds
erikj
parents:
49681
diff
changeset
|
213 |
$(VM_VERSION_OBJ): $(filter-out $(VM_VERSION_OBJ) $(JVM_MAPFILE), \ |
ea4e6d3dbf60
8202738: vm_version Abstract_VM_Version::internal_vm_info_string() returns same string for different incremental builds
erikj
parents:
49681
diff
changeset
|
214 |
$(BUILD_LIBJVM_TARGET_DEPS)) |
ea4e6d3dbf60
8202738: vm_version Abstract_VM_Version::internal_vm_info_string() returns same string for different incremental builds
erikj
parents:
49681
diff
changeset
|
215 |
|
52022
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
216 |
ifneq ($(GENERATE_COMPILE_COMMANDS_ONLY), true) |
53683 | 217 |
ifeq ($(call isTargetOs, windows), true) |
52022
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
218 |
# It doesn't matter which jvm.lib file gets exported, but we need |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
219 |
# to pick just one. |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
220 |
ifeq ($(JVM_VARIANT), $(JVM_VARIANT_MAIN)) |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
221 |
$(eval $(call SetupCopyFiles, COPY_JVM_LIB, \ |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
222 |
DEST := $(LIB_OUTPUTDIR), \ |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
223 |
FILES :=$(BUILD_LIBJVM_IMPORT_LIBRARY), \ |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
224 |
)) |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
225 |
TARGETS += $(COPY_JVM_LIB) |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
226 |
endif |
41277 | 227 |
endif |
228 |
endif |
|
229 |
||
37437 | 230 |
# AIX warning explanation: |
231 |
# 1500-010 : (W) WARNING in ...: Infinite loop. Program may not stop. |
|
232 |
# There are several infinite loops in the vm, so better suppress. |
|
233 |
# 1540-0198 : (W) The omitted keyword "private" is assumed for base class "...". |
|
234 |
# 1540-0216 : (W) An expression of type .. cannot be converted to type .. |
|
235 |
# In hotspot this fires for functionpointer to pointer conversions |
|
236 |
# 1540-1088 : (W) The exception specification is being ignored. |
|
237 |
# In hotspot this is caused by throw() in declaration of new() in nmethod.hpp. |
|
238 |
# 1540-1090 : (I) The destructor of "..." might not be called. |
|
239 |
# 1540-1639 : (I) The behavior of long type bit fields has changed ... |
|
240 |
||
241 |
# Include mapfile generation. It relies on BUILD_LIBJVM_ALL_OBJS which is only |
|
242 |
# defined after the above call to BUILD_LIBJVM. Mapfile will be generated |
|
243 |
# after all object files are built, but before the jvm library is linked. |
|
244 |
include lib/JvmMapfile.gmk |
|
245 |
||
246 |
TARGETS += $(BUILD_LIBJVM) |
|
49357
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
247 |
|
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
248 |
################################################################################ |
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
249 |
# Hotspot disallows the use of global operators 'new' and 'delete'. This build |
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
250 |
# time check helps enforce this requirement. If you trigger this check and the |
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
251 |
# reference is not obvious from the source, GNU objdump can be used to help find |
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
252 |
# the reference if compiled with GCC: |
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
253 |
# |
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
254 |
# objdump -lrdSC <path/to/file.o> |
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
255 |
# |
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
256 |
# -C demangle |
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
257 |
# -d disassemble |
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
258 |
# -r print relocation entries, interspersed with the disassembly |
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
259 |
# -S print source code, intermixed with disassembly |
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
260 |
# -l include filenames and line numbers |
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
261 |
# |
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
262 |
# Search the output for the operator(s) of interest, to see where they are |
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
263 |
# referenced. |
55738
aeb124322000
8227652: SetupOperatorNewDeleteCheck should discuss deleting destructors
kbarrett
parents:
54490
diff
changeset
|
264 |
# |
aeb124322000
8227652: SetupOperatorNewDeleteCheck should discuss deleting destructors
kbarrett
parents:
54490
diff
changeset
|
265 |
# When a reference to the global 'operator delete' is reported, it might be |
aeb124322000
8227652: SetupOperatorNewDeleteCheck should discuss deleting destructors
kbarrett
parents:
54490
diff
changeset
|
266 |
# due to a "deleting destructor". In this case, objdump may show the |
aeb124322000
8227652: SetupOperatorNewDeleteCheck should discuss deleting destructors
kbarrett
parents:
54490
diff
changeset
|
267 |
# reference to be associated with but not actually in a destructor. A |
aeb124322000
8227652: SetupOperatorNewDeleteCheck should discuss deleting destructors
kbarrett
parents:
54490
diff
changeset
|
268 |
# deleting destructor is automatically generated for a class whose destructor |
aeb124322000
8227652: SetupOperatorNewDeleteCheck should discuss deleting destructors
kbarrett
parents:
54490
diff
changeset
|
269 |
# is virtual. A deleting destructor requires an accessible 'operator delete' |
aeb124322000
8227652: SetupOperatorNewDeleteCheck should discuss deleting destructors
kbarrett
parents:
54490
diff
changeset
|
270 |
# for the associated class. If the class doesn't provide a more specific |
aeb124322000
8227652: SetupOperatorNewDeleteCheck should discuss deleting destructors
kbarrett
parents:
54490
diff
changeset
|
271 |
# declaration (either directly or by inheriting from a class that provides |
aeb124322000
8227652: SetupOperatorNewDeleteCheck should discuss deleting destructors
kbarrett
parents:
54490
diff
changeset
|
272 |
# one) then the global definition will be used, triggering this check. |
49357
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
273 |
|
52022
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
274 |
ifneq ($(GENERATE_COMPILE_COMMANDS_ONLY), true) |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
275 |
ifneq ($(filter $(TOOLCHAIN_TYPE), gcc clang solstudio), ) |
49357
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
276 |
|
52022
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
277 |
DEMANGLED_REGEXP := [^:]operator (new|delete) |
49357
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
278 |
|
52022
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
279 |
# Running c++filt to find offending symbols in all files is too expensive, |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
280 |
# especially on Solaris, so use mangled names when looking for symbols. |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
281 |
# Save the demangling for when something is actually found. |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
282 |
ifeq ($(TOOLCHAIN_TYPE), solstudio) |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
283 |
MANGLED_SYMS := \ |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
284 |
__1c2n6FL_pv_ \ |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
285 |
__1c2N6FL_pv_ \ |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
286 |
__1c2k6Fpv_v_ \ |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
287 |
__1c2K6Fpv_v_ \ |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
288 |
# |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
289 |
UNDEF_PATTERN := UNDEF |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
290 |
else |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
291 |
MANGLED_SYMS := \ |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
292 |
_ZdaPv \ |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
293 |
_ZdlPv \ |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
294 |
_Znam \ |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
295 |
_Znwm \ |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
296 |
# |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
297 |
UNDEF_PATTERN := ' U ' |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
298 |
endif |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
299 |
|
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
300 |
define SetupOperatorNewDeleteCheck |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
301 |
$1.op_check: $1 |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
302 |
if [ -n "`$(NM) $$< | $(GREP) $(addprefix -e , $(MANGLED_SYMS)) \ |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
303 |
| $(GREP) $(UNDEF_PATTERN)`" ]; then \ |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
304 |
$(ECHO) "$$<: Error: Use of global operators new and delete is not allowed in Hotspot:"; \ |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
305 |
$(NM) $$< | $(CXXFILT) | $(EGREP) '$(DEMANGLED_REGEXP)' | $(GREP) $(UNDEF_PATTERN); \ |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
306 |
$(ECHO) "See: $(TOPDIR)/make/hotspot/lib/CompileJvm.gmk"; \ |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
307 |
exit 1; \ |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
308 |
fi |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
309 |
$(TOUCH) $$@ |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
310 |
|
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
311 |
TARGETS += $1.op_check |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
312 |
endef |
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
313 |
|
804792ce736f
8210459: Add support for generating compile_commands.json
rwestberg
parents:
51853
diff
changeset
|
314 |
$(foreach o, $(BUILD_LIBJVM_ALL_OBJS), $(eval $(call SetupOperatorNewDeleteCheck,$o))) |
49357
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
315 |
endif |
aaedb8343784
8198243: Add build time check for global operator new/delete in object files
erikj
parents:
49070
diff
changeset
|
316 |
endif |