[compiler-rt] 4cefa86 - [TSan][libdispatch] Fix compilation error on Linux

Julian Lettner via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 2 11:29:49 PDT 2020


Author: Julian Lettner
Date: 2020-09-02T11:20:47-07:00
New Revision: 4cefa8614ffe18cf8de0fe86297df81f4385e08f

URL: https://github.com/llvm/llvm-project/commit/4cefa8614ffe18cf8de0fe86297df81f4385e08f
DIFF: https://github.com/llvm/llvm-project/commit/4cefa8614ffe18cf8de0fe86297df81f4385e08f.diff

LOG: [TSan][libdispatch] Fix compilation error on Linux

The interceptor for the block variants of the API references the
function versions (via `REAL(name##_f)`).  On Linux, this accesses the
underlying "real pointer", defined by the interceptor macro.  So we need
to declare interceptors in the right order to avoid undefined symbol
compiler error:
```
error: no member named 'real_dispatch_async_and_wait_f' in namespace '__tsan::__interception'
```

rdar://68181542

Added: 
    

Modified: 
    compiler-rt/lib/tsan/rtl/tsan_interceptors_libdispatch.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors_libdispatch.cpp b/compiler-rt/lib/tsan/rtl/tsan_interceptors_libdispatch.cpp
index b56cc2dab704..cbbb7ecb2397 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_interceptors_libdispatch.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors_libdispatch.cpp
@@ -240,10 +240,10 @@ SANITIZER_WEAK_IMPORT void dispatch_barrier_async_and_wait(
 SANITIZER_WEAK_IMPORT void dispatch_barrier_async_and_wait_f(
     dispatch_queue_t queue, void *context, dispatch_function_t work);
 
-DISPATCH_INTERCEPT_SYNC_B(dispatch_async_and_wait, false)
 DISPATCH_INTERCEPT_SYNC_F(dispatch_async_and_wait_f, false)
-DISPATCH_INTERCEPT_SYNC_B(dispatch_barrier_async_and_wait, true)
+DISPATCH_INTERCEPT_SYNC_B(dispatch_async_and_wait, false)
 DISPATCH_INTERCEPT_SYNC_F(dispatch_barrier_async_and_wait_f, true)
+DISPATCH_INTERCEPT_SYNC_B(dispatch_barrier_async_and_wait, true)
 #endif
 
 


        


More information about the llvm-commits mailing list