Skip to content

Commit

Permalink
Merge upstream-jdk
Browse files Browse the repository at this point in the history
  • Loading branch information
corretto-github-robot committed Dec 3, 2024
2 parents dffcfd3 + 659f70b commit 9ec8a54
Show file tree
Hide file tree
Showing 309 changed files with 31,547 additions and 3,143 deletions.
6 changes: 2 additions & 4 deletions make/Docs.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,13 @@ JAVA_WARNINGS_ARE_ERRORS ?= -Werror
JAVADOC_OPTIONS := -use -keywords -notimestamp \
-encoding ISO-8859-1 -docencoding UTF-8 -breakiterator \
-splitIndex --system none -javafx --expand-requires transitive \
--override-methods=summary \
--no-external-specs-page
--override-methods=summary

# The reference options must stay stable to allow for comparisons across the
# development cycle.
REFERENCE_OPTIONS := -XDignore.symbol.file=true -use -keywords -notimestamp \
-encoding ISO-8859-1 -breakiterator -splitIndex --system none \
-html5 -javafx --expand-requires transitive \
--no-external-specs-page
-html5 -javafx --expand-requires transitive

# Should we add DRAFT stamps to the generated javadoc?
ifeq ($(VERSION_IS_GA), true)
Expand Down
21 changes: 0 additions & 21 deletions make/Images.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -281,27 +281,6 @@ else
endif
CMDS_TARGET_SUBDIR := bin

# Param 1 - dir to find debuginfo files in
FindDebuginfoFiles = \
$(wildcard $(addprefix $1/*, $(DEBUGINFO_SUFFIXES)) \
$(addprefix $1/*/*, $(DEBUGINFO_SUFFIXES)) \
$(addprefix $1/*/*/*, $(DEBUGINFO_SUFFIXES)))

# Pick the correct debug info files to copy, either zipped or not.
ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
DEBUGINFO_SUFFIXES += .diz
else
DEBUGINFO_SUFFIXES := .debuginfo .pdb .map
# On Macosx, if debug symbols have not been zipped, find all files inside *.dSYM
# dirs.
ifeq ($(call isTargetOs, macosx), true)
$(call FillFindCache, \
$(SUPPORT_OUTPUTDIR)/modules_libs $(SUPPORT_OUTPUTDIR)/modules_cmds)
FindDebuginfoFiles = \
$(if $(wildcard $1), $(call containing, .dSYM/, $(call FindFiles, $1)))
endif
endif

