Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions make/Hsdis.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ ifeq ($(HSDIS_BACKEND), llvm)
LLVM_OS := apple-darwin
else ifeq ($(call isTargetOs, windows), true)
LLVM_OS := pc-windows-msvc
else ifeq ($(call isTargetOs, bsd), true)
LLVM_OS := unknown-$(OPENJDK_TARGET_OS_ENV:bsd.%=%)
else
$(error No support for LLVM on this platform)
endif
Expand Down
5 changes: 5 additions & 0 deletions make/RunTestsPrebuilt.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ else
OPENJDK_TARGET_OS := linux
else ifeq ($(UNAME_OS), Darwin)
OPENJDK_TARGET_OS := macosx
else ifneq ($(findstring BSD, $(UNAME_OS)), )
OPENJDK_TARGET_OS := bsd
else
OPENJDK_TARGET_OS := $(UNAME_OS)
endif
Expand Down Expand Up @@ -214,6 +216,9 @@ ifeq ($(OPENJDK_TARGET_OS), linux)
else ifeq ($(OPENJDK_TARGET_OS), macosx)
NUM_CORES := $(shell /usr/sbin/sysctl -n hw.ncpu)
MEMORY_SIZE := $(shell $(EXPR) `/usr/sbin/sysctl -n hw.memsize` / 1024 / 1024)
else ifeq ($(OPENJDK_TARGET_OS), bsd)
NUM_CORES := $(shell /sbin/sysctl -n hw.ncpu)
MEMORY_SIZE := $(shell $(EXPR) `/sbin/sysctl -n hw.physmem` / 1024 / 1024)
else ifeq ($(OPENJDK_TARGET_OS), windows)
NUM_CORES := $(NUMBER_OF_PROCESSORS)
MEMORY_SIZE := $(shell \
Expand Down
6 changes: 6 additions & 0 deletions make/autoconf/basic_tools.m4
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ AC_DEFUN_ONCE([BASIC_SETUP_TOOLS],
UTIL_REQUIRE_PROGS(TOUCH, touch)
UTIL_REQUIRE_PROGS(XARGS, xargs)

if test "x$OPENJDK_BUILD_OS_ENV" = "bsd.netbsd"; then
# Required by NetBSD to adjust privilege protections for
# mapped memory pages
UTIL_REQUIRE_PROGS(PAXCTL, paxctl)
fi

# Required tools with some special treatment
UTIL_REQUIRE_SPECIAL(FGREP, [AC_PROG_FGREP])

Expand Down
5 changes: 2 additions & 3 deletions make/autoconf/platform.m4
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,8 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER],

# Setup OPENJDK_$1_CPU_OSARCH, which is used to set the os.arch Java system property
OPENJDK_$1_CPU_OSARCH="$OPENJDK_$1_CPU"
if test "x$OPENJDK_$1_OS" = xbsd -o "x$OPENJDK_$1_OS" = xlinux \
&& test "x$OPENJDK_$1_CPU" = xx86; then
# On linux and BSD only, we replace x86 with i386.
if test "x$OPENJDK_$1_OS" = xlinux && test "x$OPENJDK_$1_CPU" = xx86; then
# On linux only, we replace x86 with i386.
OPENJDK_$1_CPU_OSARCH="i386"
elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then
# On all platforms except macosx, we replace x86_64 with amd64.
Expand Down
4 changes: 4 additions & 0 deletions make/common/JdkNativeCompilation.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ define AddJdkLibrary
ifeq ($(call isTargetOs, aix)+$$($1_$2_MODULE):$$($1_$2_NAME), true+java.base:jli)
$1_$2_STATIC_LIBRARY := true
endif
ifeq ($(call isTargetOsEnv, bsd.openbsd)+$$($1_$2_MODULE):$$($1_$2_NAME), true+java.base:jli)
$1_$2_STATIC_LIBRARY := true
$1_LIBS += $(LIBZ_LIBS) $(LIBPTHREAD)
endif
ifeq ($$($1_$2_MODULE):$$($1_$2_NAME), gtest:gtest)
$1_$2_STATIC_LIBRARY := true
endif
Expand Down
3 changes: 3 additions & 0 deletions make/common/Utils.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ isTargetOs = \
isTargetOsType = \
$(strip $(if $(filter $(OPENJDK_TARGET_OS_TYPE), $1), true, false))

isTargetOsEnv = \
$(strip $(if $(filter $(OPENJDK_TARGET_OS_ENV), $1), true, false))

isTargetCpu = \
$(strip $(if $(filter $(OPENJDK_TARGET_CPU), $1), true, false))

Expand Down
1 change: 1 addition & 0 deletions make/common/modules/LauncherCommon.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ define SetupBuildLauncherBody
DISABLED_WARNINGS_clang := unused-function, \
LDFLAGS := $$($1_LDFLAGS), \
LDFLAGS_linux := $$(call SetExecutableOrigin,/../lib), \
LDFLAGS_bsd := $$(call SetExecutableOrigin,/../lib), \
LDFLAGS_macosx := $$(call SetExecutableOrigin,/../lib), \
LDFLAGS_FILTER_OUT := $$($1_LDFLAGS_FILTER_OUT), \
JDK_LIBS := $$($1_JDK_LIBS), \
Expand Down
7 changes: 5 additions & 2 deletions make/common/native/Link.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ define CreateDynamicLibraryOrExecutable
$$($1_SYSROOT_LDFLAGS) -o $$($1_TARGET) $$($1_LD_OBJ_ARG) \
$$($1_LIBS) $$($1_EXTRA_LIBS))
ifeq ($$($1_CREATE_DEBUGINFO), true)
ifeq ($(call isTargetOs, linux), true)
ifeq ($(call isTargetOs, linux bsd), true)
# This cannot be run separately since it updates the original target
# file.
$$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_create_debuginfo, \
Expand All @@ -206,14 +206,17 @@ define CreateDynamicLibraryOrExecutable
$$($1_STRIP) $$($1_STRIPFLAGS) $$($1_TARGET))
endif
ifeq ($$($1_CREATE_DEBUGINFO), true)
ifeq ($(call isTargetOs, linux), true)
ifeq ($(call isTargetOs, linux bsd), true)
# Run this after strip is called, since strip can sometimes mangle
# the embedded debuglink, which we want to avoid.
$$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_add_debuginfo_link, \
$(CD) $$($1_SYMBOLS_DIR) && \
$$($1_OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET))
endif
endif
ifeq ($(call isTargetOsEnv, bsd.netbsd), true)
$(PAXCTL) +m $$@
endif
ifneq ($(MACOSX_CODESIGN_MODE), disabled)
# Remove signature explicitly first to avoid warnings if the linker
# added a default adhoc signature.
Expand Down
3 changes: 3 additions & 0 deletions make/devkit/createAutoconfBundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ case `uname -s` in
Linux)
os=linux
;;
*BSD)
os=bsd
;;
CYGWIN*)
os=cygwin
;;
Expand Down
2 changes: 1 addition & 1 deletion make/devkit/createTidyBundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ mkdir -p "$SRC_DIR/$BUILD_DIR"
cd "$SRC_DIR/$BUILD_DIR"

