6 config
.name
= "XRay" + config
.name_suffix
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
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":
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(
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
66 config
.unsupported
= True
68 if config
.host_os
== "NetBSD":
69 config
.substitutions
.insert(0, ("%run", config
.netbsd_nomprotect_prefix
))