8199271: [TESTBUG] open source VM testbase stress tests
Reviewed-by: mseledtsov, sspitsyn, erikj
#
# Copyright (c) 2011, 2018, 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.
#
WIN_VERIFY_LIB := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libverify/verify.lib
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, lib/CoreLibraries.gmk))
##########################################################################################
# libfdlibm is statically linked with libjava below and not delivered into the
# product on its own.
BUILD_LIBFDLIBM_OPTIMIZATION := NONE
ifeq ($(OPENJDK_TARGET_OS), solaris)
BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
endif
ifeq ($(OPENJDK_TARGET_OS), linux)
ifeq ($(OPENJDK_TARGET_CPU), ppc64)
BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
else ifeq ($(OPENJDK_TARGET_CPU), ppc64le)
BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
else ifeq ($(OPENJDK_TARGET_CPU), s390x)
BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
else ifeq ($(OPENJDK_TARGET_CPU), aarch64)
BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
endif
endif
LIBFDLIBM_SRC := $(TOPDIR)/src/java.base/share/native/libfdlibm
LIBFDLIBM_CFLAGS := -I$(LIBFDLIBM_SRC)
ifneq ($(OPENJDK_TARGET_OS), macosx)
$(eval $(call SetupNativeCompilation, BUILD_LIBFDLIBM, \
NAME := fdlibm, \
TYPE := STATIC_LIBRARY, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE), \
SRC := $(LIBFDLIBM_SRC), \
OPTIMIZATION := $(BUILD_LIBFDLIBM_OPTIMIZATION), \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBFDLIBM_CFLAGS), \
CFLAGS_windows_debug := -DLOGGING, \
CFLAGS_aix := -qfloat=nomaf, \
CFLAGS_linux_ppc64 := -ffp-contract=off, \
CFLAGS_linux_ppc64le := -ffp-contract=off, \
CFLAGS_linux_s390x := -ffp-contract=off, \
CFLAGS_linux_aarch64 := -ffp-contract=off, \
DISABLED_WARNINGS_gcc := sign-compare misleading-indentation, \
DISABLED_WARNINGS_microsoft := 4146 4244 4018, \
ARFLAGS := $(ARFLAGS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
))
else
# On macosx the old build does partial (incremental) linking of fdlibm instead of
# a plain static library.
$(eval $(call SetupNativeCompilation, BUILD_LIBFDLIBM_MAC, \
NAME := fdlibm, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
SRC := $(LIBFDLIBM_SRC), \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBFDLIBM_CFLAGS), \
LDFLAGS := -nostdlib $(ARFLAGS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
))
BUILD_LIBFDLIBM := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX)
$(BUILD_LIBFDLIBM): $(BUILD_LIBFDLIBM_MAC)
$(call install-file)
endif
##########################################################################################
LIBVERIFY_OPTIMIZATION := HIGH
ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), true)
LIBVERIFY_OPTIMIZATION := LOW
endif
endif
$(eval $(call SetupJdkLibrary, BUILD_LIBVERIFY, \
NAME := verify, \
SRC := $(TOPDIR)/src/java.base/share/native/libverify, \
OPTIMIZATION := $(LIBVERIFY_OPTIMIZATION), \
CFLAGS := $(CFLAGS_JDKLIB), \
DISABLED_WARNINGS_gcc := implicit-fallthrough, \
DISABLED_WARNINGS_microsoft := 4244 4267, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS_unix := -ljvm, \
LIBS_windows := jvm.lib, \
))
TARGETS += $(BUILD_LIBVERIFY)
##########################################################################################
# Allow a custom makefile to add extra src dirs
LIBJAVA_SRC_DIRS += $(call FindSrcDirsForLib, java.base, java)
LIBJAVA_CFLAGS := $(addprefix -I, $(LIBJAVA_SRC_DIRS)) \
-I$(TOPDIR)/src/java.base/share/native/libfdlibm \
-I$(SUPPORT_OUTPUTDIR)/headers/java.base \
-DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"'
ifeq ($(OPENJDK_TARGET_OS), macosx)
BUILD_LIBJAVA_java_props_md.c_CFLAGS := -x objective-c
BUILD_LIBJAVA_java_props_macosx.c_CFLAGS := -x objective-c
endif
$(eval $(call SetupJdkLibrary, BUILD_LIBJAVA, \
NAME := java, \
SRC := $(LIBJAVA_SRC_DIRS), \
OPTIMIZATION := HIGH, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBJAVA_CFLAGS), \
System.c_CFLAGS := $(VERSION_CFLAGS), \
jdk_util.c_CFLAGS := $(VERSION_CFLAGS), \
WARNINGS_AS_ERRORS_xlc := false, \
DISABLED_WARNINGS_gcc := unused-result, \
DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_macosx := -L$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/, \
LDFLAGS_windows := -delayload:shell32.dll, \
LIBS_unix := -ljvm -lverify, \
LIBS_linux := $(LIBDL) $(BUILD_LIBFDLIBM), \
LIBS_solaris := -lsocket -lnsl -lscf $(LIBDL) $(BUILD_LIBFDLIBM), \
LIBS_aix := $(LIBDL) $(BUILD_LIBFDLIBM) $(LIBM),\
LIBS_macosx := -lfdlibm \
-framework CoreFoundation \
-framework Foundation \
-framework Security -framework SystemConfiguration, \
LIBS_windows := jvm.lib $(BUILD_LIBFDLIBM) $(WIN_VERIFY_LIB) \
shell32.lib delayimp.lib \
advapi32.lib version.lib, \
))
TARGETS += $(BUILD_LIBJAVA)
$(BUILD_LIBJAVA): $(BUILD_LIBVERIFY)
$(BUILD_LIBJAVA): $(BUILD_LIBFDLIBM)
##########################################################################################
BUILD_LIBZIP_EXCLUDES :=
ifeq ($(USE_EXTERNAL_LIBZ), true)
LIBZIP_EXCLUDES += zlib
endif
ifeq ($(LIBZIP_CAN_USE_MMAP), true)
BUILD_LIBZIP_MMAP := -DUSE_MMAP
endif
$(eval $(call SetupJdkLibrary, BUILD_LIBZIP, \
NAME := zip, \
OPTIMIZATION := LOW, \
SRC := $(TOPDIR)/src/java.base/share/native/libzip, \
EXCLUDES := $(LIBZIP_EXCLUDES), \
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBZ_CFLAGS) \
-I$(TOPDIR)/src/java.base/share/native/libjava \
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
-I$(SUPPORT_OUTPUTDIR)/headers/java.base, \
CFLAGS_unix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \
DISABLED_WARNINGS_gcc := implicit-fallthrough, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS_unix := -ljvm -ljava $(LIBZ_LIBS), \
LIBS_windows := jvm.lib $(WIN_JAVA_LIB), \
))
$(BUILD_LIBZIP): $(BUILD_LIBJAVA)
TARGETS += $(BUILD_LIBZIP)
##########################################################################################
JIMAGELIB_CPPFLAGS := \
-I$(TOPDIR)/src/java.base/share/native/libjava \
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
-I$(TOPDIR)/src/java.base/share/native/libjimage \
-I$(SUPPORT_OUTPUTDIR)/headers/java.base \
#
$(eval $(call SetupJdkLibrary, BUILD_LIBJIMAGE, \
NAME := jimage, \
TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
OPTIMIZATION := LOW, \
SRC := $(TOPDIR)/src/java.base/share/native/libjimage \
$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjimage, \
EXCLUDES := $(LIBJIMAGE_EXCLUDES), \
CFLAGS := $(CFLAGS_JDKLIB) $(JIMAGELIB_CPPFLAGS), \
CXXFLAGS := $(CXXFLAGS_JDKLIB) $(JIMAGELIB_CPPFLAGS), \
DISABLED_WARNINGS_gcc := implicit-fallthrough, \
CFLAGS_unix := -UDEBUG, \
LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS_unix := -ljvm -ldl $(LIBCXX), \
LIBS_macosx := -lc++, \
LIBS_windows := jvm.lib, \
))
$(BUILD_LIBJIMAGE): $(BUILD_LIBJAVA)
TARGETS += $(BUILD_LIBJIMAGE)
##########################################################################################
LIBJLI_SRC_DIRS := $(call FindSrcDirsForLib, java.base, jli)
LIBJLI_CFLAGS := $(CFLAGS_JDKLIB)
ifeq ($(call check-jvm-variant, zero), true)
ERGO_FAMILY := zero
else
ifeq ($(OPENJDK_TARGET_CPU_ARCH), x86)
ERGO_FAMILY := i586
else
ERGO_FAMILY := $(OPENJDK_TARGET_CPU_ARCH)
endif
endif
LIBJLI_ALL_ERGO := $(wildcard $(addsuffix /ergo_*.c, $(LIBJLI_SRC_DIRS)))
LIBJLI_EXCLUDE_ERGO := $(filter-out %/ergo_$(ERGO_FAMILY).c, $(LIBJLI_ALL_ERGO))
# If all specialized ergo files are excluded, use generic ergo
ifeq ($(LIBJLI_ALL_ERGO), $(LIBJLI_EXCLUDE_ERGO))
LIBJLI_CFLAGS += -DUSE_GENERIC_ERGO
endif
LIBJLI_EXCLUDE_FILES += $(notdir $(LIBJLI_EXCLUDE_ERGO))
ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBJLI_EXCLUDE_FILES += java_md_solinux.c ergo.c ergo_i586.c
BUILD_LIBJLI_java_md_macosx.c_CFLAGS := -x objective-c
BUILD_LIBJLI_STATIC_java_md_macosx.c_CFLAGS := -x objective-c
LIBJLI_CFLAGS += -DPACKAGE_PATH=\"$(PACKAGE_PATH)\"
endif
ifeq ($(OPENJDK_TARGET_OS), windows)
# Staticically link with c runtime on windows.
LIBJLI_CFLAGS := $(filter-out -MD, $(LIBJLI_CFLAGS))
LIBJLI_OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE)
# Supply the name of the C runtime lib.
LIBJLI_CFLAGS += -DMSVCR_DLL_NAME='"$(notdir $(MSVCR_DLL))"'
ifneq ($(MSVCP_DLL), )
LIBJLI_CFLAGS += -DMSVCP_DLL_NAME='"$(notdir $(MSVCP_DLL))"'
endif
else
LIBJLI_OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE)/jli
endif
LIBJLI_CFLAGS += $(addprefix -I, $(LIBJLI_SRC_DIRS))
LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
ifneq ($(USE_EXTERNAL_LIBZ), true)
LIBJLI_EXTRA_FILES += \
$(addprefix $(TOPDIR)/src/java.base/share/native/libzip/zlib/, \
inflate.c \
inftrees.c \
inffast.c \
zadler32.c \
zcrc32.c \
zutil.c \
)
endif
$(eval $(call SetupJdkLibrary, BUILD_LIBJLI, \
NAME := jli, \
OUTPUT_DIR := $(LIBJLI_OUTPUT_DIR), \
SRC := $(LIBJLI_SRC_DIRS), \
EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \
EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
OPTIMIZATION := HIGH, \
CFLAGS := $(LIBJLI_CFLAGS), \
DISABLED_WARNINGS_gcc := maybe-uninitialized, \
DISABLED_WARNINGS_solstudio := \
E_ASM_DISABLES_OPTIMIZATION \
E_STATEMENT_NOT_REACHED, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
LIBS_unix := $(LIBZ_LIBS), \
LIBS_linux := $(LIBDL) -lpthread, \
LIBS_solaris := $(LIBDL), \
LIBS_aix := $(LIBDL),\
LIBS_macosx := -framework Cocoa -framework Security -framework ApplicationServices, \
LIBS_windows := advapi32.lib comctl32.lib user32.lib, \
))
TARGETS += $(BUILD_LIBJLI)
# On windows, the static library has the same suffix as the import library created by
# with the shared library, so the static library is given a different name. No harm
# in doing it for all platform to reduce complexity.
ifeq ($(OPENJDK_TARGET_OS), windows)
$(eval $(call SetupNativeCompilation, BUILD_LIBJLI_STATIC, \
NAME := jli_static, \
TYPE := STATIC_LIBRARY, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE), \
SRC := $(LIBJLI_SRC_DIRS), \
EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \
EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
OPTIMIZATION := HIGH, \
CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
ARFLAGS := $(ARFLAGS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
))
TARGETS += $(BUILD_LIBJLI_STATIC)
else ifeq ($(OPENJDK_TARGET_OS), macosx)
#
# On macosx they do partial (incremental) linking of libjli_static.a
# code it here...rather than add support to NativeCompilation
# as this is first time I see it
$(eval $(call SetupNativeCompilation, BUILD_LIBJLI_STATIC, \
NAME := jli_static, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE), \
SRC := $(LIBJLI_SRC_DIRS), \
EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \
EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
OPTIMIZATION := HIGH, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
LDFLAGS := -nostdlib $(ARFLAGS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
))
ifeq ($(STATIC_BUILD), true)
TARGETS += $(BUILD_LIBJLI_STATIC)
else
$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static.a: $(BUILD_LIBJLI_STATIC)
$(call install-file)
TARGETS += $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static.a
endif
else ifeq ($(OPENJDK_TARGET_OS), aix)
# AIX also requires a static libjli because the compiler doesn't support '-rpath'
$(eval $(call SetupNativeCompilation, BUILD_LIBJLI_STATIC, \
NAME := jli_static, \
TYPE := STATIC_LIBRARY, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE), \
SRC := $(LIBJLI_SRC_DIRS), \
EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \
EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
OPTIMIZATION := HIGH, \
CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
ARFLAGS := $(ARFLAGS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static))
TARGETS += $(BUILD_LIBJLI_STATIC)
endif