Skip to content

Commit b1a571e

Browse files
committed
Merge
2 parents ea5c4ce + 638d612 commit b1a571e

File tree

454 files changed

+12745
-6482
lines changed

Some content is hidden

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

454 files changed

+12745
-6482
lines changed

make/autoconf/configure.ac

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ JDKOPT_SETUP_ADDRESS_SANITIZER
219219
# UndefinedBehaviorSanitizer
220220
JDKOPT_SETUP_UNDEFINED_BEHAVIOR_SANITIZER
221221

222+
# LeakSanitizer
223+
JDKOPT_SETUP_LEAK_SANITIZER
224+
222225
###############################################################################
223226
#
224227
# Check dependencies for external and internal libraries.

make/autoconf/jdk-options.m4

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,39 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_ADDRESS_SANITIZER],
440440
AC_SUBST(ASAN_ENABLED)
441441
])
442442

443+
###############################################################################
444+
#
445+
# LeakSanitizer
446+
#
447+
AC_DEFUN_ONCE([JDKOPT_SETUP_LEAK_SANITIZER],
448+
[
449+
UTIL_ARG_ENABLE(NAME: lsan, DEFAULT: false, RESULT: LSAN_ENABLED,
450+
DESC: [enable LeakSanitizer],
451+
CHECK_AVAILABLE: [
452+
AC_MSG_CHECKING([if LeakSanitizer (lsan) is available])
453+
if test "x$TOOLCHAIN_TYPE" = "xgcc" ||
454+
test "x$TOOLCHAIN_TYPE" = "xclang"; then
455+
AC_MSG_RESULT([yes])
456+
else
457+
AC_MSG_RESULT([no])
458+
AVAILABLE=false
459+
fi
460+
],
461+
IF_ENABLED: [
462+
LSAN_CFLAGS="-fsanitize=leak -fno-omit-frame-pointer -DLEAK_SANITIZER"
463+
LSAN_LDFLAGS="-fsanitize=leak"
464+
JVM_CFLAGS="$JVM_CFLAGS $LSAN_CFLAGS"
465+
JVM_LDFLAGS="$JVM_LDFLAGS $LSAN_LDFLAGS"
466+
CFLAGS_JDKLIB="$CFLAGS_JDKLIB $LSAN_CFLAGS"
467+
CFLAGS_JDKEXE="$CFLAGS_JDKEXE $LSAN_CFLAGS"
468+
CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $LSAN_CFLAGS"
469+
CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $LSAN_CFLAGS"
470+
LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $LSAN_LDFLAGS"
471+
LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $LSAN_LDFLAGS"
472+
])
473+
AC_SUBST(LSAN_ENABLED)
474+
])
475+
443476
###############################################################################
444477
#
445478
# UndefinedBehaviorSanitizer

make/autoconf/spec.gmk.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,9 @@ JCOV_FILTERS=@JCOV_FILTERS@
448448
# AddressSanitizer
449449
ASAN_ENABLED:=@ASAN_ENABLED@
450450

451+
# LeakSanitizer
452+
LSAN_ENABLED:=@LSAN_ENABLED@
453+
451454
# UndefinedBehaviorSanitizer
452455
UBSAN_ENABLED:=@UBSAN_ENABLED@
453456
UBSAN_CFLAGS:=@UBSAN_CFLAGS@

make/common/modules/LauncherCommon.gmk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ define SetupBuildLauncherBody
150150
$1_EXTRA_FILES += $(TOPDIR)/make/data/asan/asan_default_options.c
151151
endif
152152

