author | duke |
Wed, 05 Jul 2017 22:53:30 +0200 | |
changeset 43880 | b5015f742ba6 |
parent 43402 | caa829a4272a |
child 44411 | 8c642d0b237e |
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 |
# Include support files that will setup compiler flags due to the selected |
|
27 |
# jvm feature set, and specific file overrides. |
|
28 |
include lib/JvmFeatures.gmk |
|
29 |
include lib/JvmOverrideFiles.gmk |
|
30 |
||
31 |
$(eval $(call IncludeCustomExtension, hotspot, lib/CompileJvm.gmk)) |
|
32 |
||
33 |
################################################################################ |
|
34 |
# Setup compilation of the main Hotspot native library (libjvm). |
|
35 |
||
36 |
JVM_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/libjvm |
|
37 |
JVM_MAPFILE := $(JVM_OUTPUTDIR)/mapfile |
|
38 |
||
39 |
################################################################################ |
|
40 |
# Platform independent setup |
|
41 |
||
42 |
# This variable may be added to by a custom extension |
|
43 |
JVM_SRC_ROOTS += $(HOTSPOT_TOPDIR)/src |
|
44 |
||
45 |
JVM_SRC_DIRS += $(call uniq, $(wildcard $(foreach d, $(JVM_SRC_ROOTS), \ |
|
46 |
$d/share/vm \ |
|
47 |
$d/os/$(HOTSPOT_TARGET_OS)/vm \ |
|
48 |
$d/os/$(HOTSPOT_TARGET_OS_TYPE)/vm \ |
|
49 |
$d/cpu/$(HOTSPOT_TARGET_CPU_ARCH)/vm \ |
|
50 |
$d/os_cpu/$(HOTSPOT_TARGET_OS)_$(HOTSPOT_TARGET_CPU_ARCH)/vm \ |
|
51 |
))) \ |
|
52 |
$(JVM_VARIANT_OUTPUTDIR)/gensrc/jvmtifiles \ |
|
53 |
$(JVM_VARIANT_OUTPUTDIR)/gensrc/tracefiles \ |
|
54 |
# |
|
55 |
||
56 |
JVM_CFLAGS_INCLUDES += \ |
|
57 |
$(patsubst %,-I%,$(filter-out $(JVM_VARIANT_OUTPUTDIR)/gensrc/%, $(JVM_SRC_DIRS))) \ |
|
58 |
-I$(JVM_VARIANT_OUTPUTDIR)/gensrc \ |
|
59 |
-I$(HOTSPOT_TOPDIR)/src/share/vm/precompiled \ |
|
60 |
-I$(HOTSPOT_TOPDIR)/src/share/vm/prims \ |
|
61 |
# |
|
62 |
||
40010 | 63 |
# INCLUDE_SUFFIX_* is only meant for including the proper |
64 |
# platform files. Don't use it to guard code. Use the value of |
|
65 |
# HOTSPOT_TARGET_CPU_DEFINE etc. instead. |
|
43402
caa829a4272a
8004842: Unify values of boolean make variables set in configure to true/false
ihse
parents:
42664
diff
changeset
|
66 |
# Remaining TARGET_ARCH_* is needed to select the cpu specific |
42664 | 67 |
# sources for 64-bit ARM ports (arm versus aarch64). |
37437 | 68 |
JVM_CFLAGS_TARGET_DEFINES += \ |
69 |
-DTARGET_ARCH_$(HOTSPOT_TARGET_CPU_ARCH) \ |
|
40010 | 70 |
-DINCLUDE_SUFFIX_OS=_$(HOTSPOT_TARGET_OS) \ |
71 |
-DINCLUDE_SUFFIX_CPU=_$(HOTSPOT_TARGET_CPU_ARCH) \ |
|
37437 | 72 |
-DTARGET_COMPILER_$(HOTSPOT_TOOLCHAIN_TYPE) \ |
73 |
-D$(HOTSPOT_TARGET_CPU_DEFINE) \ |
|
74 |
-DHOTSPOT_LIB_ARCH='"$(OPENJDK_TARGET_CPU_LEGACY_LIB)"' \ |
|
75 |
# |
|
76 |
||
77 |
ifeq ($(DEBUG_LEVEL), release) |
|
78 |
# For hotspot, release builds differ internally between "optimized" and "product" |
|
79 |
# in that "optimize" does not define PRODUCT. |
|
80 |
ifneq ($(HOTSPOT_DEBUG_LEVEL), optimized) |
|
81 |
JVM_CFLAGS_DEBUGLEVEL := -DPRODUCT |
|
82 |
endif |
|
83 |
else ifeq ($(DEBUG_LEVEL), fastdebug) |
|
84 |
JVM_CFLAGS_DEBUGLEVEL := -DASSERT |
|
85 |
ifeq ($(filter $(OPENJDK_TARGET_OS), windows aix), ) |
|
86 |
# NOTE: Old build did not define CHECK_UNHANDLED_OOPS on Windows and AIX. |
|
87 |
JVM_CFLAGS_DEBUGLEVEL += -DCHECK_UNHANDLED_OOPS |
|
88 |
endif |
|
89 |
else ifeq ($(DEBUG_LEVEL), slowdebug) |
|
90 |
# _NMT_NOINLINE_ informs NMT that no inlining is done by the compiler |
|
91 |
JVM_CFLAGS_DEBUGLEVEL := -DASSERT -D_NMT_NOINLINE_ |
|
92 |
endif |
|
93 |
||
94 |
JVM_CFLAGS += \ |
|
95 |
$(JVM_CFLAGS_DEBUGLEVEL) \ |
|
96 |
$(JVM_CFLAGS_TARGET_DEFINES) \ |
|
97 |
$(JVM_CFLAGS_FEATURES) \ |
|
98 |
$(JVM_CFLAGS_INCLUDES) \ |
|
99 |
$(EXTRA_CFLAGS) \ |
|
100 |
# |
|
101 |
||
102 |
JVM_LDFLAGS += \ |
|
103 |
$(SHARED_LIBRARY_FLAGS) \ |
|
104 |
$(JVM_LDFLAGS_FEATURES) \ |
|
105 |
$(EXTRA_LDFLAGS) \ |
|
106 |
# |
|
107 |
||
108 |
JVM_LIBS += \ |
|
109 |
$(JVM_LIBS_FEATURES) \ |
|
110 |
# |
|
111 |
||
112 |
# These files and directories are always excluded |
|
113 |
JVM_EXCLUDE_FILES += jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp args.cc |
|
114 |
JVM_EXCLUDES += adlc |
|
115 |
||
116 |
# Needed by vm_version.cpp |
|
117 |
ifeq ($(OPENJDK_TARGET_CPU), x86_64) |
|
118 |
OPENJDK_TARGET_CPU_VM_VERSION := amd64 |
|
119 |
else ifeq ($(OPENJDK_TARGET_CPU), sparcv9) |
|
120 |
OPENJDK_TARGET_CPU_VM_VERSION := sparc |
|
121 |
else |
|
122 |
OPENJDK_TARGET_CPU_VM_VERSION := $(OPENJDK_TARGET_CPU) |
|
123 |
endif |
|
124 |
||
125 |
CFLAGS_VM_VERSION := \ |
|
126 |
$(VERSION_CFLAGS) \ |
|
127 |
-DHOTSPOT_VERSION_STRING='"$(VERSION_STRING)"' \ |
|
128 |
-DDEBUG_LEVEL='"$(DEBUG_LEVEL)"' \ |
|
129 |
-DHOTSPOT_BUILD_USER='"$(USERNAME)"' \ |
|
130 |
-DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \ |
|
131 |
-DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \ |
|
132 |
# |
|
133 |
||
134 |
# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp. |
|
43402
caa829a4272a
8004842: Unify values of boolean make variables set in configure to true/false
ihse
parents:
42664
diff
changeset
|
135 |
ifeq ($(USE_PRECOMPILED_HEADER), false) |
37437 | 136 |
JVM_CFLAGS += -DDONT_USE_PRECOMPILED_HEADER |
137 |
endif |
|
138 |
||
139 |
################################################################################ |
|
140 |
# Platform specific setup |
|
141 |
||
42664 | 142 |
# ARM source selection |
143 |
||
144 |
ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), linux-arm) |
|
145 |
JVM_EXCLUDE_PATTERNS += arm_64 |
|
146 |
||
147 |
else ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), linux-aarch64) |
|
43402
caa829a4272a
8004842: Unify values of boolean make variables set in configure to true/false
ihse
parents:
42664
diff
changeset
|
148 |
# For 64-bit arm builds, we use the 64 bit hotspot/src/cpu/arm |
42664 | 149 |
# hotspot sources if HOTSPOT_TARGET_CPU_ARCH is set to arm. |
150 |
# Exclude the aarch64 and 32 bit arm files for this build. |
|
151 |
ifeq ($(HOTSPOT_TARGET_CPU_ARCH), arm) |
|
152 |
JVM_EXCLUDE_PATTERNS += arm_32 aarch64 |
|
153 |
endif |
|
154 |
endif |
|
155 |
||
37437 | 156 |
ifneq ($(filter $(OPENJDK_TARGET_OS), linux macosx windows), ) |
157 |
JVM_PRECOMPILED_HEADER := $(HOTSPOT_TOPDIR)/src/share/vm/precompiled/precompiled.hpp |
|
158 |
endif |
|
159 |
||
160 |
ifeq ($(OPENJDK_TARGET_CPU), x86) |
|
161 |
JVM_EXCLUDE_PATTERNS += x86_64 |
|
162 |
else ifeq ($(OPENJDK_TARGET_CPU), x86_64) |
|
163 |
JVM_EXCLUDE_PATTERNS += x86_32 |
|
164 |
endif |
|
165 |
||
166 |
# Inline assembly for solaris |
|
167 |
ifeq ($(OPENJDK_TARGET_OS), solaris) |
|
168 |
ifeq ($(OPENJDK_TARGET_CPU), x86_64) |
|
169 |
JVM_CFLAGS += $(HOTSPOT_TOPDIR)/src/os_cpu/solaris_x86/vm/solaris_x86_64.il |
|
170 |
else ifeq ($(OPENJDK_TARGET_CPU), sparcv9) |
|
171 |
JVM_CFLAGS += $(HOTSPOT_TOPDIR)/src/os_cpu/solaris_sparc/vm/solaris_sparc.il |
|
172 |
endif |
|
173 |
endif |
|
174 |
||
175 |
ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), solaris-sparcv9) |
|
176 |
ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), false) |
|
177 |
# NOTE: In the old build, we weirdly enough set -g/-g0 always, regardless |
|
178 |
# of if debug symbols were needed. Without it, compilation fails on |
|
179 |
# sparc! :-( |
|
180 |
JVM_CFLAGS += -g0 |
|
181 |
endif |
|
182 |
endif |
|
183 |
||
184 |
ifeq ($(OPENJDK_TARGET_OS), windows) |
|
185 |
ifeq ($(OPENJDK_TARGET_CPU_BITS), 64) |
|
186 |
RC_DESC := 64-Bit$(SPACE) |
|
187 |
endif |
|
188 |
JVM_RCFLAGS += -D"HS_FILEDESC=$(HOTSPOT_VM_DISTRO) $(RC_DESC)$(JVM_VARIANT) VM" |
|
189 |
endif |
|
190 |
||
191 |
JVM_OPTIMIZATION ?= HIGHEST_JVM |
|
192 |
||
41674
8ff2f216109b
8164120: The minimal VM should be stripped using --strip-unneeded
erikj
parents:
40010
diff
changeset
|
193 |
# 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
|
194 |
# 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
|
195 |
# default. |
8ff2f216109b
8164120: The minimal VM should be stripped using --strip-unneeded
erikj
parents:
40010
diff
changeset
|
196 |
JVM_STRIPFLAGS ?= $(STRIPFLAGS) |
8ff2f216109b
8164120: The minimal VM should be stripped using --strip-unneeded
erikj
parents:
40010
diff
changeset
|
197 |
|
37437 | 198 |
################################################################################ |
199 |
# Now set up the actual compilation of the main hotspot native library |
|
200 |
||
201 |
$(eval $(call SetupNativeCompilation, BUILD_LIBJVM, \ |
|
41193
9e274c9c3047
8160630: libjimage.so and others should link statically to libgcc
erikj
parents:
40010
diff
changeset
|
202 |
TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ |
37437 | 203 |
LIBRARY := jvm, \ |
41277 | 204 |
OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \ |
37437 | 205 |
SRC := $(JVM_SRC_DIRS), \ |
206 |
EXCLUDES := $(JVM_EXCLUDES), \ |
|
207 |
EXCLUDE_FILES := $(JVM_EXCLUDE_FILES), \ |
|
208 |
EXCLUDE_PATTERNS := $(JVM_EXCLUDE_PATTERNS), \ |
|
209 |
EXTRA_OBJECT_FILES := $(DTRACE_EXTRA_OBJECT_FILES), \ |
|
210 |
CFLAGS := $(JVM_CFLAGS), \ |
|
211 |
CFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \ |
|
212 |
CXXFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \ |
|
213 |
vm_version.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \ |
|
214 |
DISABLED_WARNINGS_clang := delete-non-virtual-dtor dynamic-class-memaccess \ |
|
215 |
empty-body format logical-op-parentheses parentheses \ |
|
216 |
parentheses-equality switch tautological-compare, \ |
|
217 |
DISABLED_WARNINGS_xlc := 1540-0216 1540-0198 1540-1090 1540-1639 \ |
|
218 |
1540-1088 1500-010, \ |
|
219 |
ASFLAGS := $(JVM_ASFLAGS), \ |
|
220 |
LDFLAGS := $(JVM_LDFLAGS), \ |
|
221 |
LIBS := $(JVM_LIBS), \ |
|
222 |
OPTIMIZATION := $(JVM_OPTIMIZATION), \ |
|
223 |
OBJECT_DIR := $(JVM_OUTPUTDIR)/objs, \ |
|
224 |
MAPFILE := $(JVM_MAPFILE), \ |
|
225 |
USE_MAPFILE_FOR_SYMBOLS := true, \ |
|
41674
8ff2f216109b
8164120: The minimal VM should be stripped using --strip-unneeded
erikj
parents:
40010
diff
changeset
|
226 |
STRIPFLAGS := $(JVM_STRIPFLAGS), \ |
37437 | 227 |
EMBED_MANIFEST := true, \ |
228 |
RC_FLAGS := $(JVM_RCFLAGS), \ |
|
229 |
VERSIONINFO_RESOURCE := $(HOTSPOT_TOPDIR)/src/os/windows/vm/version.rc, \ |
|
230 |
PRECOMPILED_HEADER := $(JVM_PRECOMPILED_HEADER), \ |
|
231 |
PRECOMPILED_HEADER_EXCLUDE := $(JVM_PRECOMPILED_HEADER_EXCLUDE), \ |
|
232 |
)) |
|
233 |
||
41277 | 234 |
ifeq ($(OPENJDK_TARGET_OS), windows) |
235 |
# It doesn't matter which jvm.lib file gets exported, but we need |
|
236 |
# to pick just one. |
|
237 |
ifeq ($(JVM_VARIANT), $(firstword $(JVM_VARIANTS))) |
|
238 |
$(eval $(call SetupCopyFiles, COPY_JVM_LIB, \ |
|
239 |
DEST := $(LIB_OUTPUTDIR), \ |
|
240 |
FILES :=$(JVM_VARIANT_OUTPUTDIR)/libjvm/objs/jvm.lib, \ |
|
241 |
)) |
|
242 |
TARGETS += $(COPY_JVM_LIB) |
|
243 |
endif |
|
244 |
endif |
|
245 |
||
37437 | 246 |
# AIX warning explanation: |
247 |
# 1500-010 : (W) WARNING in ...: Infinite loop. Program may not stop. |
|
248 |
# There are several infinite loops in the vm, so better suppress. |
|
249 |
# 1540-0198 : (W) The omitted keyword "private" is assumed for base class "...". |
|
250 |
# 1540-0216 : (W) An expression of type .. cannot be converted to type .. |
|
251 |
# In hotspot this fires for functionpointer to pointer conversions |
|
252 |
# 1540-1088 : (W) The exception specification is being ignored. |
|
253 |
# In hotspot this is caused by throw() in declaration of new() in nmethod.hpp. |
|
254 |
# 1540-1090 : (I) The destructor of "..." might not be called. |
|
255 |
# 1540-1639 : (I) The behavior of long type bit fields has changed ... |
|
256 |
||
257 |
# Include mapfile generation. It relies on BUILD_LIBJVM_ALL_OBJS which is only |
|
258 |
# defined after the above call to BUILD_LIBJVM. Mapfile will be generated |
|
259 |
# after all object files are built, but before the jvm library is linked. |
|
260 |
include lib/JvmMapfile.gmk |
|
261 |
||
262 |
TARGETS += $(BUILD_LIBJVM) |