[tsan][test] Remaining tests requiring weak symbols for dyld64
authorRoy Sundahl <rsundahl@apple.com>
Mon, 1 Aug 2022 17:43:52 +0000 (10:43 -0700)
committerRoy Sundahl <rsundahl@apple.com>
Mon, 1 Aug 2022 18:02:43 +0000 (11:02 -0700)
Differential Revision: https://reviews.llvm.org/D130917

compiler-rt/test/tsan/Darwin/debug_external.cpp
compiler-rt/test/tsan/Darwin/main_tid.mm
compiler-rt/test/tsan/debugging.cpp
compiler-rt/test/tsan/libdispatch/dispatch_once_deadlock.c

index 399663c..6539a18 100644 (file)
@@ -42,7 +42,12 @@ int main() {
   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;
index 886880e..5f42c41 100644 (file)
@@ -13,8 +13,13 @@ int __tsan_get_report_thread(void *report, unsigned long idx, int *tid,
                              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;
index be0a0c7..9d247a2 100644 (file)
@@ -46,7 +46,12 @@ int main() {
   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",
index 4e8785b..70faa60 100644 (file)
@@ -22,8 +22,13 @@ void f() {
   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