case $OS_NAME in
Linux|Darwin)
Linux|Darwin|*BSD)
echo "Building Tidy HTML5 for Unix-like platform ($OS_NAME)..."

CMAKE_ARCH_OPTIONS=""
Expand Down
4 changes: 4 additions & 0 deletions make/hotspot/gensrc/GensrcAdlc.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ ifeq ($(call check-jvm-feature, compiler2), true)
else ifeq ($(call isBuildOs, windows), true)
ADLC_CFLAGS := -nologo -EHsc
ADLC_CFLAGS_WARNINGS := -W3 -D_CRT_SECURE_NO_WARNINGS
else ifeq ($(call isBuildOs, bsd), true)
ADLC_CFLAGS := -fno-exceptions -D_ALLBSD_SOURCE=1 -D_BSDONLY_SOURCE
endif

# Set the C++ standard
Expand Down Expand Up @@ -106,6 +108,8 @@ ifeq ($(call check-jvm-feature, compiler2), true)
ifeq ($(HOTSPOT_TARGET_CPU_ARCH), aarch64)
ADLCFLAGS += -DR18_RESERVED
endif
else ifeq ($(call isTargetOs, bsd), true)
ADLCFLAGS += -D_ALLBSD_SOURCE=1 -D_BSDONLY_SOURCE
else ifeq ($(call isTargetOs, windows), true)
ADLCFLAGS += -D_WIN64=1
ifeq ($(HOTSPOT_TARGET_CPU_ARCH), aarch64)
Expand Down
2 changes: 1 addition & 1 deletion make/hotspot/gensrc/GensrcDtrace.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ifeq ($(INCLUDE), true)

ifeq ($(call check-jvm-feature, dtrace), true)

ifeq ($(call isTargetOs, macosx), true)
ifeq ($(call isTargetOs, macosx bsd), true)
DTRACE_CPP_FLAGS := -D_LP64 -x c
else ifeq ($(call isTargetOs, linux), true)
DTRACE_CPP_FLAGS := -x c
Expand Down
3 changes: 2 additions & 1 deletion make/hotspot/lib/CompileJvm.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ ifeq ($(call isTargetOs, windows), true)
JVM_LDFLAGS += -def:$(WIN_EXPORT_FILE)
endif

