aboutsummaryrefslogtreecommitdiff
path: root/test/cfi/lit.cfg
diff options
context:
space:
mode:
Diffstat (limited to 'test/cfi/lit.cfg')
-rw-r--r--test/cfi/lit.cfg30
1 files changed, 7 insertions, 23 deletions
diff --git a/test/cfi/lit.cfg b/test/cfi/lit.cfg
index d78820daa055..1fa5a1e25137 100644
--- a/test/cfi/lit.cfg
+++ b/test/cfi/lit.cfg
@@ -1,35 +1,19 @@
import lit.formats
import os
-import subprocess
-import sys
config.name = 'cfi'
config.suffixes = ['.cpp']
config.test_source_root = os.path.dirname(__file__)
-def is_darwin_lto_supported():
- return os.path.exists(os.path.join(config.llvm_shlib_dir, 'libLTO.dylib'))
-
-def is_linux_lto_supported():
- if not os.path.exists(os.path.join(config.llvm_shlib_dir, 'LLVMgold.so')):
- return False
-
- ld_cmd = subprocess.Popen([config.gold_executable, '--help'], stdout = subprocess.PIPE)
- ld_out = ld_cmd.stdout.read().decode()
- ld_cmd.wait()
-
- if not '-plugin' in ld_out:
- return False
-
- return True
-
clangxx = ' '.join([config.clang] + config.cxx_mode_flags)
config.substitutions.append((r"%clangxx ", clangxx + ' '))
-
-if sys.platform == 'darwin' and is_darwin_lto_supported():
- config.substitutions.append((r"%clangxx_cfi ", 'env DYLD_LIBRARY_PATH=' + config.llvm_shlib_dir + ' ' + clangxx + ' -fsanitize=cfi '))
-elif sys.platform.startswith('linux') and is_linux_lto_supported():
- config.substitutions.append((r"%clangxx_cfi ", clangxx + ' -fuse-ld=gold -fsanitize=cfi '))
+if config.lto_supported:
+ clangxx_cfi = ' '.join(config.lto_launch + [clangxx] + config.lto_flags + ['-flto -fsanitize=cfi '])
+ config.substitutions.append((r"%clangxx_cfi ", clangxx_cfi))
+ config.substitutions.append((r"%clangxx_cfi_diag ", clangxx_cfi + '-fno-sanitize-trap=cfi -fsanitize-recover=cfi '))
else:
config.unsupported = True
+
+if lit_config.params.get('check_supported', None) and config.unsupported:
+ raise BaseException("Tests unsupported")