Skip to content

Commit 6b500b2

Browse files
rmacnak-googleCommit Queue
authored andcommitted
[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 <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
1 parent 870c08b commit 6b500b2

File tree

3 files changed

+63
-6
lines changed

3 files changed

+63
-6
lines changed

build/config/sysroot.gni

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ if (is_linux) {
5151

5252
if ((current_toolchain == host_toolchain ||
5353
current_toolchain == default_toolchain ||
54-
current_toolchain == "${default_toolchain}_shared") &&
54+
current_toolchain == "${default_toolchain}_shared" ||
55+
current_toolchain == "${default_toolchain}_asan" ||
56+
current_toolchain == "${default_toolchain}_msan" ||
57+
current_toolchain == "${default_toolchain}_tsan") &&
5558
target_sysroot != "") {
5659
sysroot = target_sysroot
5760
} else if (is_android) {

build/toolchain/toolchain_suite.gni

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,28 @@ _all_toolchains = [
3131
is_shared_library = true
3232
}
3333
},
34+
35+
{
36+
suffix = "_asan"
37+
toolchain_args = {
38+
is_shared_library = false
39+
is_asan = true
40+
}
41+
},
42+
{
43+
suffix = "_msan"
44+
toolchain_args = {
45+
is_shared_library = false
46+
is_msan = true
47+
}
48+
},
49+
{
50+
suffix = "_tsan"
51+
toolchain_args = {
52+
is_shared_library = false
53+
is_tsan = true
54+
}
55+
},
3456
]
3557

3658
template("toolchain_suite") {

sdk/BUILD.gn

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,38 @@ copy("copy_dart_aotruntime") {
374374
]
375375
}
376376

377+
copy_sanitizer_deps = []
378+
if (!using_sanitizer && current_os == "linux") {
379+
sanitizers = []
380+
if (current_cpu == "x64" || current_cpu == "arm64") {
381+
sanitizers += [
382+
"asan",
383+
"msan",
384+
"tsan",
385+
]
386+
} else if (current_cpu == "riscv64") {
387+
# Fuchsia Clang is missing the riscv64 MSAN runtime.
388+
sanitizers += [
389+
"asan",
390+
"tsan",
391+
]
392+
}
393+
394+
foreach(sanitizer, sanitizers) {
395+
copy("copy_dart_aotruntime_$sanitizer") {
396+
visibility = [ ":group_dart2native" ]
397+
deps = [ "../runtime/bin:dartaotruntime_product(${current_toolchain}_${sanitizer})" ]
398+
src_dir = get_label_info(
399+
"../runtime/bin:dartaotruntime_product(${current_toolchain}_${sanitizer})",
400+
"root_out_dir")
401+
sources =
402+
[ "$src_dir/${dart_aotruntime_stripped_binary}${executable_suffix}" ]
403+
outputs = [ "$root_out_dir/$dart_sdk_output/bin/dartaotruntime_${sanitizer}${executable_suffix}" ]
404+
}
405+
copy_sanitizer_deps += [ ":copy_dart_aotruntime_$sanitizer" ]
406+
}
407+
}
408+
377409
group("copy_gen_snapshot") {
378410
visibility = [ ":group_dart2native" ]
379411
public_deps = [ ":copy_gen_snapshot_exe" ]
@@ -419,11 +451,11 @@ copy("copy_gen_kernel_snapshot") {
419451

420452
group("group_dart2native") {
421453
deps = [
422-
":copy_dart_aotruntime",
423-
":copy_gen_kernel_snapshot",
424-
":copy_gen_snapshot",
425-
":copy_vm_platform_product",
426-
]
454+
":copy_dart_aotruntime",
455+
":copy_gen_kernel_snapshot",
456+
":copy_gen_snapshot",
457+
":copy_vm_platform_product",
458+
] + copy_sanitizer_deps
427459
}
428460

429461
# A template for copying the things in _platform_sdk_scripts and

0 commit comments

Comments
 (0)