ifeq ($(call isTargetOs, linux), true)
ifeq ($(call isTargetOs, linux bsd), true)
HOTSPOT_VERSION_SCRIPT := $(TOPDIR)/make/data/hotspot-symbols/version-script-$(TOOLCHAIN_TYPE).txt

JVM_LDFLAGS += -Wl,-version-script=$(HOTSPOT_VERSION_SCRIPT)
Expand Down Expand Up @@ -222,6 +222,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJVM, \
DISABLED_WARNINGS_clang_g1YoungGCPostEvacuateTasks.cpp := delete-abstract-non-virtual-dtor, \
DISABLED_WARNINGS_clang_management.cpp := missing-field-initializers, \
DISABLED_WARNINGS_clang_notificationThread.cpp := bitwise-instead-of-logical, \
DISABLED_WARNINGS_clang_os_bsd_aarch64.cpp := format-nonliteral, \
DISABLED_WARNINGS_clang_os_posix.cpp := mismatched-tags missing-field-initializers, \
DISABLED_WARNINGS_clang_aix_os_posix.cpp := format-nonliteral, \
DISABLED_WARNINGS_clang_postaloc.cpp := tautological-undefined-compare, \
Expand Down
60 changes: 60 additions & 0 deletions make/hotspot/lib/JvmOverrideFiles.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ ifeq ($(call isTargetOs, linux), true)
endif

else ifeq ($(call isTargetOs, macosx), true)
JVM_EXCLUDE_FILES += decoder_bsd.cpp
# The copied fdlibm routines in these files must not be optimized
BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG)
BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG)
Expand Down Expand Up @@ -147,6 +148,65 @@ else ifeq ($(call isTargetOs, windows), true)
# Workaround for jvmciCompilerToVM.cpp long compilation time
BUILD_LIBJVM_jvmciCompilerToVMInit.cpp_OPTIMIZATION := NONE

else ifeq ($(call isTargetOs, bsd), true)
JVM_EXCLUDE_FILES += decoder_mach0.cpp
BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := -DNO_PCH $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG)
BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := -DNO_PCH $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG)

BUILD_LIBJVM_loopTransform.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
ifneq ($(DEBUG_LEVEL), slowdebug)
BUILD_LIBJVM_unsafe.cpp_CXXFLAGS := -O1
endif

ifeq ($(TOOLCHAIN_TYPE), gcc)
BUILD_LIBJVM_unsafe.cpp_CXXFLAGS += -Wno-maybe-uninitialized
endif

ifeq ($(TOOLCHAIN_TYPE), clang)
ifeq ($(call isTargetCpu, x86), true)
ifneq ($(DEBUG_LEVEL), slowdebug)
# hotspot/jtreg/compiler/c2/Test8062950.java test fails on x86
# with clang when parse2.cpp is optimized above -O1
BUILD_LIBJVM_parse2.cpp_CXXFLAGS := -O1
endif
endif

# The following files are compiled at various optimization
# levels due to optimization issues encountered at the
# default level. The Clang compiler issues a compile
# time error if there is an optimization level specification
# skew between the PCH file and the C++ file. Especially if the
# PCH file is compiled at a higher optimization level than
# the C++ file. One solution might be to prepare extra optimization
# level specific PCH files for the opt build and use them here, but
# it's probably not worth the effort as long as only a few files
# need this special handling.
JVM_PRECOMPILED_HEADER_EXCLUDE := \
sharedRuntimeTrig.cpp \
sharedRuntimeTrans.cpp \
loopTransform.cpp \
unsafe.cpp \
parse2.cpp \
#

ifeq ($(OPENJDK_TARGET_CPU), aarch64)
JVM_PRECOMPILED_HEADER_EXCLUDE += \
memnode.cpp
#
BUILD_LIBJVM_memnode.cpp_CXXFLAGS := -O0
endif

# retguard interferes with these files leading to SIGTRAP
ifeq ($(call isTargetOsEnv, bsd.openbsd), true)
JVM_PRECOMPILED_HEADER_EXCLUDE += \
c1_Runtime1.cpp \
sharedRuntime.cpp \
#
BUILD_LIBJVM_c1_Runtime1.cpp_CXXFLAGS := -fno-ret-protector
BUILD_LIBJVM_sharedRuntime.cpp_CXXFLAGS := -fno-ret-protector
endif
endif

endif

################################################################################
Expand Down
2 changes: 1 addition & 1 deletion make/modules/java.base/Java.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ EXCLUDE_FILES += \
# data files and shouldn't go in the product
EXCLUDE_FILES += sun/text/resources/BreakIteratorRules.java

ifeq ($(call isTargetOs, macosx aix), false)
ifeq ($(call isTargetOs, macosx aix bsd), false)
EXCLUDE_FILES += sun/nio/fs/PollingWatchService.java
endif

