f1ba8ceacf
Fix GCC TSAN build. Cleanup sanitizer includes. TEST=ci Change-Id: Ib68bbfa701b4309c03514ed689391051094208e4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/452226 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Alexander Aprelev <aam@google.com>
35 lines
1.6 KiB
C++
35 lines
1.6 KiB
C++
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#include "platform/thread_sanitizer.h"
|
|
|
|
#if defined(USING_THREAD_SANITIZER)
|
|
// Functions returning default options are declared weak in the tools' runtime
|
|
// libraries. To make the linker pick the strong replacements for those
|
|
// functions from this module, we explicitly force its inclusion by passing
|
|
// -Wl,-u,_sanitizer_options_link_helper
|
|
extern "C" void _sanitizer_options_link_helper() {}
|
|
|
|
// The callbacks we define here will be called from the sanitizer runtime, but
|
|
// aren't referenced from the Dart binaries. We must ensure that those
|
|
// callbacks are not sanitizer-instrumented, and that they aren't stripped by
|
|
// the linker.
|
|
#define SANITIZER_HOOK_ATTRIBUTE \
|
|
extern "C" __attribute__((no_sanitize_thread)) \
|
|
__attribute__((visibility("default"))) __attribute__((used))
|
|
#endif
|
|
|
|
#if defined(USING_THREAD_SANITIZER) && defined(DART_HOST_OS_LINUX)
|
|
SANITIZER_HOOK_ATTRIBUTE const char* __tsan_default_suppressions() {
|
|
// See https://github.com/google/sanitizers/wiki/threadsanitizersuppressions
|
|
return R"(
|
|
# False positive in libc's tzset_internal (see http://dartbug.com/54064).
|
|
# In some environments tzset_internal is not symbolized correctly so we
|
|
# also suppress the closest caller which is properly symbolized.
|
|
race:tzset_internal
|
|
race:dart::LocalTime
|
|
)";
|
|
}
|
|
#endif // defined(USING_THREAD_SANITIZER) && defined(DART_HOST_OS_LINUX)
|