Skip to content

Commit 53e5c61

Browse files
committed
Merge a80745d into 5c5434f
2 parents 5c5434f + a80745d commit 53e5c61

File tree

261 files changed

+30287
-2545
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

261 files changed

+30287
-2545
lines changed

make/Docs.gmk

+2-4
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,13 @@ JAVA_WARNINGS_ARE_ERRORS ?= -Werror
107107
JAVADOC_OPTIONS := -use -keywords -notimestamp \
108108
-encoding ISO-8859-1 -docencoding UTF-8 -breakiterator \
109109
-splitIndex --system none -javafx --expand-requires transitive \
110-
--override-methods=summary \
111-
--no-external-specs-page
110+
--override-methods=summary
112111

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

120118
# Should we add DRAFT stamps to the generated javadoc?
121119
ifeq ($(VERSION_IS_GA), true)

make/Images.gmk

-21
Original file line numberDiff line numberDiff line change
@@ -281,27 +281,6 @@ else
281281
endif
282282
CMDS_TARGET_SUBDIR := bin
283283

284-
# Param 1 - dir to find debuginfo files in
285-
FindDebuginfoFiles = \
286-
$(wildcard $(addprefix $1/*, $(DEBUGINFO_SUFFIXES)) \
287-
$(addprefix $1/*/*, $(DEBUGINFO_SUFFIXES)) \
288-
$(addprefix $1/*/*/*, $(DEBUGINFO_SUFFIXES)))
289-
290-
# Pick the correct debug info files to copy, either zipped or not.
291-
ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
292-
DEBUGINFO_SUFFIXES += .diz
293-
else
294-
DEBUGINFO_SUFFIXES := .debuginfo .pdb .map
295-
# On Macosx, if debug symbols have not been zipped, find all files inside *.dSYM
296-
# dirs.
297-
ifeq ($(call isTargetOs, macosx), true)
298-
$(call FillFindCache, \
299-
$(SUPPORT_OUTPUTDIR)/modules_libs $(SUPPORT_OUTPUTDIR)/modules_cmds)
300-
FindDebuginfoFiles = \
301-
$(if $(wildcard $1), $(call containing, .dSYM/, $(call FindFiles, $1)))
302-
endif
303-
endif
304-
305284
# Param 1 - either JDK or JRE
306285
SetupCopyDebuginfo = \
307286
$(foreach m, $(ALL_$1_MODULES), \

make/Main.gmk

+19-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#
2525

2626
# ===========================================================================
27-
# (c) Copyright IBM Corp. 2020, 2023 All Rights Reserved
27+
# (c) Copyright IBM Corp. 2020, 2024 All Rights Reserved
2828
# ===========================================================================
2929

3030
################################################################################
@@ -462,6 +462,18 @@ $(eval $(call SetupTarget, symbols-image, \
462462
TARGET := symbols, \
463463
))
464464

465+
$(eval $(call SetupTarget, static-launcher, \
466+
MAKEFILE := StaticLibs, \
467+
TARGET := static-launcher, \
468+
DEPS := hotspot-static-libs static-libs, \
469+
))
470+
471+
$(eval $(call SetupTarget, static-jdk-image, \
472+
MAKEFILE := StaticLibs, \
473+
TARGET := static-jdk-image, \
474+
DEPS := static-exploded-image jdk-image, \
475+
))
476+
465477
$(eval $(call SetupTarget, static-libs-image, \
466478
MAKEFILE := StaticLibsImage, \
467479
TARGET := static-libs-image, \
@@ -1094,9 +1106,9 @@ else
10941106

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

1097-
static-libs-image: hotspot-static-libs $(STATIC_LIBS_TARGETS)
1109+
static-libs-image: hotspot-static-libs static-libs
10981110

1099-
static-libs-graal-image: $(STATIC_LIBS_TARGETS)
1111+
static-libs-graal-image: static-libs
11001112

11011113
bootcycle-images: jdk-image
11021114

@@ -1262,6 +1274,8 @@ ifeq ($(call isTargetOs, macosx), true)
12621274
legacy-images: mac-legacy-jre-bundle
12631275
endif
12641276

1277+
static-exploded-image: static-launcher exploded-image
1278+
12651279
# These targets build the various documentation images
12661280
docs-jdk-image: docs-jdk
12671281
docs-javase-image: docs-javase
@@ -1304,6 +1318,7 @@ endif
13041318
################################################################################
13051319

13061320
# all-images builds all our deliverables as images.
1321+
# OpenJ9 does not currently support static-jdk-image
13071322
all-images: product-images test-image all-docs-images
13081323

13091324
# all-bundles packages all our deliverables as tar.gz bundles.
@@ -1317,7 +1332,7 @@ ALL_TARGETS += buildtools hotspot hotspot-libs hotspot-static-libs \
13171332
create-buildjdk docs-jdk-api docs-javase-api docs-reference-api docs-jdk \
13181333
docs-javase docs-reference docs-javadoc mac-bundles product-images legacy-images \
13191334
docs-image docs-javase-image docs-reference-image all-docs-images \
1320-
docs-bundles all-docs-bundles test-image all-images \
1335+
docs-bundles all-docs-bundles test-image all-images static-exploded-image \
13211336
all-bundles
13221337

13231338
################################################################################

make/ModuleWrapper.gmk

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,23 @@ TARGETS :=
4545
# Include the file being wrapped.
4646
include $(MAKEFILE_PREFIX).gmk
4747

48+
ifeq ($(MAKEFILE_PREFIX), Lib)
49+
# We need to keep track of what libraries are generated/needed by this
50+
# module. This information is required when doing static linking, to know
51+
# which static library files to include. The variable $(MODULE)_INCLUDED_LIBS is
52+
# added to for each call to SetupJdkLibrary. The file module-included-libs.txt is then
53+
# read in StaticLibs.gmk.
54+
ifneq ($($(MODULE)_JDK_LIBS), )
55+
LIBLIST := $(SUPPORT_OUTPUTDIR)/modules_static-libs/$(MODULE)/module-included-libs.txt
56+
57+
$(LIBLIST): $(TARGETS)
58+
$(call MakeDir, $(@D))
59+
$(ECHO) $($(MODULE)_INCLUDED_LIBS) > $@
60+
61+
TARGETS += $(LIBLIST)
62+
endif
63+
endif
64+
4865
# Setup copy rules from the modules directories to the jdk image directory.
4966
ifeq ($(call isTargetOs, windows), true)
5067
TO_BIN_FILTER := %$(SHARED_LIBRARY_SUFFIX) %.diz %.pdb %.map

make/StaticLibs.gmk

+191
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
#
2+
# Copyright (c) 2024, 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+
default: all
27+
28+
include $(SPEC)
29+
include MakeBase.gmk
30+
31+
include CopyFiles.gmk
32+
include Modules.gmk
33+
include modules/LauncherCommon.gmk
34+
35+
################################################################################
36+
#
37+
# Create the static java launcher
38+
#
39+
################################################################################
40+
41+
STATIC_JDK_IMAGE_DIR := $(IMAGES_OUTPUTDIR)/static-jdk
42+
STATIC_LAUNCHER_OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/static-native/launcher
43+
HOTSPOT_STATIC_LIB_PATH := $(HOTSPOT_OUTPUTDIR)/*/libjvm/objs/static
44+
45+
ifneq ($(word 2, $(wildcard $(HOTSPOT_STATIC_LIB_PATH))), )
46+
$(error Cannot perform static linking when building more than one JVM library)
47+
endif
48+
49+
# Find all modules with static libraries
50+
STATIC_LIB_MODULES := $(patsubst $(SUPPORT_OUTPUTDIR)/modules_static-libs/%, \
51+
%, $(wildcard $(SUPPORT_OUTPUTDIR)/modules_static-libs/*))
52+
53+
# Filter out known broken libraries. This is a temporary measure until
54+
# proper support for these libraries can be provided.
55+
ifeq ($(call isTargetOs, linux), true)
56+
# libsplashscreen has a name conflict with libawt in the function
57+
# BitmapToYXBandedRectangles, so we exclude it for now.
58+
BROKEN_STATIC_LIBS += splashscreen
59+
else ifeq ($(call isTargetOs, macosx), true)
60+
# libosxsecurity has a name conflict with libosxapp in the function
61+
# JavaStringToNSString, so we exclude it for now.
62+
BROKEN_STATIC_LIBS += osxsecurity
63+
else ifeq ($(call isTargetOs, windows), true)
64+
# libsplashscreen has a name conflict with libawt in the function
65+
# BitmapToYXBandedRectangles, so we exclude it for now.
66+
BROKEN_STATIC_LIBS += splashscreen
67+
# libsspi_bridge has name conflicts with sunmscapi
68+
BROKEN_STATIC_LIBS += sspi_bridge
69+
# These libs define DllMain which conflict with Hotspot
70+
BROKEN_STATIC_LIBS += awt dt_shmem dt_socket
71+
# These libs are dependent on any of the above disabled libs
72+
BROKEN_STATIC_LIBS += fontmanager jawt lcms net nio
73+
endif
74+
75+
$(foreach module, $(STATIC_LIB_MODULES), \
76+
$(eval LIBS_$(module) := $(filter-out $(BROKEN_STATIC_LIBS), $(shell cat \
77+
$(SUPPORT_OUTPUTDIR)/modules_static-libs/$(module)/module-included-libs.txt))) \
78+
)
79+
80+
STATIC_LIB_FILES := $(foreach module, $(STATIC_LIB_MODULES), \
81+
$(foreach lib, $(LIBS_$(module)), \
82+
$(SUPPORT_OUTPUTDIR)/native/$(module)/lib$(lib)/static/$(LIBRARY_PREFIX)$(lib)$(STATIC_LIBRARY_SUFFIX)))
83+
84+
# Add Hotspot
85+
STATIC_LIB_FILES += $(wildcard $(HOTSPOT_STATIC_LIB_PATH)/$(LIBRARY_PREFIX)jvm$(STATIC_LIBRARY_SUFFIX))
86+
87+
# Figure out what external libraries are required to link these static JDK
88+
# libraries.
89+
LIB_FLAGS_FILES := $(addsuffix .lib-flags.txt, $(STATIC_LIB_FILES))
90+
91+
# Gather the lib flags from all individual libraries. There are many duplicates,
92+
# so sort and just keep unique instances. On macOS, a common pattern is
93+
# "-framework FooFramework", so we must make sure we keep the two words together.
94+
EXTERNAL_LIBS := $(strip $(shell $(CAT) $(LIB_FLAGS_FILES) | \
95+
$(SED) -e 's/-framework /-framework_/g' | $(TR) ' ' '\n' | $(SORT) -u | \
96+
$(SED) -e 's/-framework_/-framework /g'))
97+
98+
ifeq ($(call isTargetOs, macosx), true)
99+
STATIC_LIBS := $(addprefix -force_load$(SPACE), $(STATIC_LIB_FILES))
100+
STANDARD_LIBS += -lstdc++
101+
else ifeq ($(call isTargetOs, linux), true)
102+
STATIC_LIBS := -Wl,--export-dynamic -Wl,--whole-archive $(STATIC_LIB_FILES) -Wl,--no-whole-archive
103+
STANDARD_LIBS := -l:libstdc++.a
104+
else ifeq ($(call isTargetOs, windows), true)
105+
STATIC_LIBS := $(addprefix -wholearchive:, $(STATIC_LIB_FILES))
106+
else
107+
$(error Unsupported platform)
108+
endif
109+
110+
$(eval $(call SetupBuildLauncher, java, \
111+
CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES, \
112+
EXTRA_RCFLAGS := $(JAVA_RCFLAGS), \
113+
VERSION_INFO_RESOURCE := $(JAVA_VERSION_INFO_RESOURCE), \
114+
OPTIMIZATION := HIGH, \
115+
STATIC_LAUNCHER := true, \
116+
LDFLAGS := $(LDFLAGS_STATIC_JDK), \
117+
LIBS := $(STATIC_LIBS) $(EXTERNAL_LIBS) $(STANDARD_LIBS), \
118+
OUTPUT_DIR := $(STATIC_LAUNCHER_OUTPUT_DIR), \
119+
OBJECT_DIR := $(STATIC_LAUNCHER_OUTPUT_DIR), \
120+
))
121+
122+
$(java): $(STATIC_LIB_FILES)
123+
124+
TARGETS += $(java)
125+
126+
JAVA_LAUNCHER := $(BUILD_LAUNCHER_java_TARGET)
127+
128+
static-launcher: $(java)
129+
130+
################################################################################
131+
#
132+
# Create the static-jdk image with the statically built java launcher
133+
#
134+
################################################################################
135+
136+
# Until we get proper support in jlink for generating an image with static
137+
# builds, we need to create the image ourselves. We base it on a normal
138+
# dynamically linked JDK image.
139+
140+
# All these files/dirs should be copied as-is
141+
JDK_IMAGE_COPY_FILES := $(addprefix $(JDK_IMAGE_DIR)/, conf demo include jmods \
142+
legal man/man1/java.1 release README)
143+
144+
# We need to copy some files from lib, but not the dynamic libraries themselves
145+
ALL_LIB_FILES := $(call FindFiles, $(JDK_IMAGE_DIR)/lib)
146+
147+
# Remove all dynamic libraries from the list
148+
JDK_IMAGE_COPY_LIB_FILES := $(filter-out %$(SHARED_LIBRARY_SUFFIX), $(ALL_LIB_FILES))
149+
# Remove all debug files from the list
150+
ifeq ($(call isTargetOs, macosx), true)
151+
JDK_IMAGE_COPY_LIB_FILES := $(call not-containing, .dSYM, $(JDK_IMAGE_COPY_LIB_FILES))
152+
else
153+
JDK_IMAGE_COPY_LIB_FILES := $(filter-out %.debuginfo %.pdb %.map, $(JDK_IMAGE_COPY_LIB_FILES))
154+
endif
155+
156+
static-jdk-info:
157+
$(call LogWarn, Creating static-jdk image)
158+
159+
$(eval $(call SetupCopyFiles, copy-from-jdk-image, \
160+
SRC := $(JDK_IMAGE_DIR), \
161+
DEST := $(STATIC_JDK_IMAGE_DIR), \
162+
FILES := $(call FindFiles, $(JDK_IMAGE_COPY_FILES)) \
163+
$(JDK_IMAGE_COPY_LIB_FILES), \
164+
))
165+
166+
TARGETS += $(copy-from-jdk-image)
167+
168+
$(copy-from-jdk-image): | static-jdk-info
169+
170+
$(eval $(call SetupCopyFiles, copy-static-launcher, \
171+
FILES := $(JAVA_LAUNCHER), \
172+
DEST := $(STATIC_JDK_IMAGE_DIR)/bin, \
173+
))
174+
175+
TARGETS += $(copy-static-launcher)
176+
177+
$(eval $(call SetupCopyFiles, copy-static-launcher-debuginfo, \
178+
SRC := $(STATIC_LAUNCHER_OUTPUT_DIR), \
179+
DEST := $(STATIC_JDK_IMAGE_DIR)/bin, \
180+
FILES := $(call FindDebuginfoFiles, $(STATIC_LAUNCHER_OUTPUT_DIR)), \
181+
))
182+
183+
TARGETS += $(copy-static-launcher-debuginfo)
184+
185+
static-jdk-image: $(copy-from-jdk-image) $(copy-static-launcher) $(copy-static-launcher-debuginfo)
186+
187+
TARGETS += static-jdk-image
188+
189+
all: $(TARGETS)
190+
191+
.PHONY: all static-launcher static-jdk-image

make/autoconf/flags-ldflags.m4

+7-2
Original file line numberDiff line numberDiff line change
@@ -209,18 +209,23 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_CPU_DEP],
209209
# Export variables according to old definitions, prefix with $2 if present.
210210
LDFLAGS_JDK_COMMON="$BASIC_LDFLAGS $BASIC_LDFLAGS_JDK_ONLY \
211211
$OS_LDFLAGS $DEBUGLEVEL_LDFLAGS_JDK_ONLY ${$2EXTRA_LDFLAGS}"
212-
$2LDFLAGS_JDKLIB="$LDFLAGS_JDK_COMMON $BASIC_LDFLAGS_JDK_LIB_ONLY \
212+
$2LDFLAGS_JDKLIB="$LDFLAGS_JDK_COMMON \
213213
$SHARED_LIBRARY_FLAGS $REPRODUCIBLE_LDFLAGS $FILE_MACRO_LDFLAGS"
214214
$2LDFLAGS_JDKEXE="$LDFLAGS_JDK_COMMON $EXECUTABLE_LDFLAGS \
215215
${$1_CPU_EXECUTABLE_LDFLAGS} $REPRODUCIBLE_LDFLAGS $FILE_MACRO_LDFLAGS"
216216
217+
$2LDFLAGS_STATIC_JDK="$BASIC_LDFLAGS $BASIC_LDFLAGS_JVM_ONLY \
218+
$OS_LDFLAGS ${$2EXTRA_LDFLAGS} $REPRODUCIBLE_LDFLAGS $FILE_MACRO_LDFLAGS"
219+
217220
$2JVM_LDFLAGS="$BASIC_LDFLAGS $BASIC_LDFLAGS_JVM_ONLY $OS_LDFLAGS $OS_LDFLAGS_JVM_ONLY \
218-
$DEBUGLEVEL_LDFLAGS $DEBUGLEVEL_LDFLAGS_JVM_ONLY $BASIC_LDFLAGS_ONLYCXX \
221+
$DEBUGLEVEL_LDFLAGS $DEBUGLEVEL_LDFLAGS_JVM_ONLY \
219222
${$1_CPU_LDFLAGS} ${$1_CPU_LDFLAGS_JVM_ONLY} ${$2EXTRA_LDFLAGS} \
220223
$REPRODUCIBLE_LDFLAGS $FILE_MACRO_LDFLAGS"
221224
222225
AC_SUBST($2LDFLAGS_JDKLIB)
223226
AC_SUBST($2LDFLAGS_JDKEXE)
224227
228+
AC_SUBST($2LDFLAGS_STATIC_JDK)
229+
225230
AC_SUBST($2JVM_LDFLAGS)
226231
])

make/autoconf/jdk-options.m4

+4
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE],
362362
CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $GCOV_CFLAGS"
363363
LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $GCOV_LDFLAGS"
364364
LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $GCOV_LDFLAGS"
365+
LDFLAGS_STATIC_JDK="$LDFLAGS_STATIC_JDK $GCOV_LDFLAGS"
365366
])
366367
AC_SUBST(GCOV_ENABLED)
367368
@@ -456,6 +457,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_ADDRESS_SANITIZER],
456457
CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $ASAN_CFLAGS"
457458
LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $ASAN_LDFLAGS"
458459
LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $ASAN_LDFLAGS"
460+
LDFLAGS_STATIC_JDK="$LDFLAGS_STATIC_JDK $ASAN_LDFLAGS"
459461
])
460462
AC_SUBST(ASAN_ENABLED)
461463
])
@@ -489,6 +491,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_LEAK_SANITIZER],
489491
CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $LSAN_CFLAGS"
490492
LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $LSAN_LDFLAGS"
491493
LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $LSAN_LDFLAGS"
494+
LDFLAGS_STATIC_JDK="$LDFLAGS_STATIC_JDK $LSAN_LDFLAGS"
492495
])
493496
AC_SUBST(LSAN_ENABLED)
494497
])
@@ -531,6 +534,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_UNDEFINED_BEHAVIOR_SANITIZER],
531534
CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $UBSAN_CFLAGS"
532535
LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $UBSAN_LDFLAGS"
533536
LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $UBSAN_LDFLAGS"
537+
LDFLAGS_STATIC_JDK="$LDFLAGS_STATIC_JDK $UBSAN_LDFLAGS"
534538
])
535539
if test "x$UBSAN_ENABLED" = xfalse; then
536540
UBSAN_CFLAGS=""

0 commit comments

Comments
 (0)