dispatch_async_and_wait() was introduced in macOS 10.14, which is
greater than our minimal deployment target. We need to forward declare
it as a "weak import" to ensure we generate a weak reference so the TSan
dylib continues to work on older systems. We cannot simply `#include
<dispatch.h>` or use the Darwin availability macros since this file is
multi-platform.
Before:
➤ dyldinfo -bind ./lib/clang/12.0.0/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib | grep dispatch_async_and_wait __DATA __interpose 0x000F5E68 pointer 0 libSystem _dispatch_async_and_wait_f
After:
➤ dyldinfo -bind ./lib/clang/12.0.0/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib | grep dispatch_async_and_wait __DATA __got 0x000EC0A8 pointer 0 libSystem _dispatch_async_and_wait (weak import) __DATA __interpose 0x000F5E78 pointer 0 libSystem _dispatch_async_and_wait (weak import)
This is a follow-up to D85854 and should fix:
https://reviews.llvm.org/D85854#2221529
Is this not defined elsewhere in sanitizer_common?