[build] Export all symbols for the sanitizers.

This lets the sanitizers intercept any symbol. It's not worth trying to track which symbols the sanitizers are interested in. The sanitizer builds are not distributed so concerns about incompatibility, access to internals or size do not apply.

TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/53440
Change-Id: I59d137f4c15863cd27af857bfca4c53d847f2b90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324566
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak 2023-09-07 15:03:08 +00:00 committed by Commit Queue
parent 3bbe27eadf
commit fcda00866c
2 changed files with 26 additions and 45 deletions

View file

@ -35,6 +35,25 @@ config("libdart_builtin_config") {
}
}
config("export_api_symbols") {
if (is_win) {
ldflags = [ "/EXPORT:Dart_True" ]
} else if (is_asan || is_lsan || is_msan || is_tsan || is_ubsan) {
# Export everything so the sanitizers can intercept whatever they want.
ldflags = [ "-rdynamic" ]
} else if (is_mac) {
ldflags = [
"-Wl,-exported_symbol",
"-Wl,_Dart_*",
]
} else if (!is_clang) {
# TODO(rmacnak): Remove once bots are updated to a newer gcc.
ldflags = [ "-rdynamic" ]
} else {
ldflags = [ "-Wl,--export-dynamic-symbol=Dart_*" ]
}
}
template("build_libdart_builtin") {
extra_configs = []
if (defined(invoker.extra_configs)) {
@ -204,19 +223,7 @@ template("build_gen_snapshot") {
]
}
if (is_mac) {
ldflags = [
"-Wl,-exported_symbol",
"-Wl,_Dart_*",
]
} else if (!is_win) {
if (!is_clang) {
# TODO(rmacnak): Remove once bots are updated to a newer gcc.
ldflags = [ "-rdynamic" ]
} else {
ldflags = [ "-Wl,--export-dynamic-symbol=Dart_*" ]
}
}
configs += [ ":export_api_symbols" ]
if (is_win) {
libs = [
@ -798,23 +805,9 @@ template("dart_executable") {
"vmservice_impl.h",
] + extra_sources
if (is_win) {
ldflags = [ "/EXPORT:Dart_True" ]
} else if (is_mac) {
ldflags = [
"-Wl,-exported_symbol",
"-Wl,_Dart_*",
]
} else {
if (!is_clang) {
# TODO(rmacnak): Remove once bots are updated to a newer gcc.
ldflags = [ "-rdynamic" ]
} else {
ldflags = [ "-Wl,--export-dynamic-symbol=Dart_*" ]
}
}
configs += [ ":export_api_symbols" ]
ldflags += extra_ldflags
ldflags = extra_ldflags
if (is_win) {
libs = [
@ -1032,19 +1025,7 @@ executable("run_vm_tests") {
] + builtin_impl_tests + vm_tests + compiler_tests + heap_tests +
io_impl_tests
if (is_mac) {
ldflags = [
"-Wl,-exported_symbol",
"-Wl,_Dart_*",
]
} else if (!is_win) {
if (!is_clang) {
# TODO(rmacnak): Remove once bots are updated to a newer gcc.
ldflags = [ "-rdynamic" ]
} else {
ldflags = [ "-Wl,--export-dynamic-symbol=Dart_*" ]
}
}
configs += [ ":export_api_symbols" ]
if (is_win) {
libs = [

View file

@ -168,6 +168,9 @@ dart/*: SkipByDesign # Migrated tests are not supposed to run on non-NNBD bots.
dart/transferable_throws_oom_test: SkipByDesign # This test tries to allocate too much memory on purpose. Still dartbug.com/37188
dart_2/transferable_throws_oom_test: SkipByDesign # This test tries to allocate too much memory on purpose. Still dartbug.com/37188
[ $sanitizer != none ]
dart/exported_symbols_test: SkipByDesign # Sanitizers add extra symbols.
[ $sanitizer == tsan ]
dart/analyze_snapshot_binary_test: SkipSlow
dart/appjit_cha_deopt_test: SkipSlow
@ -510,9 +513,6 @@ dart_2/finalizer/finalizer_isolate_groups_run_gc_test: SkipByDesign # uses spawn
dart_2/isolates/send_object_to_spawn_uri_isolate_test: SkipByDesign # uses spawnUri
dart_2/issue32950_test: SkipByDesign # uses spawnUri.
[ $sanitizer == asan || $sanitizer == msan || $sanitizer == tsan || $sanitizer == ubsan ]
dart/exported_symbols_test: SkipByDesign # Sanitizers add extra symbols.
[ $system != macos || $simulator ]
dart/thread_priority_macos_test: SkipByDesign
dart_2/thread_priority_macos_test: SkipByDesign