1 import lit.formats 2 import os 3 4 config.name = 'cfi' 5 config.suffixes = ['.c', '.cpp', '.test'] 6 config.test_source_root = os.path.dirname(__file__) 7 8 clangxx = ' '.join([config.clang] + config.cxx_mode_flags) 9 10 config.substitutions.append((r"%clangxx ", clangxx + ' ')) 11 if config.lto_supported: 12 clangxx_cfi = ' '.join(config.lto_launch + [clangxx] + config.lto_flags + ['-flto -fsanitize=cfi ']) 13 clangxx_cfi_diag = clangxx_cfi + '-fno-sanitize-trap=cfi -fsanitize-recover=cfi ' 14 config.substitutions.append((r"%clangxx_cfi ", clangxx_cfi)) 15 config.substitutions.append((r"%clangxx_cfi_diag ", clangxx_cfi_diag)) 16 config.substitutions.append((r"%clangxx_cfi_dso ", clangxx_cfi + '-fsanitize-cfi-cross-dso ')) 17 config.substitutions.append((r"%clangxx_cfi_dso_diag ", clangxx_cfi_diag + '-fsanitize-cfi-cross-dso ')) 18 else: 19 config.unsupported = True 20 21 if lit_config.params.get('check_supported', None) and config.unsupported: 22 raise BaseException("Tests unsupported") 23