diff --git a/compiler-rt/test/tsan/Darwin/debug_external.cpp b/compiler-rt/test/tsan/Darwin/debug_external.cpp --- a/compiler-rt/test/tsan/Darwin/debug_external.cpp +++ b/compiler-rt/test/tsan/Darwin/debug_external.cpp @@ -42,7 +42,12 @@ return 0; } -__attribute__((disable_sanitizer_instrumentation)) void +// Required for dyld macOS 12.0+ +#if (__APPLE__) +__attribute__((weak)) +#endif +__attribute__((disable_sanitizer_instrumentation)) +extern "C" void __tsan_on_report(void *report) { const char *type; void *addr; diff --git a/compiler-rt/test/tsan/Darwin/main_tid.mm b/compiler-rt/test/tsan/Darwin/main_tid.mm --- a/compiler-rt/test/tsan/Darwin/main_tid.mm +++ b/compiler-rt/test/tsan/Darwin/main_tid.mm @@ -13,8 +13,13 @@ unsigned long trace_size); } +// Required for dyld macOS 12.0+ +#if (__APPLE__) +__attribute__((weak)) +#endif __attribute__((disable_sanitizer_instrumentation)) -void __tsan_on_report(void *report) { +extern "C" void +__tsan_on_report(void *report) { fprintf(stderr, "__tsan_on_report(%p)\n", report); int tid; diff --git a/compiler-rt/test/tsan/debugging.cpp b/compiler-rt/test/tsan/debugging.cpp --- a/compiler-rt/test/tsan/debugging.cpp +++ b/compiler-rt/test/tsan/debugging.cpp @@ -46,7 +46,12 @@ fprintf(stderr, "Done.\n"); } -__attribute__((disable_sanitizer_instrumentation)) void +// Required for dyld macOS 12.0+ +#if (__APPLE__) +__attribute__((weak)) +#endif +__attribute__((disable_sanitizer_instrumentation)) +extern "C" void __tsan_on_report(void *report) { fprintf(stderr, "__tsan_on_report(%p)\n", report); fprintf(stderr, "__tsan_get_current_report() = %p\n", diff --git a/compiler-rt/test/tsan/libdispatch/dispatch_once_deadlock.c b/compiler-rt/test/tsan/libdispatch/dispatch_once_deadlock.c --- a/compiler-rt/test/tsan/libdispatch/dispatch_once_deadlock.c +++ b/compiler-rt/test/tsan/libdispatch/dispatch_once_deadlock.c @@ -22,8 +22,13 @@ h++; } +// Required for dyld macOS 12.0+ +#if (__APPLE__) +__attribute__((weak)) +#endif __attribute__((disable_sanitizer_instrumentation)) -void __tsan_on_report() { +extern void +__tsan_on_report() { fprintf(stderr, "Report.\n"); // Without these annotations this test deadlocks for COMPILER_RT_DEBUG=ON