2016-04-16 15:03:45 +08:00
|
|
|
@LIT_SITE_CFG_IN_HEADER@
|
2013-06-06 20:35:48 +08:00
|
|
|
|
2014-02-14 17:22:10 +08:00
|
|
|
# Set attribute value if it is unset.
|
|
|
|
def set_default(attr, value):
|
|
|
|
if not getattr(config, attr, None):
|
|
|
|
setattr(config, attr, value)
|
2015-09-09 06:48:35 +08:00
|
|
|
|
2013-06-06 20:35:48 +08:00
|
|
|
# Generic config options for all compiler-rt lit tests.
|
2015-09-09 06:48:35 +08:00
|
|
|
set_default("target_triple", "@COMPILER_RT_DEFAULT_TARGET_TRIPLE@")
|
2014-05-08 03:22:16 +08:00
|
|
|
set_default("target_cflags", "@COMPILER_RT_TEST_COMPILER_CFLAGS@")
|
2014-02-14 17:22:10 +08:00
|
|
|
set_default("host_arch", "@HOST_ARCH@")
|
2015-09-09 06:48:35 +08:00
|
|
|
set_default("target_arch", "@COMPILER_RT_DEFAULT_TARGET_ARCH@")
|
2014-02-14 17:22:10 +08:00
|
|
|
set_default("host_os", "@HOST_OS@")
|
|
|
|
set_default("llvm_build_mode", "@LLVM_BUILD_MODE@")
|
2016-02-02 05:08:16 +08:00
|
|
|
set_default("llvm_src_root", "@LLVM_MAIN_SRC_DIR@")
|
2014-02-14 17:22:10 +08:00
|
|
|
set_default("llvm_obj_root", "@LLVM_BINARY_DIR@")
|
|
|
|
set_default("compiler_rt_src_root", "@COMPILER_RT_SOURCE_DIR@")
|
2014-05-14 06:30:16 +08:00
|
|
|
set_default("compiler_rt_obj_root", "@COMPILER_RT_BINARY_DIR@")
|
2018-06-28 11:11:52 +08:00
|
|
|
set_default("enable_per_target_runtime_dir", @LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_PYBOOL@)
|
2017-11-13 20:57:54 +08:00
|
|
|
set_default("llvm_tools_dir", "@LLVM_TOOLS_DIR@")
|
2016-09-23 04:51:48 +08:00
|
|
|
set_default("llvm_shlib_dir", "@LLVM_LIBRARY_OUTPUT_INTDIR@")
|
2015-02-21 04:31:18 +08:00
|
|
|
set_default("gold_executable", "@GOLD_EXECUTABLE@")
|
2017-11-13 20:57:54 +08:00
|
|
|
set_default("clang", "@COMPILER_RT_RESOLVED_TEST_COMPILER@")
|
2014-02-19 23:13:14 +08:00
|
|
|
set_default("compiler_id", "@COMPILER_RT_TEST_COMPILER_ID@")
|
2014-02-14 17:22:10 +08:00
|
|
|
set_default("python_executable", "@PYTHON_EXECUTABLE@")
|
|
|
|
set_default("compiler_rt_debug", @COMPILER_RT_DEBUG_PYBOOL@)
|
2019-03-08 02:15:23 +08:00
|
|
|
set_default("compiler_rt_intercept_libdispatch", @COMPILER_RT_INTERCEPT_LIBDISPATCH_PYBOOL@)
|
2017-11-13 20:57:54 +08:00
|
|
|
set_default("compiler_rt_libdir", "@COMPILER_RT_RESOLVED_LIBRARY_OUTPUT_DIR@")
|
2014-05-01 05:32:30 +08:00
|
|
|
set_default("emulator", "@COMPILER_RT_EMULATOR@")
|
2017-11-13 22:02:27 +08:00
|
|
|
set_default("asan_shadow_scale", "@COMPILER_RT_ASAN_SHADOW_SCALE@")
|
2018-06-20 22:59:16 +08:00
|
|
|
set_default("apple_platform", "osx")
|
2015-06-25 08:57:42 +08:00
|
|
|
set_default("sanitizer_can_use_cxxabi", @SANITIZER_CAN_USE_CXXABI_PYBOOL@)
|
2017-03-25 08:42:25 +08:00
|
|
|
set_default("has_lld", @COMPILER_RT_HAS_LLD_PYBOOL@)
|
2016-01-23 04:26:10 +08:00
|
|
|
set_default("can_symbolize", @CAN_SYMBOLIZE@)
|
2017-04-22 02:11:23 +08:00
|
|
|
set_default("use_lld", False)
|
|
|
|
set_default("use_thinlto", False)
|
[ubsan] Re-commit: lit changes for lld testing, future lto testing.
Summary:
As discussed in https://github.com/google/oss-fuzz/issues/933,
it would be really awesome to be able to use ThinLTO for fuzzing.
However, as @kcc has pointed out, it is currently undefined (untested)
whether the sanitizers actually function properly with LLD and/or LTO.
This patch is inspired by the cfi test, which already do test with LTO
(and/or LLD), since LTO is required for CFI to function.
I started with UBSan, because it's cmakelists / lit.* files appeared
to be the cleanest. This patch adds the infrastructure to easily add
LLD and/or LTO sub-variants of the existing lit test configurations.
Also, this patch adds the LLD flavor, that explicitly does use LLD to link.
The check-ubsan does pass on my machine. And to minimize the [initial]
potential buildbot breakage i have put some restrictions on this flavour.
Please review carefully, i have not worked with lit/sanitizer tests before.
The original attempt, r319525 was reverted in r319526 due
to the failures in compiler-rt standalone builds.
Reviewers: eugenis, vitalybuka
Reviewed By: eugenis
Subscribers: #sanitizers, pcc, kubamracek, mgorny, llvm-commits, mehdi_amini, inglorion, kcc
Differential Revision: https://reviews.llvm.org/D39508
llvm-svn: 319575
2017-12-02 03:36:29 +08:00
|
|
|
set_default("use_lto", config.use_thinlto)
|
2018-07-19 23:32:48 +08:00
|
|
|
set_default("use_newpm", False)
|
2017-09-16 13:13:56 +08:00
|
|
|
set_default("android", @ANDROID_PYBOOL@)
|
2019-02-05 13:10:19 +08:00
|
|
|
set_default("android_ndk_version", @ANDROID_NDK_VERSION@)
|
2019-01-16 06:06:48 +08:00
|
|
|
set_default("android_serial", "@ANDROID_SERIAL_FOR_TESTING@")
|
|
|
|
set_default("android_files_to_push", [])
|
2019-01-15 03:18:34 +08:00
|
|
|
set_default("have_rpc_xdr_h", @HAVE_RPC_XDR_H@)
|
2019-06-18 01:45:34 +08:00
|
|
|
set_default("gwp_asan", @COMPILER_RT_HAS_GWP_ASAN_PYBOOL@)
|
2019-12-04 06:34:02 +08:00
|
|
|
set_default("expensive_checks", @LLVM_ENABLE_EXPENSIVE_CHECKS_PYBOOL@)
|
2016-08-09 19:50:53 +08:00
|
|
|
config.available_features.add('target-is-%s' % config.target_arch)
|
2013-06-06 20:35:48 +08:00
|
|
|
|
2018-06-28 11:11:52 +08:00
|
|
|
if config.enable_per_target_runtime_dir:
|
|
|
|
set_default("target_suffix", "")
|
|
|
|
else:
|
|
|
|
set_default("target_suffix", "-%s" % config.target_arch)
|
|
|
|
|
2020-01-02 07:01:04 +08:00
|
|
|
set_default("have_zlib", "@LLVM_ENABLE_ZLIB@")
|
Add libc++ to link XRay test cases if libc++ is used to build CLANG
Summary: When libc++ is used to build CLANG, its XRay libraries libclang_rt.xray-*.a have dependencies on libc++. Therefore, libc++ is needed to link and run XRay test cases. For Linux -rpath is also needed to specify where to load libc++. This change sets macro LLVM_LIBCXX_USED to 1 if libc++ is actually used in the build. XRay tests then check the flag and add -L<llvm_shlib_dir> -lc++ and -Wl,-rpath=<llvm_shlib_dir> if needed.
Reviewers: hubert.reinterpretcast, amyk, dberris, jasonliu, sfertile, EricWF
Subscribers: dberris, mgorny, jsji, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61016
llvm-svn: 360060
2019-05-07 01:45:21 +08:00
|
|
|
set_default("libcxx_used", "@LLVM_LIBCXX_USED@")
|
2019-01-29 20:00:01 +08:00
|
|
|
|
2013-06-06 20:35:48 +08:00
|
|
|
# LLVM tools dir can be passed in lit parameters, so try to
|
|
|
|
# apply substitution.
|
|
|
|
try:
|
2013-08-10 06:14:01 +08:00
|
|
|
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
|
2017-11-13 20:57:54 +08:00
|
|
|
config.clang = config.clang % lit_config.params
|
|
|
|
config.compiler_rt_libdir = config.compiler_rt_libdir % lit_config.params
|
2014-12-13 10:46:56 +08:00
|
|
|
except KeyError as e:
|
2013-06-06 20:35:48 +08:00
|
|
|
key, = e.args
|
2013-08-10 06:14:01 +08:00
|
|
|
lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key, key))
|
2013-06-06 20:35:48 +08:00
|
|
|
|
2017-11-13 20:57:54 +08:00
|
|
|
if not os.path.exists(config.clang):
|
|
|
|
lit_config.fatal("Can't find compiler on path %r" % config.clang)
|
|
|
|
|
2013-06-06 20:35:48 +08:00
|
|
|
# Setup attributes common for all compiler-rt projects.
|
2019-06-28 04:56:04 +08:00
|
|
|
lit_config.load_config(config, "@COMPILER_RT_SOURCE_DIR@/test/lit.common.cfg.py")
|