1 @LIT_SITE_CFG_IN_HEADER@
3 # Set attribute value if it is unset.
4 def set_default(attr, value):
5 if not getattr(config, attr, None):
6 setattr(config, attr, value)
8 # Generic config options for all compiler-rt lit tests.
9 set_default("target_triple", "@COMPILER_RT_DEFAULT_TARGET_TRIPLE@")
10 set_default("target_cflags", "@COMPILER_RT_TEST_COMPILER_CFLAGS@")
11 set_default("host_arch", "@HOST_ARCH@")
12 set_default("target_arch", "@COMPILER_RT_DEFAULT_TARGET_ARCH@")
13 set_default("host_os", "@HOST_OS@")
14 set_default("llvm_build_mode", "@LLVM_BUILD_MODE@")
15 set_default("llvm_src_root", "@LLVM_MAIN_SRC_DIR@")
16 set_default("llvm_obj_root", "@LLVM_BINARY_DIR@")
17 set_default("compiler_rt_src_root", "@COMPILER_RT_SOURCE_DIR@")
18 set_default("compiler_rt_obj_root", "@COMPILER_RT_BINARY_DIR@")
19 set_default("enable_per_target_runtime_dir", @LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_PYBOOL@)
20 set_default("llvm_tools_dir", "@LLVM_TOOLS_DIR@")
21 set_default("lit_tools_dir", "@LLVM_LIT_TOOLS_DIR@")
22 set_default("llvm_shlib_dir", "@LLVM_LIBRARY_OUTPUT_INTDIR@")
23 set_default("gnu_ld_executable", "@GNU_LD_EXECUTABLE@")
24 set_default("gold_executable", "@GOLD_EXECUTABLE@")
25 set_default("clang", "@COMPILER_RT_RESOLVED_TEST_COMPILER@")
26 set_default("compiler_id", "@COMPILER_RT_TEST_COMPILER_ID@")
27 set_default("python_executable", "@Python3_EXECUTABLE@")
28 set_default("compiler_rt_debug", @COMPILER_RT_DEBUG_PYBOOL@)
29 set_default("compiler_rt_intercept_libdispatch", @COMPILER_RT_INTERCEPT_LIBDISPATCH_PYBOOL@)
30 set_default("compiler_rt_output_dir", "@COMPILER_RT_RESOLVED_OUTPUT_DIR@")
31 set_default("compiler_rt_libdir", "@COMPILER_RT_RESOLVED_LIBRARY_OUTPUT_DIR@")
32 set_default("emulator", "@COMPILER_RT_EMULATOR@")
33 set_default("asan_shadow_scale", "@COMPILER_RT_ASAN_SHADOW_SCALE@")
34 set_default("memprof_shadow_scale", "@COMPILER_RT_MEMPROF_SHADOW_SCALE@")
35 set_default("apple_platform", "osx")
36 set_default("apple_platform_min_deployment_target_flag", "-mmacosx-version-min")
37 set_default("sanitizer_can_use_cxxabi", @SANITIZER_CAN_USE_CXXABI_PYBOOL@)
38 set_default("sanitizer_uses_static_cxxabi", @SANITIZER_USE_STATIC_CXX_ABI_PYBOOL@)
39 set_default("sanitizer_uses_static_unwind", @SANITIZER_USE_STATIC_LLVM_UNWINDER_PYBOOL@)
40 set_default("has_lld", @COMPILER_RT_HAS_LLD_PYBOOL@)
41 set_default("can_symbolize", @CAN_SYMBOLIZE@)
42 set_default("use_lld", @COMPILER_RT_TEST_USE_LLD_PYBOOL@)
43 set_default("use_thinlto", False)
44 set_default("use_lto", config.use_thinlto)
45 set_default("android", @ANDROID_PYBOOL@)
46 set_default("android_api_level", "@ANDROID_API_LEVEL@")
47 set_default("android_serial", "@ANDROID_SERIAL_FOR_TESTING@")
48 set_default("android_files_to_push", [])
49 set_default("have_rpc_xdr_h", @HAVE_RPC_XDR_H@)
50 set_default("gwp_asan", @COMPILER_RT_HAS_GWP_ASAN_PYBOOL@)
51 set_default("expensive_checks", @LLVM_ENABLE_EXPENSIVE_CHECKS_PYBOOL@)
52 set_default("test_standalone_build_libs", @COMPILER_RT_TEST_STANDALONE_BUILD_LIBS_PYBOOL@)
53 set_default("has_compiler_rt_libatomic", @COMPILER_RT_BUILD_STANDALONE_LIBATOMIC_PYBOOL@)
54 set_default("aarch64_sme", @COMPILER_RT_HAS_AARCH64_SME_PYBOOL@)
55 set_default("darwin_linker_version", "@COMPILER_RT_DARWIN_LINKER_VERSION@")
56 set_default("has_no_default_config_flag", @COMPILER_RT_HAS_NO_DEFAULT_CONFIG_FLAG_PYBOOL@)
57 # True iff the test suite supports ignoring the test compiler's runtime library path
58 # and using `config.compiler_rt_libdir` instead. This only matters when the runtime
59 # library paths differ.
60 set_default("test_suite_supports_overriding_runtime_lib_path", False)
61 config.available_features.add('target-is-%s' % config.target_arch)
63 if config.enable_per_target_runtime_dir:
64 set_default("target_suffix", "")
66 if config.target_arch == "i386":
67 set_default("target_suffix", "-i686-android")
69 set_default("target_suffix", "-%s-android" % config.target_arch)
71 set_default("target_suffix", "-%s" % config.target_arch)
73 set_default("have_internal_symbolizer", @COMPILER_RT_ENABLE_INTERNAL_SYMBOLIZER_PYBOOL@)
74 set_default("have_zlib", @ZLIB_FOUND_PYBOOL@)
75 set_default("zlib_include_dir", "@ZLIB_INCLUDE_DIR@")
76 set_default("zlib_library", "@ZLIB_LIBRARY@")
77 set_default("libcxx_used", "@LLVM_LIBCXX_USED@")
79 # LLVM tools dir can be passed in lit parameters, so try to
81 config.llvm_tools_dir = lit_config.substitute(config.llvm_tools_dir)
82 config.clang = lit_config.substitute(config.clang)
83 config.compiler_rt_libdir = lit_config.substitute(config.compiler_rt_libdir)
85 if not os.path.exists(config.clang):
86 lit_config.fatal("Can't find compiler on path %r" % config.clang)
89 lit.llvm.initialize(lit_config, config)
91 # Setup attributes common for all compiler-rt projects.
92 lit_config.load_config(config, "@COMPILER_RT_SOURCE_DIR@/test/lit.common.cfg.py")