8300592: ASan build does not correctly propagate options to some test launchers
Reviewed-by: ihse
This commit is contained in:
parent
e80b5ea448
commit
edf1e1ab4a
@ -437,7 +437,6 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_ADDRESS_SANITIZER],
|
||||
LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $ASAN_LDFLAGS"
|
||||
LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $ASAN_LDFLAGS"
|
||||
])
|
||||
|
||||
AC_SUBST(ASAN_ENABLED)
|
||||
])
|
||||
|
||||
|
@ -45,6 +45,7 @@ include NativeCompilation.gmk
|
||||
# SOURCE_DIRS A list of source directories to search
|
||||
# OUTPUT_DIR Where to put the resulting files
|
||||
# EXCLUDE A list of filenames to exclude from compilation
|
||||
# EXTRA_FILES List of extra files not in SOURCE_DIRS
|
||||
SetupTestFilesCompilation = $(NamedParamsMacroTemplate)
|
||||
define SetupTestFilesCompilationBody
|
||||
|
||||
@ -93,7 +94,7 @@ define SetupTestFilesCompilationBody
|
||||
$$(eval $$(call SetupNativeCompilation, BUILD_TEST_$$(name), \
|
||||
NAME := $$(unprefixed_name), \
|
||||
TYPE := $$($1_COMPILATION_TYPE), \
|
||||
EXTRA_FILES := $$(file), \
|
||||
EXTRA_FILES := $$(file) $$($1_EXTRA_FILES), \
|
||||
OBJECT_DIR := $$($1_OUTPUT_DIR)/support/$$(name), \
|
||||
OUTPUT_DIR := $$($1_OUTPUT_DIR)/$$($1_OUTPUT_SUBDIR), \
|
||||
CFLAGS := $$($1_BASE_CFLAGS) $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \
|
||||
|
30
make/data/asan/asan_default_options.cpp
Normal file
30
make/data/asan/asan_default_options.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2022, 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.
|
||||
*/
|
||||
|
||||
extern "C" {
|
||||
|
||||
#include "./asan_default_options.c"
|
||||
|
||||
} // extern "C"
|
@ -28,6 +28,10 @@ $(eval $(call IncludeCustomExtension, hotspot/lib/CompileGtest.gmk))
|
||||
GTEST_TEST_SRC += $(TOPDIR)/test/hotspot/gtest
|
||||
GTEST_LAUNCHER_SRC := $(TOPDIR)/test/hotspot/gtest/gtestLauncher.cpp
|
||||
|
||||
ifeq ($(ASAN_ENABLED), true)
|
||||
GTEST_LAUNCHER_SRC += $(TOPDIR)/make/data/asan/asan_default_options.cpp
|
||||
endif
|
||||
|
||||
# On Windows, there are no internal debug symbols so must set copying to true
|
||||
# to get any at all.
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
|
@ -1518,6 +1518,12 @@ else
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libnativeStack += -lpthread
|
||||
endif
|
||||
|
||||
ifeq ($(ASAN_ENABLED), true)
|
||||
# Any executable which launches the JVM and uses a custom launcher needs to explicitly link in the
|
||||
# default ASan options.
|
||||
BUILD_HOTSPOT_JTREG_EXTRA_FILES := $(TOPDIR)/make/data/asan/asan_default_options.c
|
||||
endif
|
||||
|
||||
# This evaluation is expensive and should only be done if this target was
|
||||
# explicitly called.
|
||||
ifneq ($(filter build-test-hotspot-jtreg-native, $(MAKECMDGOALS)), )
|
||||
@ -1533,6 +1539,7 @@ ifneq ($(filter build-test-hotspot-jtreg-native, $(MAKECMDGOALS)), )
|
||||
SOURCE_DIRS := $(BUILD_HOTSPOT_JTREG_NATIVE_SRC), \
|
||||
OUTPUT_DIR := $(BUILD_HOTSPOT_JTREG_OUTPUT_DIR), \
|
||||
EXCLUDE := $(BUILD_HOTSPOT_JTREG_EXCLUDE), \
|
||||
EXTRA_FILES := $(BUILD_HOTSPOT_JTREG_EXTRA_FILES), \
|
||||
))
|
||||
endif
|
||||
|
||||
|
@ -132,6 +132,12 @@ ifeq ($(call isTargetOs, linux), true)
|
||||
BUILD_JDK_JTREG_LIBRARIES_STRIP_SYMBOLS_libFib := false
|
||||
endif
|
||||
|
||||
ifeq ($(ASAN_ENABLED), true)
|
||||
# Any executable which launches the JVM and uses a custom launcher needs to explicitly link in the
|
||||
# default ASan options.
|
||||
BUILD_JDK_JTREG_EXTRA_FILES := $(TOPDIR)/make/data/asan/asan_default_options.c
|
||||
endif
|
||||
|
||||
# This evaluation is expensive and should only be done if this target was
|
||||
# explicitly called.
|
||||
ifneq ($(filter build-test-jdk-jtreg-native, $(MAKECMDGOALS)), )
|
||||
@ -147,6 +153,7 @@ ifneq ($(filter build-test-jdk-jtreg-native, $(MAKECMDGOALS)), )
|
||||
SOURCE_DIRS := $(BUILD_JDK_JTREG_NATIVE_SRC), \
|
||||
OUTPUT_DIR := $(BUILD_JDK_JTREG_OUTPUT_DIR), \
|
||||
EXCLUDE := $(BUILD_JDK_JTREG_EXCLUDE), \
|
||||
EXTRA_FILES := $(BUILD_JDK_JTREG_EXTRA_FILES), \
|
||||
))
|
||||
endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user