diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2017-12-01 19:36:29 +0000 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2017-12-01 19:36:29 +0000 |
commit | d45054dbd2dd051bd72a48fef137d48c4ca06588 (patch) | |
tree | 75dcd42746f8eefdcce5451062263f56ac06eeb2 /compiler-rt/test/cfi | |
parent | 7edff4789911a9343973cf5da069e746c9d9885e (diff) | |
download | bcm5719-llvm-d45054dbd2dd051bd72a48fef137d48c4ca06588.tar.gz bcm5719-llvm-d45054dbd2dd051bd72a48fef137d48c4ca06588.zip |
[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
Diffstat (limited to 'compiler-rt/test/cfi')
-rw-r--r-- | compiler-rt/test/cfi/lit.cfg | 9 | ||||
-rw-r--r-- | compiler-rt/test/cfi/lit.site.cfg.in | 1 |
2 files changed, 7 insertions, 3 deletions
diff --git a/compiler-rt/test/cfi/lit.cfg b/compiler-rt/test/cfi/lit.cfg index 7dae9a0d5a7..cbffe6ea8a6 100644 --- a/compiler-rt/test/cfi/lit.cfg +++ b/compiler-rt/test/cfi/lit.cfg @@ -5,13 +5,16 @@ config.name = 'cfi' + config.name_suffix config.suffixes = ['.c', '.cpp', '.test'] config.test_source_root = os.path.dirname(__file__) -clang = ' '.join([config.compile_wrapper, config.clang, config.target_cflags]) -clangxx = ' '.join([config.compile_wrapper, config.clang, config.target_cflags] + config.cxx_mode_flags) +def build_invocation(compile_flags): + return " " + " ".join([config.clang] + compile_flags) + " " + +clang = build_invocation([config.target_cflags]) +clangxx = build_invocation([config.target_cflags] + config.cxx_mode_flags) config.substitutions.append((r"%clang ", clang + ' ')) config.substitutions.append((r"%clangxx ", clangxx + ' ')) if config.lto_supported: - clang_cfi = ' '.join(config.lto_launch + [clang] + config.lto_flags + ['-fsanitize=cfi ']) + clang_cfi = clang + '-fsanitize=cfi ' if config.cfi_lit_test_mode == "Devirt": config.available_features.add('devirt') diff --git a/compiler-rt/test/cfi/lit.site.cfg.in b/compiler-rt/test/cfi/lit.site.cfg.in index 066c915efb7..eb9b44137fd 100644 --- a/compiler-rt/test/cfi/lit.site.cfg.in +++ b/compiler-rt/test/cfi/lit.site.cfg.in @@ -5,6 +5,7 @@ config.cfi_lit_test_mode = "@CFI_LIT_TEST_MODE@" config.target_arch = "@CFI_TEST_TARGET_ARCH@" config.target_cflags = "@CFI_TEST_TARGET_CFLAGS@" config.use_lld = @CFI_TEST_USE_LLD@ +config.use_lto = True # CFI *requires* LTO. config.use_thinlto = @CFI_TEST_USE_THINLTO@ lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured") |