7 config
.name
= "ORC" + config
.name_suffix
10 config
.test_source_root
= os
.path
.dirname(__file__
)
12 # Determine whether the test target is compatible with execution on the host.
13 host_arch_compatible
= config
.target_arch
== config
.host_arch
15 if config
.host_arch
== "x86_64h" and config
.target_arch
== "x86_64":
16 host_arch_compatible
= True
17 if host_arch_compatible
:
18 config
.available_features
.add("host-arch-compatible")
20 # If the target OS hasn't been set then assume host.
21 if not config
.target_os
:
22 config
.target_os
= config
.host_os
24 config
.test_target_is_host_executable
= (
25 config
.target_os
== config
.host_os
and host_arch_compatible
28 # Assume that llvm-jitlink is in the config.llvm_tools_dir.
29 llvm_jitlink
= os
.path
.join(config
.llvm_tools_dir
, "llvm-jitlink")
30 orc_rt_executor_stem
= os
.path
.join(
31 config
.compiler_rt_obj_root
, "lib/orc/tests/tools/orc-rt-executor"
33 lli
= os
.path
.join(config
.llvm_tools_dir
, "lli")
34 if config
.host_os
== "Darwin":
35 orc_rt_path
= "%s/liborc_rt_osx.a" % config
.compiler_rt_libdir
37 orc_rt_path
= "%s/liborc_rt%s.a" % (config
.compiler_rt_libdir
, config
.target_suffix
)
39 if config
.libunwind_shared
:
40 config
.available_features
.add("libunwind-available")
41 shared_libunwind_path
= os
.path
.join(config
.libunwind_install_dir
, "libunwind.so")
42 config
.substitutions
.append(("%shared_libunwind", shared_libunwind_path
))
45 def build_invocation(compile_flags
):
46 return " " + " ".join([config
.clang
] + compile_flags
) + " "
49 config
.substitutions
.append(("%clang ", build_invocation([config
.target_cflags
])))
50 config
.substitutions
.append(
51 ("%clangxx ", build_invocation(config
.cxx_mode_flags
+ [config
.target_cflags
]))
53 config
.substitutions
.append(
54 ("%clang_cl ", build_invocation(["--driver-mode=cl"] + [config
.target_cflags
]))
56 if config
.host_os
== "Windows":
57 config
.substitutions
.append(
64 + " -no-process-syms=true -slab-allocate=64MB"
69 config
.substitutions
.append(
70 ("%llvm_jitlink", (llvm_jitlink
+ " -orc-runtime=" + orc_rt_path
))
72 config
.substitutions
.append(
73 ("%orc_rt_executor", orc_rt_executor_stem
+ "-" + config
.host_arch
)
75 config
.substitutions
.append(
78 (lli
+ " -jit-kind=orc -jit-linker=jitlink -orc-runtime=" + orc_rt_path
),
81 config
.substitutions
.append(("%ar", "ar"))
83 # Default test suffixes.
84 config
.suffixes
= [".c", ".cpp", ".m", ".S", ".ll", ".test"]
86 # Exclude Inputs directories.
87 config
.excludes
= ["Inputs"]
89 if config
.host_os
not in ["Darwin", "FreeBSD", "Linux", "Windows"]:
90 config
.unsupported
= True
92 # Ask llvm-config about assertion mode.
94 llvm_config_result
= subprocess
.check_output(
95 [os
.path
.join(config
.llvm_tools_dir
, "llvm-config"), "--assertion-mode"],
96 env
=config
.environment
,
98 if llvm_config_result
.startswith(b
"ON"):
99 config
.available_features
.add("asserts")
101 lit_config
.warning(f
"Could not determine if LLVM was built with assertions: {e}")