153+
ifeq ($(LSAN_ENABLED), true)
154+
$1_EXTRA_FILES += $(TOPDIR)/make/data/lsan/lsan_default_options.c
155+
endif
156+
153157
$$(eval $$(call SetupJdkExecutable, BUILD_LAUNCHER_$1, \
154158
NAME := $1, \
155159
EXTRA_FILES := $$($1_EXTRA_FILES), \

make/conf/jib-profiles.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,20 @@ var getJibProfilesProfiles = function (input, common, data) {
10101010
};
10111011
profiles["run-test"] = concatObjects(profiles["run-test"], macosxRunTestExtra);
10121012
profiles["run-test-prebuilt"] = concatObjects(profiles["run-test-prebuilt"], macosxRunTestExtra);
1013+
} else if (input.build_os == "windows") {
1014+
// On windows, add the devkit debugger to the path in all the run-test profiles
1015+
// to make them available to the jtreg failure handler.
1016+
var archDir = "x64";
1017+
if (input.build_arch == "aarch64") {
1018+
archDir = "arm64"
1019+
}
1020+
windowsRunTestExtra = {
1021+
environment_path: [
1022+
input.get("devkit", "install_path") + "/10/Debuggers/" + archDir
1023+
]
1024+
}
1025+
profiles["run-test"] = concatObjects(profiles["run-test"], windowsRunTestExtra);
1026+
profiles["run-test-prebuilt"] = concatObjects(profiles["run-test-prebuilt"], windowsRunTestExtra);
10131027
}
10141028

10151029
// The profile run-test-prebuilt defines src.conf as the src bundle. When
@@ -1051,7 +1065,7 @@ var getJibProfilesDependencies = function (input, common) {
10511065
var devkit_platform_revisions = {
10521066
linux_x64: "gcc11.2.0-OL6.4+1.0",
10531067
macosx: "Xcode12.4+1.1",
1054-
windows_x64: "VS2022-17.1.0+1.0",
1068+
windows_x64: "VS2022-17.1.0+1.1",
10551069
linux_aarch64: "gcc11.2.0-OL7.6+1.0",
10561070
linux_arm: "gcc8.2.0-Fedora27+1.0",
10571071
linux_ppc64le: "gcc8.2.0-Fedora27+1.0",

make/data/asan/asan_default_options.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2023, Google 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
@@ -50,8 +50,16 @@
5050
// used. You can override these options by setting the environment variable ASAN_OPTIONS.
5151
ATTRIBUTE_DEFAULT_VISIBILITY ATTRIBUTE_USED const char* __asan_default_options() {
5252
return
53-
#ifndef LEAK_SANITIZER
53+
#ifdef LEAK_SANITIZER
54+
"leak_check_at_exit=0,"
55+
#else
56+
// ASan bundles LSan, however we only support LSan when it is explicitly requested during
57+
// configuration. Thus we disable it to match if it was not requested.
5458
"detect_leaks=0,"
5559
#endif
56-
"handle_segv=0";
60+
"print_suppressions=0,"
61+
"handle_segv=0,"
62+
// See https://github.com/google/sanitizers/issues/1322. Hopefully this is resolved
63+
// at some point and we can remove this option.
64+
"intercept_tls_get_addr=0";
5765
}

make/data/asan/asan_default_options.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2023, Google 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
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Copyright (c) 2023, Google 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+
#ifndef LEAK_SANITIZER
27+
#error "Build misconfigured, preprocessor macro LEAK_SANITIZER should be defined"
28+
#endif
29+
30+
#ifndef __has_attribute
31+
#define __has_attribute(x) 0
32+
#endif
33+
34+
#if (defined(__GNUC__) && !defined(__clang__)) || __has_attribute(visibility)
35+
#define ATTRIBUTE_DEFAULT_VISIBILITY __attribute__((visibility("default")))
36+
#else
37+
#define ATTRIBUTE_DEFAULT_VISIBILITY
38+
#endif
39+
40+
#if (defined(__GNUC__) && !defined(__clang__)) || __has_attribute(used)
41+
#define ATTRIBUTE_USED __attribute__((used))
42+
#else
43+
#define ATTRIBUTE_USED
44+
#endif
45+
46+
// Override weak symbol exposed by LSan to override default options. This is called by LSan
47+
// extremely early during library loading, before main is called. We need to override the default
48+
// options because LSan will perform leak checking at program exit. Unfortunately Hotspot does not
49+
// shutdown cleanly at the moment and some leaks occur, we want to ignore these. Instead we
50+
// explicitly perform leak checking early during JVM shutdown.
51+
ATTRIBUTE_DEFAULT_VISIBILITY ATTRIBUTE_USED const char* __lsan_default_options() {
52+
return
53+
"print_suppressions=0,"
54+
"leak_check_at_exit=0,"
55+
// See https://github.com/google/sanitizers/issues/1322. Hopefully this is resolved
56+
// at some point and we can remove this option.
57+
"intercept_tls_get_addr=0";
58+
}
59+
60+
// Override weak symbol exposed by LSan to override default suppressions. This is called by LSan
61+
// extremely early during library loading, before main is called.
62+
ATTRIBUTE_DEFAULT_VISIBILITY ATTRIBUTE_USED const char* __lsan_default_suppressions() {
63+
return
64+
// Remove after JDK-8297688 is resolved.
65+
"leak:^JLI_MemAlloc$\n"
66+
"leak:^JLI_StringDup$\n";
67+
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
/*
2-
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2023, Google 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
66
* under the terms of the GNU General Public License version 2 only, as
7-
* published by the Free Software Foundation.
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.
810
*
911
* This code is distributed in the hope that it will be useful, but WITHOUT
1012
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -21,13 +23,8 @@
2123
* questions.
2224
*/
2325

24-
#include "native_thread.cpp"
25-
#include "nsk_tools.cpp"
26-
#include "jni_tools.cpp"
27-
#include "jvmti_tools.cpp"
28-
#include "agent_tools.cpp"
29-
#include "jvmti_FollowRefObjects.cpp"
30-
#include "Injector.cpp"
31-
#include "JVMTITools.cpp"
32-
#include "agent_common.cpp"
33-
#include "allthr002.cpp"
26+
extern "C" {
27+
28+
#include "./lsan_default_options.c"
29+
30+
} // extern "C"

make/devkit/createWindowsDevkit.sh

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
#
3-
# Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
3+
# Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
44
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
#
66
# This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,12 @@
2626

2727
# This script copies parts of a Visual Studio installation into a devkit
2828
# suitable for building OpenJDK and OracleJDK. Needs to run in Cygwin or WSL.
29+
#
30+
# To include the debugger tools for the jtreg failure_handler, those need to
31+
# be explicitly added to the Windows SDK installation first. That is done
32+
# through Windows Settings - Apps, find the Windows Software Development Kit
33+
# installation, click modify, and add the debugger tools.
34+
#
2935
# erik.joelsson@oracle.com
3036

3137
usage_and_exit() {
@@ -197,6 +203,17 @@ mkdir -p $DEVKIT_ROOT/$SDK_VERSION/Redist
197203
cp -r "$SDK_INSTALL_DIR/Redist/$UCRT_VERSION/ucrt" $DEVKIT_ROOT/$SDK_VERSION/Redist/
198204
mkdir -p $DEVKIT_ROOT/$SDK_VERSION/include
199205
cp -r "$SDK_INSTALL_DIR/include/$SDK_FULL_VERSION/"* $DEVKIT_ROOT/$SDK_VERSION/include/
206+
if [ -d "$SDK_INSTALL_DIR/Debuggers" ]; then
207+
mkdir -p $DEVKIT_ROOT/$SDK_VERSION/Debuggers/lib
208+
cp -r "$SDK_INSTALL_DIR/Debuggers/arm64" $DEVKIT_ROOT/$SDK_VERSION/Debuggers/
209+
cp -r "$SDK_INSTALL_DIR/Debuggers/x64" $DEVKIT_ROOT/$SDK_VERSION/Debuggers/
210+
cp -r "$SDK_INSTALL_DIR/Debuggers/x86" $DEVKIT_ROOT/$SDK_VERSION/Debuggers/
211+
cp -r "$SDK_INSTALL_DIR/Debuggers/lib/arm64" $DEVKIT_ROOT/$SDK_VERSION/Debuggers/lib/
212+
cp -r "$SDK_INSTALL_DIR/Debuggers/lib/x64" $DEVKIT_ROOT/$SDK_VERSION/Debuggers/lib/
213+
cp -r "$SDK_INSTALL_DIR/Debuggers/lib/x86" $DEVKIT_ROOT/$SDK_VERSION/Debuggers/lib/
214+
else
215+
echo "No SDK debuggers found, skipping"
216+
fi
200217

201218
################################################################################
202219
# Generate devkit.info
@@ -211,22 +228,22 @@ echo-info "# This file describes to configure how to interpret the contents of t
211228
echo-info "DEVKIT_NAME=\"Microsoft Visual Studio $VS_VERSION $VS_VERSION_SP (devkit)\""
212229
echo-info "DEVKIT_VS_VERSION=\"$VS_VERSION\""
213230
echo-info ""
214-
echo-info "DEVKIT_TOOLCHAIN_PATH_x86=\"\$DEVKIT_ROOT/VC/bin/x86:\$DEVKIT_ROOT/$SDK_VERSION/bin/x86\""
231+
echo-info "DEVKIT_TOOLCHAIN_PATH_x86=\"\$DEVKIT_ROOT/VC/bin/x86:\$DEVKIT_ROOT/$SDK_VERSION/bin/x86:\$DEVKIT_ROOT/$SDK_VERSION/Debuggers/x86\""
215232
echo-info "DEVKIT_VS_INCLUDE_x86=\"\$DEVKIT_ROOT/VC/include;\$DEVKIT_ROOT/VC/atlmfc/include;\$DEVKIT_ROOT/$SDK_VERSION/include/shared;\$DEVKIT_ROOT/$SDK_VERSION/include/ucrt;\$DEVKIT_ROOT/$SDK_VERSION/include/um;\$DEVKIT_ROOT/$SDK_VERSION/include/winrt\""
216233
echo-info "DEVKIT_VS_LIB_x86=\"\$DEVKIT_ROOT/VC/lib/x86;\$DEVKIT_ROOT/VC/atlmfc/lib/x86;\$DEVKIT_ROOT/$SDK_VERSION/lib/x86\""
217234
echo-info "DEVKIT_MSVCR_DLL_x86=\"\$DEVKIT_ROOT/VC/redist/x86/$MSVCR_DLL\""
218235
echo-info "DEVKIT_MSVCP_DLL_x86=\"\$DEVKIT_ROOT/VC/redist/x86/$MSVCP_DLL\""
219236
echo-info "DEVKIT_UCRT_DLL_DIR_x86=\"\$DEVKIT_ROOT/10/Redist/ucrt/DLLs/x86\""
220237
echo-info ""
221-
echo-info "DEVKIT_TOOLCHAIN_PATH_x86_64=\"\$DEVKIT_ROOT/VC/bin/x64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x86\""
238+
echo-info "DEVKIT_TOOLCHAIN_PATH_x86_64=\"\$DEVKIT_ROOT/VC/bin/x64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x86:\$DEVKIT_ROOT/$SDK_VERSION/Debuggers/x64\""
222239
echo-info "DEVKIT_VS_INCLUDE_x86_64=\"\$DEVKIT_ROOT/VC/include;\$DEVKIT_ROOT/VC/atlmfc/include;\$DEVKIT_ROOT/$SDK_VERSION/include/shared;\$DEVKIT_ROOT/$SDK_VERSION/include/ucrt;\$DEVKIT_ROOT/$SDK_VERSION/include/um;\$DEVKIT_ROOT/$SDK_VERSION/include/winrt\""
223240
echo-info "DEVKIT_VS_LIB_x86_64=\"\$DEVKIT_ROOT/VC/lib/x64;\$DEVKIT_ROOT/VC/atlmfc/lib/x64;\$DEVKIT_ROOT/$SDK_VERSION/lib/x64\""
224241
echo-info "DEVKIT_MSVCR_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$MSVCR_DLL\""
225242
echo-info "DEVKIT_VCRUNTIME_1_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$VCRUNTIME_1_DLL\""
226243
echo-info "DEVKIT_MSVCP_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$MSVCP_DLL\""
227244
echo-info "DEVKIT_UCRT_DLL_DIR_x86_64=\"\$DEVKIT_ROOT/10/Redist/ucrt/DLLs/x64\""
228245
echo-info ""
229-
echo-info "DEVKIT_TOOLCHAIN_PATH_aarch64=\"\$DEVKIT_ROOT/VC/bin/arm64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x86\""
246+
echo-info "DEVKIT_TOOLCHAIN_PATH_aarch64=\"\$DEVKIT_ROOT/VC/bin/arm64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x86:\$DEVKIT_ROOT/$SDK_VERSION/Debuggers/arm64\""
230247
echo-info "DEVKIT_VS_INCLUDE_aarch64=\"\$DEVKIT_ROOT/VC/include;\$DEVKIT_ROOT/VC/atlmfc/include;\$DEVKIT_ROOT/$SDK_VERSION/include/shared;\$DEVKIT_ROOT/$SDK_VERSION/include/ucrt;\$DEVKIT_ROOT/$SDK_VERSION/include/um;\$DEVKIT_ROOT/$SDK_VERSION/include/winrt\""
231248
echo-info "DEVKIT_VS_LIB_aarch64=\"\$DEVKIT_ROOT/VC/lib/arm64;\$DEVKIT_ROOT/VC/atlmfc/lib/arm64;\$DEVKIT_ROOT/$SDK_VERSION/lib/arm64\""
232249
echo-info "DEVKIT_MSVCR_DLL_aarch64=\"\$DEVKIT_ROOT/VC/redist/arm64/$MSVCR_DLL\""

0 commit comments

Comments
 (0)