[clang][dataflow][NFC] Fix stale comments. (#71654)
[llvm-project.git] / compiler-rt / test / xray / lit.cfg.py
blobf73ae3acd7715450568520ca7a2ad26bef956c63
1 # -*- Python -*-
3 import os
5 # Setup config name.
6 config.name = "XRay" + config.name_suffix
8 # Setup source root.
9 config.test_source_root = os.path.dirname(__file__)
11 # Setup default compiler flags use with -fxray-instrument option.
12 clang_xray_cflags = ["-fxray-instrument", config.target_cflags]
14 # If libc++ was used to build XRAY libraries, libc++ is needed. Fix applied
15 # to Linux only since -rpath may not be portable. This can be extended to
16 # other platforms.
17 if config.libcxx_used == "1" and config.host_os == "Linux":
18 clang_xray_cflags = clang_xray_cflags + (
19 ["-L%s -lc++ -Wl,-rpath=%s" % (config.llvm_shlib_dir, config.llvm_shlib_dir)]
22 clang_xray_cxxflags = config.cxx_mode_flags + clang_xray_cflags
25 def build_invocation(compile_flags):
26 return " " + " ".join([config.clang] + compile_flags) + " "
29 # Assume that llvm-xray is in the config.llvm_tools_dir.
30 llvm_xray = os.path.join(config.llvm_tools_dir, "llvm-xray")
32 # Setup substitutions.
33 if config.host_os == "Linux":
34 libdl_flag = "-ldl"
35 else:
36 libdl_flag = ""
38 config.substitutions.append(("%clang ", build_invocation([config.target_cflags])))
39 config.substitutions.append(
40 ("%clangxx ", build_invocation(config.cxx_mode_flags + [config.target_cflags]))
42 config.substitutions.append(("%clang_xray ", build_invocation(clang_xray_cflags)))
43 config.substitutions.append(("%clangxx_xray", build_invocation(clang_xray_cxxflags)))
44 config.substitutions.append(("%llvm_xray", llvm_xray))
45 config.substitutions.append(
47 "%xraylib",
49 "-lm -lpthread %s -lrt -L%s "
50 "-Wl,-whole-archive -lclang_rt.xray%s -Wl,-no-whole-archive"
52 % (libdl_flag, config.compiler_rt_libdir, config.target_suffix),
56 # Default test suffixes.
57 config.suffixes = [".c", ".cpp"]
59 if config.host_os not in ["FreeBSD", "Linux", "NetBSD", "OpenBSD"]:
60 config.unsupported = True
61 elif "64" not in config.host_arch:
62 if "arm" in config.host_arch:
63 if "-mthumb" in config.target_cflags:
64 config.unsupported = True
65 else:
66 config.unsupported = True
68 if config.host_os == "NetBSD":
69 config.substitutions.insert(0, ("%run", config.netbsd_nomprotect_prefix))