diff options
author | Julian Lettner <julian.lettner@apple.com> | 2020-08-17 12:41:18 -0700 |
---|---|---|
committer | Julian Lettner <julian.lettner@apple.com> | 2020-08-18 18:34:14 -0700 |
commit | 686fe293e6c5fd51fa0a3c86a43c2d9a652d53b1 (patch) | |
tree | 1e6bc168af8851d0a09d91960d59699be26fa15b /llvm/lib/Support/TargetParser.cpp | |
parent | 0c4863a253957db04549815be218237d6650e5be (diff) | |
download | llvm-686fe293e6c5fd51fa0a3c86a43c2d9a652d53b1.zip llvm-686fe293e6c5fd51fa0a3c86a43c2d9a652d53b1.tar.gz llvm-686fe293e6c5fd51fa0a3c86a43c2d9a652d53b1.tar.bz2 |
[TSan][libdispatch] Ensure TSan dylib works on old systems
`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.
In addition, we want to prevent building these interceptors at all when
building with older SDKs because linking always fails.
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
Reviewed By: kubamracek
Differential Revision: https://reviews.llvm.org/D86103
Diffstat (limited to 'llvm/lib/Support/TargetParser.cpp')
0 files changed, 0 insertions, 0 deletions