[build] Put sanitizer versions of the AOT runtime into the SDK for testing.

Note there is no need for versions of gen_snapshot because the sanitizer target is a runtime flag.

Change-Id: I25485e27331a0b8724e954a5222a11a1db45cfb7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464623
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak
2025-12-01 15:06:53 -08:00
committed by Commit Queue
parent 870c08b50a
commit 6b500b2517
3 changed files with 63 additions and 6 deletions
+4 -1
View File
@@ -51,7 +51,10 @@ if (is_linux) {
if ((current_toolchain == host_toolchain ||
current_toolchain == default_toolchain ||
current_toolchain == "${default_toolchain}_shared") &&
current_toolchain == "${default_toolchain}_shared" ||
current_toolchain == "${default_toolchain}_asan" ||
current_toolchain == "${default_toolchain}_msan" ||
current_toolchain == "${default_toolchain}_tsan") &&
target_sysroot != "") {
sysroot = target_sysroot
} else if (is_android) {
+22
View File
@@ -31,6 +31,28 @@ _all_toolchains = [
is_shared_library = true
}
},
{
suffix = "_asan"
toolchain_args = {
is_shared_library = false
is_asan = true
}
},
{
suffix = "_msan"
toolchain_args = {
is_shared_library = false
is_msan = true
}
},
{
suffix = "_tsan"
toolchain_args = {
is_shared_library = false
is_tsan = true
}
},
]
template("toolchain_suite") {
+37 -5
View File
@@ -374,6 +374,38 @@ copy("copy_dart_aotruntime") {
]
}
copy_sanitizer_deps = []
if (!using_sanitizer && current_os == "linux") {
sanitizers = []
if (current_cpu == "x64" || current_cpu == "arm64") {
sanitizers += [
"asan",
"msan",
"tsan",
]
} else if (current_cpu == "riscv64") {
# Fuchsia Clang is missing the riscv64 MSAN runtime.
sanitizers += [
"asan",
"tsan",
]
}
foreach(sanitizer, sanitizers) {
copy("copy_dart_aotruntime_$sanitizer") {
visibility = [ ":group_dart2native" ]
deps = [ "../runtime/bin:dartaotruntime_product(${current_toolchain}_${sanitizer})" ]
src_dir = get_label_info(
"../runtime/bin:dartaotruntime_product(${current_toolchain}_${sanitizer})",
"root_out_dir")
sources =
[ "$src_dir/${dart_aotruntime_stripped_binary}${executable_suffix}" ]
outputs = [ "$root_out_dir/$dart_sdk_output/bin/dartaotruntime_${sanitizer}${executable_suffix}" ]
}
copy_sanitizer_deps += [ ":copy_dart_aotruntime_$sanitizer" ]
}
}
group("copy_gen_snapshot") {
visibility = [ ":group_dart2native" ]
public_deps = [ ":copy_gen_snapshot_exe" ]
@@ -419,11 +451,11 @@ copy("copy_gen_kernel_snapshot") {
group("group_dart2native") {
deps = [
":copy_dart_aotruntime",
":copy_gen_kernel_snapshot",
":copy_gen_snapshot",
":copy_vm_platform_product",
]
":copy_dart_aotruntime",
":copy_gen_kernel_snapshot",
":copy_gen_snapshot",
":copy_vm_platform_product",
] + copy_sanitizer_deps
}
# A template for copying the things in _platform_sdk_scripts and