45 $(SHARED_LIBRARY_FLAGS) \ |
45 $(SHARED_LIBRARY_FLAGS) \ |
46 $(JVM_LDFLAGS_FEATURES) \ |
46 $(JVM_LDFLAGS_FEATURES) \ |
47 $(EXTRA_LDFLAGS) \ |
47 $(EXTRA_LDFLAGS) \ |
48 # |
48 # |
49 |
49 |
|
50 JVM_ASFLAGS += $(EXTRA_ASFLAGS) |
|
51 |
50 JVM_LIBS += \ |
52 JVM_LIBS += \ |
51 $(JVM_LIBS_FEATURES) \ |
53 $(JVM_LIBS_FEATURES) \ |
52 # |
54 # |
53 |
55 |
54 # These files and directories are always excluded |
56 # These files and directories are always excluded |
55 JVM_EXCLUDE_FILES += args.cc |
57 JVM_EXCLUDE_FILES += args.cc |
56 JVM_EXCLUDES += adlc |
58 JVM_EXCLUDES += adlc |
57 |
59 |
58 # Needed by vm_version.cpp |
60 # Needed by vm_version.cpp |
59 ifeq ($(OPENJDK_TARGET_CPU), x86_64) |
61 ifeq ($(call isTargetCpu, x86_64), true) |
60 OPENJDK_TARGET_CPU_VM_VERSION := amd64 |
62 OPENJDK_TARGET_CPU_VM_VERSION := amd64 |
61 else ifeq ($(OPENJDK_TARGET_CPU), sparcv9) |
63 else ifeq ($(call isTargetCpu, sparcv9), true) |
62 OPENJDK_TARGET_CPU_VM_VERSION := sparc |
64 OPENJDK_TARGET_CPU_VM_VERSION := sparc |
63 else ifeq ($(HOTSPOT_TARGET_CPU_ARCH), arm) |
|
64 ifeq ($(OPENJDK_TARGET_CPU), aarch64) |
|
65 # This sets the Oracle Aarch64 port to use arm64 |
|
66 # while the original Aarch64 port uses aarch64 |
|
67 OPENJDK_TARGET_CPU_VM_VERSION := arm64 |
|
68 endif |
|
69 else |
65 else |
70 OPENJDK_TARGET_CPU_VM_VERSION := $(OPENJDK_TARGET_CPU) |
66 OPENJDK_TARGET_CPU_VM_VERSION := $(OPENJDK_TARGET_CPU) |
71 endif |
67 endif |
72 |
68 |
73 CFLAGS_VM_VERSION := \ |
69 CFLAGS_VM_VERSION := \ |
78 -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \ |
74 -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \ |
79 -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \ |
75 -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \ |
80 # |
76 # |
81 |
77 |
82 ################################################################################ |
78 ################################################################################ |
|
79 # Disabled warnings |
|
80 |
|
81 DISABLED_WARNINGS_gcc := extra parentheses comment unknown-pragmas address \ |
|
82 delete-non-virtual-dtor char-subscripts array-bounds int-in-bool-context \ |
|
83 ignored-qualifiers missing-field-initializers implicit-fallthrough \ |
|
84 empty-body strict-overflow sequence-point maybe-uninitialized \ |
|
85 misleading-indentation |
|
86 |
|
87 ifeq ($(call check-jvm-feature, zero), true) |
|
88 DISABLED_WARNINGS_gcc += return-type switch |
|
89 endif |
|
90 |
|
91 DISABLED_WARNINGS_clang := tautological-compare \ |
|
92 undefined-var-template sometimes-uninitialized unknown-pragmas \ |
|
93 delete-non-virtual-dtor missing-braces char-subscripts \ |
|
94 ignored-qualifiers missing-field-initializers mismatched-tags |
|
95 |
|
96 DISABLED_WARNINGS_solstudio := labelnotused hidef w_novirtualdescr inlafteruse \ |
|
97 unknownpragma doubunder w_enumnotused w_toomanyenumnotused \ |
|
98 wvarhidenmem wunreachable wnoretvalue notemsource |
|
99 |
|
100 DISABLED_WARNINGS_xlc := tautological-compare shift-negative-value |
|
101 |
|
102 DISABLED_WARNINGS_microsoft := |
|
103 |
|
104 |
|
105 |
|
106 ################################################################################ |
83 # Platform specific setup |
107 # Platform specific setup |
84 |
108 |
85 # ARM source selection |
109 # ARM source selection |
86 |
110 |
87 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), linux-arm) |
111 ifeq ($(call And, $(call isTargetOs, linux) $(call isTargetCpu, arm)), true) |
88 JVM_EXCLUDE_PATTERNS += arm_64 |
112 JVM_EXCLUDE_PATTERNS += arm_64 |
89 |
113 |
90 else ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), linux-aarch64) |
114 else ifeq ($(call And, $(call isTargetOs, linux) $(call isTargetCpu, aarch64)), true) |
91 # For 64-bit arm builds, we use the 64 bit hotspot/src/cpu/arm |
115 # For 64-bit arm builds, we use the 64 bit hotspot/src/cpu/arm |
92 # hotspot sources if HOTSPOT_TARGET_CPU_ARCH is set to arm. |
116 # hotspot sources if HOTSPOT_TARGET_CPU_ARCH is set to arm. |
93 # Exclude the aarch64 and 32 bit arm files for this build. |
117 # Exclude the aarch64 and 32 bit arm files for this build. |
94 ifeq ($(HOTSPOT_TARGET_CPU_ARCH), arm) |
118 ifeq ($(HOTSPOT_TARGET_CPU_ARCH), arm) |
95 JVM_EXCLUDE_PATTERNS += arm_32 aarch64 |
119 JVM_EXCLUDE_PATTERNS += arm_32 aarch64 |
96 endif |
120 endif |
97 endif |
121 endif |
98 |
122 |
99 ifneq ($(filter $(OPENJDK_TARGET_OS), linux macosx windows), ) |
123 ifeq ($(call isTargetOs, linux macosx windows), true) |
100 JVM_PRECOMPILED_HEADER := $(TOPDIR)/src/hotspot/share/precompiled/precompiled.hpp |
124 JVM_PRECOMPILED_HEADER := $(TOPDIR)/src/hotspot/share/precompiled/precompiled.hpp |
101 endif |
125 endif |
102 |
126 |
103 ifeq ($(OPENJDK_TARGET_CPU), x86) |
127 ifeq ($(call isTargetCpu, x86), true) |
104 JVM_EXCLUDE_PATTERNS += x86_64 |
128 JVM_EXCLUDE_PATTERNS += x86_64 |
105 else ifeq ($(OPENJDK_TARGET_CPU), x86_64) |
129 else ifeq ($(call isTargetCpu, x86_64), true) |
106 JVM_EXCLUDE_PATTERNS += x86_32 |
130 JVM_EXCLUDE_PATTERNS += x86_32 |
107 endif |
131 endif |
108 |
132 |
109 ifneq ($(DEBUG_LEVEL), release) |
133 ifneq ($(DEBUG_LEVEL), release) |
110 DISABLED_WARNINGS_gcc += extra |
134 DISABLED_WARNINGS_gcc += extra |
111 endif |
135 endif |
112 |
136 |
113 # Inline assembly for solaris |
137 # Inline assembly for solaris |
114 ifeq ($(OPENJDK_TARGET_OS), solaris) |
138 ifeq ($(call isTargetOs, solaris), true) |
115 ifeq ($(OPENJDK_TARGET_CPU), x86_64) |
139 ifeq ($(call isTargetCpu, x86_64), true) |
116 JVM_CFLAGS += $(TOPDIR)/src/hotspot/os_cpu/solaris_x86/solaris_x86_64.il |
140 JVM_CFLAGS += $(TOPDIR)/src/hotspot/os_cpu/solaris_x86/solaris_x86_64.il |
117 else ifeq ($(OPENJDK_TARGET_CPU), sparcv9) |
141 else ifeq ($(call isTargetCpu, sparcv9), true) |
118 JVM_CFLAGS += $(TOPDIR)/src/hotspot/os_cpu/solaris_sparc/solaris_sparc.il |
142 JVM_CFLAGS += $(TOPDIR)/src/hotspot/os_cpu/solaris_sparc/solaris_sparc.il |
119 endif |
143 endif |
120 # Exclude warnings in devstudio 12.6 |
144 # Exclude warnings in devstudio 12.6 |
121 ifeq ($(CC_VERSION_NUMBER), 5.15) |
145 ifeq ($(CC_VERSION_NUMBER), 5.15) |
122 DISABLED_WARNINGS_solstudio := SEC_ARR_OUTSIDE_BOUND_READ \ |
146 DISABLED_WARNINGS_solstudio += SEC_ARR_OUTSIDE_BOUND_READ \ |
123 SEC_ARR_OUTSIDE_BOUND_WRITE |
147 SEC_ARR_OUTSIDE_BOUND_WRITE |
124 endif |
148 endif |
125 endif |
149 endif |
126 |
150 |
127 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), solaris-sparcv9) |
151 ifeq ($(call And, $(call isTargetOs, solaris) $(call isTargetCpu, sparcv9)), true) |
128 ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), false) |
152 ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), false) |
129 # NOTE: In the old build, we weirdly enough set -g/-g0 always, regardless |
153 # NOTE: In the old build, we weirdly enough set -g/-g0 always, regardless |
130 # of if debug symbols were needed. Without it, compilation fails on |
154 # of if debug symbols were needed. Without it, compilation fails on |
131 # sparc! :-( |
155 # sparc! :-( |
132 JVM_CFLAGS += -g0 |
156 JVM_CFLAGS += -g0 |
133 endif |
157 endif |
134 endif |
158 endif |
135 |
159 |
136 ifeq ($(OPENJDK_TARGET_OS), windows) |
160 ifeq ($(call isTargetOs, windows), true) |
137 ifeq ($(OPENJDK_TARGET_CPU_BITS), 64) |
161 ifeq ($(call isTargetCpuBits, 64), true) |
138 RC_DESC := 64-Bit$(SPACE) |
162 RC_DESC := 64-Bit$(SPACE) |
139 endif |
163 endif |
140 JVM_RCFLAGS += -D"HS_FILEDESC=$(HOTSPOT_VM_DISTRO) $(RC_DESC)$(JVM_VARIANT) VM" |
164 JVM_RCFLAGS += -D"HS_FILEDESC=$(HOTSPOT_VM_DISTRO) $(RC_DESC)$(JVM_VARIANT) VM" |
141 endif |
165 endif |
142 |
166 |
160 EXCLUDE_PATTERNS := $(JVM_EXCLUDE_PATTERNS), \ |
187 EXCLUDE_PATTERNS := $(JVM_EXCLUDE_PATTERNS), \ |
161 EXTRA_OBJECT_FILES := $(DTRACE_EXTRA_OBJECT_FILES), \ |
188 EXTRA_OBJECT_FILES := $(DTRACE_EXTRA_OBJECT_FILES), \ |
162 CFLAGS := $(JVM_CFLAGS), \ |
189 CFLAGS := $(JVM_CFLAGS), \ |
163 vm_version.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \ |
190 vm_version.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \ |
164 arguments.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \ |
191 arguments.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \ |
165 DISABLED_WARNINGS_gcc := suggest-attribute=format unknown-pragmas comment \ |
192 DISABLED_WARNINGS_gcc := $(DISABLED_WARNINGS_gcc) \ |
|
193 \ |
|
194 suggest-attribute=format unknown-pragmas comment \ |
166 delete-non-virtual-dtor ignored-qualifiers parentheses reorder \ |
195 delete-non-virtual-dtor ignored-qualifiers parentheses reorder \ |
167 unused-local-typedefs unused-variable address \ |
196 unused-local-typedefs unused-variable address \ |
168 missing-field-initializers unused-but-set-variable char-subscripts \ |
197 missing-field-initializers unused-but-set-variable char-subscripts \ |
169 array-bounds narrowing empty-body unused-but-set-parameter \ |
198 array-bounds narrowing empty-body unused-but-set-parameter \ |
170 maybe-uninitialized logical-op \ |
199 maybe-uninitialized logical-op \ |
171 implicit-fallthrough expansion-to-defined strict-overflow sequence-point \ |
200 implicit-fallthrough expansion-to-defined strict-overflow sequence-point, \ |
172 $(DISABLED_WARNINGS_gcc), \ |
201 DISABLED_WARNINGS_clang := $(DISABLED_WARNINGS_clang) \ |
173 DISABLED_WARNINGS_clang := tautological-compare, \ |
202 \ |
|
203 tautological-compare, \ |
174 DISABLED_WARNINGS_solstudio := $(DISABLED_WARNINGS_solstudio) \ |
204 DISABLED_WARNINGS_solstudio := $(DISABLED_WARNINGS_solstudio) \ |
|
205 \ |
175 labelnotused hidef w_novirtualdescr inlafteruse \ |
206 labelnotused hidef w_novirtualdescr inlafteruse \ |
176 unknownpragma doubunder w_enumnotused w_toomanyenumnotused \ |
207 unknownpragma doubunder w_enumnotused w_toomanyenumnotused \ |
177 wvarhidenmem wunreachable wnoretvalue, \ |
208 wvarhidenmem wunreachable wnoretvalue, \ |
178 DISABLED_WARNINGS_microsoft := 4459, \ |
209 DISABLED_WARNINGS_xlc := $(DISABLED_WARNINGS_xlc), \ |
179 DISABLED_WARNINGS_xlc := 1540-0216 1540-0198 1540-1090 1540-1639 \ |
210 DISABLED_WARNINGS_microsoft := $(DISABLED_WARNINGS_microsoft), \ |
180 1540-1088 1500-010, \ |
211 \ |
|
212 4459, \ |
181 ASFLAGS := $(JVM_ASFLAGS), \ |
213 ASFLAGS := $(JVM_ASFLAGS), \ |
182 LDFLAGS := $(JVM_LDFLAGS), \ |
214 LDFLAGS := $(JVM_LDFLAGS), \ |
183 LIBS := $(JVM_LIBS), \ |
215 LIBS := $(JVM_LIBS), \ |
184 OPTIMIZATION := $(JVM_OPTIMIZATION), \ |
216 OPTIMIZATION := $(JVM_OPTIMIZATION), \ |
185 OBJECT_DIR := $(JVM_OUTPUTDIR)/objs, \ |
217 OBJECT_DIR := $(JVM_OUTPUTDIR)/objs, \ |
189 EMBED_MANIFEST := true, \ |
221 EMBED_MANIFEST := true, \ |
190 RC_FLAGS := $(JVM_RCFLAGS), \ |
222 RC_FLAGS := $(JVM_RCFLAGS), \ |
191 VERSIONINFO_RESOURCE := $(TOPDIR)/src/hotspot/os/windows/version.rc, \ |
223 VERSIONINFO_RESOURCE := $(TOPDIR)/src/hotspot/os/windows/version.rc, \ |
192 PRECOMPILED_HEADER := $(JVM_PRECOMPILED_HEADER), \ |
224 PRECOMPILED_HEADER := $(JVM_PRECOMPILED_HEADER), \ |
193 PRECOMPILED_HEADER_EXCLUDE := $(JVM_PRECOMPILED_HEADER_EXCLUDE), \ |
225 PRECOMPILED_HEADER_EXCLUDE := $(JVM_PRECOMPILED_HEADER_EXCLUDE), \ |
|
226 DEFINE_THIS_FILE := false, \ |
194 )) |
227 )) |
195 |
228 |
196 # Always recompile vm_version.cpp if libjvm needs to be relinked. This ensures |
229 # Always recompile vm_version.cpp if libjvm needs to be relinked. This ensures |
197 # that the internal vm version is updated as it relies on __DATE__ and __TIME__ |
230 # that the internal vm version is updated as it relies on __DATE__ and __TIME__ |
198 # macros. |
231 # macros. |
199 VM_VERSION_OBJ := $(JVM_OUTPUTDIR)/objs/vm_version$(OBJ_SUFFIX) |
232 VM_VERSION_OBJ := $(JVM_OUTPUTDIR)/objs/vm_version$(OBJ_SUFFIX) |
200 $(VM_VERSION_OBJ): $(filter-out $(VM_VERSION_OBJ) $(JVM_MAPFILE), \ |
233 $(VM_VERSION_OBJ): $(filter-out $(VM_VERSION_OBJ) $(JVM_MAPFILE), \ |
201 $(BUILD_LIBJVM_TARGET_DEPS)) |
234 $(BUILD_LIBJVM_TARGET_DEPS)) |
202 |
235 |
203 ifeq ($(OPENJDK_TARGET_OS), windows) |
236 ifneq ($(GENERATE_COMPILE_COMMANDS_ONLY), true) |
204 # It doesn't matter which jvm.lib file gets exported, but we need |
237 ifeq ($(call isTargetOs, windows), true) |
205 # to pick just one. |
238 # It doesn't matter which jvm.lib file gets exported, but we need |
206 ifeq ($(JVM_VARIANT), $(JVM_VARIANT_MAIN)) |
239 # to pick just one. |
207 $(eval $(call SetupCopyFiles, COPY_JVM_LIB, \ |
240 ifeq ($(JVM_VARIANT), $(JVM_VARIANT_MAIN)) |
208 DEST := $(LIB_OUTPUTDIR), \ |
241 $(eval $(call SetupCopyFiles, COPY_JVM_LIB, \ |
209 FILES :=$(BUILD_LIBJVM_IMPORT_LIBRARY), \ |
242 DEST := $(LIB_OUTPUTDIR), \ |
210 )) |
243 FILES :=$(BUILD_LIBJVM_IMPORT_LIBRARY), \ |
211 TARGETS += $(COPY_JVM_LIB) |
244 )) |
|
245 TARGETS += $(COPY_JVM_LIB) |
|
246 endif |
212 endif |
247 endif |
213 endif |
248 endif |
214 |
249 |
215 # AIX warning explanation: |
250 # AIX warning explanation: |
216 # 1500-010 : (W) WARNING in ...: Infinite loop. Program may not stop. |
251 # 1500-010 : (W) WARNING in ...: Infinite loop. Program may not stop. |
244 # -S print source code, intermixed with disassembly |
279 # -S print source code, intermixed with disassembly |
245 # -l include filenames and line numbers |
280 # -l include filenames and line numbers |
246 # |
281 # |
247 # Search the output for the operator(s) of interest, to see where they are |
282 # Search the output for the operator(s) of interest, to see where they are |
248 # referenced. |
283 # referenced. |
249 |
284 # |
250 ifneq ($(filter $(TOOLCHAIN_TYPE), gcc clang solstudio), ) |
285 # When a reference to the global 'operator delete' is reported, it might be |
251 |
286 # due to a "deleting destructor". In this case, objdump may show the |
252 DEMANGLED_REGEXP := [^:]operator (new|delete) |
287 # reference to be associated with but not actually in a destructor. A |
253 |
288 # deleting destructor is automatically generated for a class whose destructor |
254 # Running c++filt to find offending symbols in all files is too expensive, |
289 # is virtual. A deleting destructor requires an accessible 'operator delete' |
255 # especially on Solaris, so use mangled names when looking for symbols. |
290 # for the associated class. If the class doesn't provide a more specific |
256 # Save the demangling for when something is actually found. |
291 # declaration (either directly or by inheriting from a class that provides |
257 ifeq ($(TOOLCHAIN_TYPE), solstudio) |
292 # one) then the global definition will be used, triggering this check. |
258 MANGLED_SYMS := \ |
293 |
259 __1c2n6FL_pv_ \ |
294 ifneq ($(GENERATE_COMPILE_COMMANDS_ONLY), true) |
260 __1c2N6FL_pv_ \ |
295 ifneq ($(filter $(TOOLCHAIN_TYPE), gcc clang solstudio), ) |
261 __1c2k6Fpv_v_ \ |
296 |
262 __1c2K6Fpv_v_ \ |
297 DEMANGLED_REGEXP := [^:]operator (new|delete) |
263 # |
298 |
264 UNDEF_PATTERN := UNDEF |
299 # Running c++filt to find offending symbols in all files is too expensive, |
265 else |
300 # especially on Solaris, so use mangled names when looking for symbols. |
266 MANGLED_SYMS := \ |
301 # Save the demangling for when something is actually found. |
267 _ZdaPv \ |
302 ifeq ($(TOOLCHAIN_TYPE), solstudio) |
268 _ZdlPv \ |
303 MANGLED_SYMS := \ |
269 _Znam \ |
304 __1c2n6FL_pv_ \ |
270 _Znwm \ |
305 __1c2N6FL_pv_ \ |
271 # |
306 __1c2k6Fpv_v_ \ |
272 UNDEF_PATTERN := ' U ' |
307 __1c2K6Fpv_v_ \ |
273 endif |
308 # |
274 |
309 UNDEF_PATTERN := UNDEF |
275 define SetupOperatorNewDeleteCheck |
310 else |
276 $1.op_check: $1 |
311 MANGLED_SYMS := \ |
277 if [ -n "`$(NM) $$< | $(GREP) $(addprefix -e , $(MANGLED_SYMS)) \ |
312 _ZdaPv \ |
278 | $(GREP) $(UNDEF_PATTERN)`" ]; then \ |
313 _ZdlPv \ |
279 $(ECHO) "$$<: Error: Use of global operators new and delete is not allowed in Hotspot:"; \ |
314 _Znam \ |
280 $(NM) $$< | $(CXXFILT) | $(EGREP) '$(DEMANGLED_REGEXP)' | $(GREP) $(UNDEF_PATTERN); \ |
315 _Znwm \ |
281 $(ECHO) "See: $(TOPDIR)/make/hotspot/lib/CompileJvm.gmk"; \ |
316 # |
282 exit 1; \ |
317 UNDEF_PATTERN := ' U ' |
283 fi |
318 endif |
284 $(TOUCH) $$@ |
319 |
285 |
320 define SetupOperatorNewDeleteCheck |
286 TARGETS += $1.op_check |
321 $1.op_check: $1 |
287 endef |
322 if [ -n "`$(NM) $$< | $(GREP) $(addprefix -e , $(MANGLED_SYMS)) \ |
288 |
323 | $(GREP) $(UNDEF_PATTERN)`" ]; then \ |
289 $(foreach o, $(BUILD_LIBJVM_ALL_OBJS), $(eval $(call SetupOperatorNewDeleteCheck,$o))) |
324 $(ECHO) "$$<: Error: Use of global operators new and delete is not allowed in Hotspot:"; \ |
290 endif |
325 $(NM) $$< | $(CXXFILT) | $(EGREP) '$(DEMANGLED_REGEXP)' | $(GREP) $(UNDEF_PATTERN); \ |
|
326 $(ECHO) "See: $(TOPDIR)/make/hotspot/lib/CompileJvm.gmk"; \ |
|
327 exit 1; \ |
|
328 fi |
|
329 $(TOUCH) $$@ |
|
330 |
|
331 TARGETS += $1.op_check |
|
332 endef |
|
333 |
|
334 $(foreach o, $(BUILD_LIBJVM_ALL_OBJS), $(eval $(call SetupOperatorNewDeleteCheck,$o))) |
|
335 endif |
|
336 endif |