6 config
.name
= "Scudo" + config
.name_suffix
9 config
.test_source_root
= os
.path
.dirname(__file__
)
11 # Path to the shared library
12 shared_libscudo
= os
.path
.join(
13 config
.compiler_rt_libdir
, "libclang_rt.scudo%s.so" % config
.target_suffix
15 shared_minlibscudo
= os
.path
.join(
16 config
.compiler_rt_libdir
, "libclang_rt.scudo_minimal%s.so" % config
.target_suffix
20 config
.suffixes
= [".c", ".cpp", ".test"]
23 c_flags
= [config
.target_cflags
] + [
33 # Android doesn't want -lrt.
34 if not config
.android
:
37 cxx_flags
= c_flags
+ config
.cxx_mode_flags
+ ["-std=c++11"]
39 scudo_flags
= ["-fsanitize=scudo"]
42 def build_invocation(compile_flags
):
43 return " " + " ".join([config
.clang
] + compile_flags
) + " "
47 config
.substitutions
.append(("%clang ", build_invocation(c_flags
)))
48 config
.substitutions
.append(("%clang_scudo ", build_invocation(c_flags
+ scudo_flags
)))
49 config
.substitutions
.append(
50 ("%clangxx_scudo ", build_invocation(cxx_flags
+ scudo_flags
))
52 config
.substitutions
.append(("%shared_libscudo", shared_libscudo
))
53 config
.substitutions
.append(("%shared_minlibscudo", shared_minlibscudo
))
55 # Platform-specific default SCUDO_OPTIONS for lit tests.
56 default_scudo_opts
= ""
58 # Android defaults to abort_on_error=1, which doesn't work for us.
59 default_scudo_opts
= "abort_on_error=0"
61 # Disable GWP-ASan for scudo internal tests.
63 config
.environment
["GWP_ASAN_OPTIONS"] = "Enabled=0"
65 if default_scudo_opts
:
66 config
.environment
["SCUDO_OPTIONS"] = default_scudo_opts
67 default_scudo_opts
+= ":"
68 config
.substitutions
.append(
69 ("%env_scudo_opts=", "env SCUDO_OPTIONS=" + default_scudo_opts
)
72 # Hardened Allocator tests are currently supported on Linux only.
73 if config
.host_os
not in ["Linux"]:
74 config
.unsupported
= True