xref: /llvm-project/compiler-rt/test/safestack/lit.cfg.py (revision 3a7c187031ea4999e426565fa53282cf536158dd)
1# -*- Python -*-
2
3import os
4
5# Setup config name.
6config.name = "SafeStack-" + config.name_suffix
7
8# Setup source root.
9config.test_source_root = os.path.dirname(__file__)
10
11# Test suffixes.
12config.suffixes = [".c", ".cpp", ".m", ".mm", ".ll", ".test"]
13
14# Add clang substitutions.
15config.substitutions.append(
16    (
17        "%clang_nosafestack ",
18        config.clang + config.target_cflags + " -O0 -fno-sanitize=safe-stack ",
19    )
20)
21config.substitutions.append(
22    (
23        "%clang_safestack ",
24        config.clang + config.target_cflags + " -O0 -fsanitize=safe-stack ",
25    )
26)
27
28if config.lto_supported:
29    config.substitutions.append(
30        (
31            r"%clang_lto_safestack ",
32            " ".join([config.clang] + config.lto_flags + ["-fsanitize=safe-stack "]),
33        )
34    )
35
36if config.host_os not in ["Linux", "FreeBSD", "NetBSD", "SunOS"]:
37    config.unsupported = True
38