# Param 1 - either JDK or JRE
SetupCopyDebuginfo = \
$(foreach m, $(ALL_$1_MODULES), \
Expand Down
22 changes: 18 additions & 4 deletions make/Main.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,18 @@ $(eval $(call SetupTarget, symbols-image, \
TARGET := symbols, \
))

$(eval $(call SetupTarget, static-launcher, \
MAKEFILE := StaticLibs, \
TARGET := static-launcher, \
DEPS := hotspot-static-libs static-libs, \
))

$(eval $(call SetupTarget, static-jdk-image, \
MAKEFILE := StaticLibs, \
TARGET := static-jdk-image, \
DEPS := static-exploded-image jdk-image, \
))

$(eval $(call SetupTarget, static-libs-image, \
MAKEFILE := StaticLibsImage, \
TARGET := static-libs-image, \
Expand Down Expand Up @@ -1086,9 +1098,9 @@ else

symbols-image: $(LIBS_TARGETS) $(LAUNCHER_TARGETS)

static-libs-image: hotspot-static-libs $(STATIC_LIBS_TARGETS)
static-libs-image: hotspot-static-libs static-libs

static-libs-graal-image: $(STATIC_LIBS_TARGETS)
static-libs-graal-image: static-libs

bootcycle-images: jdk-image

Expand Down Expand Up @@ -1254,6 +1266,8 @@ ifeq ($(call isTargetOs, macosx), true)
legacy-images: mac-legacy-jre-bundle
endif

static-exploded-image: static-launcher exploded-image

# These targets build the various documentation images
docs-jdk-image: docs-jdk
docs-javase-image: docs-javase
Expand Down Expand Up @@ -1296,7 +1310,7 @@ endif
################################################################################

# all-images builds all our deliverables as images.
all-images: product-images test-image all-docs-images
all-images: product-images static-jdk-image test-image all-docs-images

# all-bundles packages all our deliverables as tar.gz bundles.
all-bundles: product-bundles test-bundles docs-bundles static-libs-bundles
Expand All @@ -1309,7 +1323,7 @@ ALL_TARGETS += buildtools hotspot hotspot-libs hotspot-static-libs \
create-buildjdk docs-jdk-api docs-javase-api docs-reference-api docs-jdk \
docs-javase docs-reference docs-javadoc mac-bundles product-images legacy-images \
docs-image docs-javase-image docs-reference-image all-docs-images \
docs-bundles all-docs-bundles test-image all-images \
docs-bundles all-docs-bundles test-image all-images static-exploded-image \
all-bundles

################################################################################
Expand Down
19 changes: 18 additions & 1 deletion make/ModuleWrapper.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014, 2024, 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
Expand Down Expand Up @@ -45,6 +45,23 @@ TARGETS :=
# Include the file being wrapped.
include $(MAKEFILE_PREFIX).gmk

ifeq ($(MAKEFILE_PREFIX), Lib)
# We need to keep track of what libraries are generated/needed by this
# module. This information is required when doing static linking, to know
# which static library files to include. The variable $(MODULE)_INCLUDED_LIBS is
# added to for each call to SetupJdkLibrary. The file module-included-libs.txt is then
# read in StaticLibs.gmk.
ifneq ($($(MODULE)_JDK_LIBS), )
LIBLIST := $(SUPPORT_OUTPUTDIR)/modules_static-libs/$(MODULE)/module-included-libs.txt

$(LIBLIST): $(TARGETS)
$(call MakeDir, $(@D))
$(ECHO) $($(MODULE)_INCLUDED_LIBS) > $@

TARGETS += $(LIBLIST)
endif
endif

# Setup copy rules from the modules directories to the jdk image directory.
ifeq ($(call isTargetOs, windows), true)
TO_BIN_FILTER := %$(SHARED_LIBRARY_SUFFIX) %.diz %.pdb %.map
Expand Down
191 changes: 191 additions & 0 deletions make/StaticLibs.gmk
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
#
# Copyright (c) 2024, 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.
#

default: all

include $(SPEC)
include MakeBase.gmk

include CopyFiles.gmk
include Modules.gmk
include modules/LauncherCommon.gmk

################################################################################
#
# Create the static java launcher
#
################################################################################

STATIC_JDK_IMAGE_DIR := $(IMAGES_OUTPUTDIR)/static-jdk
STATIC_LAUNCHER_OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/static-native/launcher
HOTSPOT_STATIC_LIB_PATH := $(HOTSPOT_OUTPUTDIR)/*/libjvm/objs/static

ifneq ($(word 2, $(wildcard $(HOTSPOT_STATIC_LIB_PATH))), )
$(error Cannot perform static linking when building more than one JVM library)
endif

# Find all modules with static libraries
STATIC_LIB_MODULES := $(patsubst $(SUPPORT_OUTPUTDIR)/modules_static-libs/%, \
%, $(wildcard $(SUPPORT_OUTPUTDIR)/modules_static-libs/*))

# Filter out known broken libraries. This is a temporary measure until
# proper support for these libraries can be provided.
ifeq ($(call isTargetOs, linux), true)
# libsplashscreen has a name conflict with libawt in the function
# BitmapToYXBandedRectangles, so we exclude it for now.
BROKEN_STATIC_LIBS += splashscreen
else ifeq ($(call isTargetOs, macosx), true)
# libosxsecurity has a name conflict with libosxapp in the function
# JavaStringToNSString, so we exclude it for now.
BROKEN_STATIC_LIBS += osxsecurity
else ifeq ($(call isTargetOs, windows), true)
# libsplashscreen has a name conflict with libawt in the function
# BitmapToYXBandedRectangles, so we exclude it for now.
BROKEN_STATIC_LIBS += splashscreen
# libsspi_bridge has name conflicts with sunmscapi
BROKEN_STATIC_LIBS += sspi_bridge
# These libs define DllMain which conflict with Hotspot
BROKEN_STATIC_LIBS += awt dt_shmem dt_socket
# These libs are dependent on any of the above disabled libs
BROKEN_STATIC_LIBS += fontmanager jawt lcms net nio
endif

$(foreach module, $(STATIC_LIB_MODULES), \
$(eval LIBS_$(module) := $(filter-out $(BROKEN_STATIC_LIBS), $(shell cat \
$(SUPPORT_OUTPUTDIR)/modules_static-libs/$(module)/module-included-libs.txt))) \
)

STATIC_LIB_FILES := $(foreach module, $(STATIC_LIB_MODULES), \
$(foreach lib, $(LIBS_$(module)), \
$(SUPPORT_OUTPUTDIR)/native/$(module)/lib$(lib)/static/$(LIBRARY_PREFIX)$(lib)$(STATIC_LIBRARY_SUFFIX)))

# Add Hotspot
STATIC_LIB_FILES += $(wildcard $(HOTSPOT_STATIC_LIB_PATH)/$(LIBRARY_PREFIX)jvm$(STATIC_LIBRARY_SUFFIX))

# Figure out what external libraries are required to link these static JDK
# libraries.
LIB_FLAGS_FILES := $(addsuffix .lib-flags.txt, $(STATIC_LIB_FILES))

# Gather the lib flags from all individual libraries. There are many duplicates,
# so sort and just keep unique instances. On macOS, a common pattern is
# "-framework FooFramework", so we must make sure we keep the two words together.
EXTERNAL_LIBS := $(strip $(shell $(CAT) $(LIB_FLAGS_FILES) | \
$(SED) -e 's/-framework /-framework_/g' | $(TR) ' ' '\n' | $(SORT) -u | \
$(SED) -e 's/-framework_/-framework /g'))

ifeq ($(call isTargetOs, macosx), true)
STATIC_LIBS := $(addprefix -force_load$(SPACE), $(STATIC_LIB_FILES))
STANDARD_LIBS += -lstdc++
else ifeq ($(call isTargetOs, linux), true)
STATIC_LIBS := -Wl,--export-dynamic -Wl,--whole-archive $(STATIC_LIB_FILES) -Wl,--no-whole-archive
STANDARD_LIBS := -l:libstdc++.a
else ifeq ($(call isTargetOs, windows), true)
STATIC_LIBS := $(addprefix -wholearchive:, $(STATIC_LIB_FILES))
else
$(error Unsupported platform)
endif

$(eval $(call SetupBuildLauncher, java, \
CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES, \
EXTRA_RCFLAGS := $(JAVA_RCFLAGS), \
VERSION_INFO_RESOURCE := $(JAVA_VERSION_INFO_RESOURCE), \
OPTIMIZATION := HIGH, \
STATIC_LAUNCHER := true, \
LDFLAGS := $(LDFLAGS_STATIC_JDK), \
LIBS := $(STATIC_LIBS) $(EXTERNAL_LIBS) $(STANDARD_LIBS), \
OUTPUT_DIR := $(STATIC_LAUNCHER_OUTPUT_DIR), \
OBJECT_DIR := $(STATIC_LAUNCHER_OUTPUT_DIR), \
))

$(java): $(STATIC_LIB_FILES)

TARGETS += $(java)

JAVA_LAUNCHER := $(BUILD_LAUNCHER_java_TARGET)

static-launcher: $(java)

################################################################################
#
# Create the static-jdk image with the statically built java launcher
#
################################################################################

# Until we get proper support in jlink for generating an image with static
# builds, we need to create the image ourselves. We base it on a normal
# dynamically linked JDK image.

# All these files/dirs should be copied as-is
JDK_IMAGE_COPY_FILES := $(addprefix $(JDK_IMAGE_DIR)/, conf demo include jmods \
legal man/man1/java.1 release README)

# We need to copy some files from lib, but not the dynamic libraries themselves
ALL_LIB_FILES := $(call FindFiles, $(JDK_IMAGE_DIR)/lib)

# Remove all dynamic libraries from the list
JDK_IMAGE_COPY_LIB_FILES := $(filter-out %$(SHARED_LIBRARY_SUFFIX), $(ALL_LIB_FILES))
# Remove all debug files from the list
ifeq ($(call isTargetOs, macosx), true)
JDK_IMAGE_COPY_LIB_FILES := $(call not-containing, .dSYM, $(JDK_IMAGE_COPY_LIB_FILES))
else
JDK_IMAGE_COPY_LIB_FILES := $(filter-out %.debuginfo %.pdb %.map, $(JDK_IMAGE_COPY_LIB_FILES))
endif

static-jdk-info:
$(call LogWarn, Creating static-jdk image)

$(eval $(call SetupCopyFiles, copy-from-jdk-image, \
SRC := $(JDK_IMAGE_DIR), \
DEST := $(STATIC_JDK_IMAGE_DIR), \
FILES := $(call FindFiles, $(JDK_IMAGE_COPY_FILES)) \
$(JDK_IMAGE_COPY_LIB_FILES), \
))

TARGETS += $(copy-from-jdk-image)

$(copy-from-jdk-image): | static-jdk-info

$(eval $(call SetupCopyFiles, copy-static-launcher, \
FILES := $(JAVA_LAUNCHER), \
DEST := $(STATIC_JDK_IMAGE_DIR)/bin, \
))

TARGETS += $(copy-static-launcher)

$(eval $(call SetupCopyFiles, copy-static-launcher-debuginfo, \
SRC := $(STATIC_LAUNCHER_OUTPUT_DIR), \
DEST := $(STATIC_JDK_IMAGE_DIR)/bin, \
FILES := $(call FindDebuginfoFiles, $(STATIC_LAUNCHER_OUTPUT_DIR)), \
))

TARGETS += $(copy-static-launcher-debuginfo)

static-jdk-image: $(copy-from-jdk-image) $(copy-static-launcher) $(copy-static-launcher-debuginfo)

TARGETS += static-jdk-image

all: $(TARGETS)

.PHONY: all static-launcher static-jdk-image
9 changes: 7 additions & 2 deletions make/autoconf/flags-ldflags.m4
Original file line number Diff line number Diff line change
Expand Up @@ -192,18 +192,23 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_CPU_DEP],
# Export variables according to old definitions, prefix with $2 if present.
LDFLAGS_JDK_COMMON="$BASIC_LDFLAGS $BASIC_LDFLAGS_JDK_ONLY \
$OS_LDFLAGS $DEBUGLEVEL_LDFLAGS_JDK_ONLY ${$2EXTRA_LDFLAGS}"
$2LDFLAGS_JDKLIB="$LDFLAGS_JDK_COMMON $BASIC_LDFLAGS_JDK_LIB_ONLY \
$2LDFLAGS_JDKLIB="$LDFLAGS_JDK_COMMON \
$SHARED_LIBRARY_FLAGS $REPRODUCIBLE_LDFLAGS $FILE_MACRO_LDFLAGS"
$2LDFLAGS_JDKEXE="$LDFLAGS_JDK_COMMON $EXECUTABLE_LDFLAGS \
${$1_CPU_EXECUTABLE_LDFLAGS} $REPRODUCIBLE_LDFLAGS $FILE_MACRO_LDFLAGS"
$2LDFLAGS_STATIC_JDK="$BASIC_LDFLAGS $BASIC_LDFLAGS_JVM_ONLY \
$OS_LDFLAGS ${$2EXTRA_LDFLAGS} $REPRODUCIBLE_LDFLAGS $FILE_MACRO_LDFLAGS"
$2JVM_LDFLAGS="$BASIC_LDFLAGS $BASIC_LDFLAGS_JVM_ONLY $OS_LDFLAGS $OS_LDFLAGS_JVM_ONLY \
$DEBUGLEVEL_LDFLAGS $DEBUGLEVEL_LDFLAGS_JVM_ONLY $BASIC_LDFLAGS_ONLYCXX \
$DEBUGLEVEL_LDFLAGS $DEBUGLEVEL_LDFLAGS_JVM_ONLY \
${$1_CPU_LDFLAGS} ${$1_CPU_LDFLAGS_JVM_ONLY} ${$2EXTRA_LDFLAGS} \
$REPRODUCIBLE_LDFLAGS $FILE_MACRO_LDFLAGS"
AC_SUBST($2LDFLAGS_JDKLIB)
AC_SUBST($2LDFLAGS_JDKEXE)
AC_SUBST($2LDFLAGS_STATIC_JDK)
AC_SUBST($2JVM_LDFLAGS)
])
4 changes: 4 additions & 0 deletions make/autoconf/jdk-options.m4
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE],
CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $GCOV_CFLAGS"
LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $GCOV_LDFLAGS"
LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $GCOV_LDFLAGS"
LDFLAGS_STATIC_JDK="$LDFLAGS_STATIC_JDK $GCOV_LDFLAGS"
])
AC_SUBST(GCOV_ENABLED)
Expand Down Expand Up @@ -463,6 +464,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_ADDRESS_SANITIZER],
CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $ASAN_CFLAGS"
LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $ASAN_LDFLAGS"
LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $ASAN_LDFLAGS"
LDFLAGS_STATIC_JDK="$LDFLAGS_STATIC_JDK $ASAN_LDFLAGS"
])
AC_SUBST(ASAN_ENABLED)
])
Expand Down Expand Up @@ -496,6 +498,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_LEAK_SANITIZER],
CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $LSAN_CFLAGS"
LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $LSAN_LDFLAGS"
LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $LSAN_LDFLAGS"
LDFLAGS_STATIC_JDK="$LDFLAGS_STATIC_JDK $LSAN_LDFLAGS"
])
AC_SUBST(LSAN_ENABLED)
])
Expand Down Expand Up @@ -538,6 +541,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_UNDEFINED_BEHAVIOR_SANITIZER],
CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $UBSAN_CFLAGS"
LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $UBSAN_LDFLAGS"
LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $UBSAN_LDFLAGS"
LDFLAGS_STATIC_JDK="$LDFLAGS_STATIC_JDK $UBSAN_LDFLAGS"
])
if test "x$UBSAN_ENABLED" = xfalse; then
UBSAN_CFLAGS=""
Expand Down
3 changes: 3 additions & 0 deletions make/autoconf/spec.gmk.template
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,9 @@ LDFLAGS_JDKLIB := @LDFLAGS_JDKLIB@
# LDFLAGS used to link the jdk native launchers (C-code)
LDFLAGS_JDKEXE := @LDFLAGS_JDKEXE@

# LDFLAGS used to link the static jdk library
LDFLAGS_STATIC_JDK := @LDFLAGS_STATIC_JDK@

# LDFLAGS specific to C++ linking.
LDFLAGS_CXX_JDK := @LDFLAGS_CXX_JDK@

Expand Down
Loading

0 comments on commit 9ec8a54

Please sign in to comment.