Expand Down
1 change: 1 addition & 0 deletions make/modules/java.base/Launcher.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ ifeq ($(call isTargetOs, linux), true)
OPTIMIZATION := LOW, \
EXTRA_HEADER_DIRS := libjli, \
CFLAGS_linux := -fPIC, \
CFLAGS_bsd := -fPIC, \
LD_SET_ORIGIN := false, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
))
Expand Down
11 changes: 11 additions & 0 deletions make/modules/java.base/Lib.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBNET, \
-delayload:winhttp.dll, \
JDK_LIBS := libjava libjvm, \
LIBS_linux := $(LIBDL), \
LIBS_bsd := $(LIBPTHREAD), \
LIBS_aix := $(LIBDL), \
LIBS_windows := advapi32.lib delayimp.lib iphlpapi.lib secur32.lib \
winhttp.lib ws2_32.lib, \
Expand All @@ -74,6 +75,7 @@ TARGETS += $(BUILD_LIBNET)
$(eval $(call SetupJdkLibrary, BUILD_LIBNIO, \
NAME := nio, \
OPTIMIZATION := HIGH, \
CFLAGS_bsd := -D_WITH_GETLINE, \
EXTRA_HEADER_DIRS := \
libnio/ch \
libnio/fs \
Expand All @@ -82,6 +84,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBNIO, \
DISABLED_WARNINGS_clang_UnixNativeDispatcher.c := unused-variable, \
JDK_LIBS := libjava libnet, \
LIBS_linux := $(LIBDL) $(LIBPTHREAD), \
LIBS_bsd := $(LIBPTHREAD), \
LIBS_aix := $(LIBDL), \
LIBS_macosx := \
-framework CoreFoundation \
Expand Down Expand Up @@ -156,16 +159,24 @@ endif
## Build libsyslookup
## The LIBDL dependency on Linux is needed to dynamically access libdl symbols,
## which may be needed as part of resolving some standard symbols
## The BSDLIBC dependency on OpenBSD is needed to access libc symbols. On
## OpenBSD libc is not added by default to shared libraries.
################################################################################

ifeq ($(OPENJDK_TARGET_OS_ENV), bsd.openbsd)
BSDLIBC= -lc
endif

$(eval $(call SetupJdkLibrary, BUILD_LIBSYSLOOKUP, \
NAME := syslookup, \
EXTRA_HEADER_DIRS := java.base:libjava, \
LD_SET_ORIGIN := false, \
LDFLAGS_linux := -Wl$(COMMA)--no-as-needed, \
LDFLAGS_bsd := -Wl$(COMMA)--no-as-needed, \
LDFLAGS_aix := -brtl -bexpfull, \
LIBS_linux := $(LIBDL) $(LIBM), \
LIBS_aix := -ldecNumber $(LIBM), \
LIBS_bsd := $(LIBDL) $(LIBM) $(BSDLIBC), \
))

TARGETS += $(BUILD_LIBSYSLOOKUP)
Expand Down
8 changes: 8 additions & 0 deletions make/modules/java.base/lib/CoreLibraries.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJAVA, \
-framework Foundation \
-framework SystemConfiguration, \
LIBS_windows := advapi32.lib ole32.lib shell32.lib version.lib, \
LIBS_bsd := $(LIBDL), \
))

TARGETS += $(BUILD_LIBJAVA)
Expand Down Expand Up @@ -177,6 +178,12 @@ ifeq ($(call isTargetOs, aix), true)
LIBJLI_STATIC_EXCLUDE_OBJS += java_md_aix.o
endif

ifeq ($(call isTargetOsEnv, bsd.openbsd), true)
# OpenBSD requires a static libjli because the runtime linker doesn't fully
# support $ORIGIN in '-rpath'
BUILD_LIBJLI_TYPE := STATIC_LIBRARY
endif

$(eval $(call SetupJdkLibrary, BUILD_LIBJLI, \
NAME := jli, \
TYPE := $(BUILD_LIBJLI_TYPE), \
Expand All @@ -191,6 +198,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJLI, \
DISABLED_WARNINGS_clang_java_md_macosx.m := unused-variable, \
LIBS_unix := $(LIBZ_LIBS), \
LIBS_linux := $(LIBDL) $(LIBPTHREAD), \
LIBS_bsd := $(LIBPTHREAD),\
LIBS_macosx := \
-framework ApplicationServices \
-framework Cocoa \
Expand Down
2 changes: 1 addition & 1 deletion make/modules/java.desktop/Gensrc.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ifeq ($(call isTargetOs, windows), false)
include gensrc/GensrcIcons.gmk
endif

ifeq ($(call isTargetOs, linux aix), true)
ifeq ($(call isTargetOs, linux aix bsd), true)
include gensrc/GensrcX11Wrappers.gmk
endif

Expand Down
Loading