[PATCH] D14868: [tsan] Fix __cxa_guard_* interceptors on OS X

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 20 05:49:40 PST 2015


dvyukov added inline comments.

================
Comment at: lib/tsan/rtl/tsan_interceptors.cc:790
@@ -789,3 +789,3 @@
 // Used in thread-safe function static initialization.
-extern "C" int INTERFACE_ATTRIBUTE __cxa_guard_acquire(atomic_uint32_t *g) {
+TSAN_INTERCEPTOR(int, __cxa_guard_acquire, atomic_uint32_t *g) {
   SCOPED_INTERCEPTOR_RAW(__cxa_guard_acquire, g);
----------------
I think this will break statically-linked libstdc++ (which we do have in some contexts).
Linux interceptors are especially defined as weak functions (so that they don't cause link errors when user defines them as well). So they silently auto-disable themselves when such symbol is already present in the binary.
If we link libstdc++ statically, it will bring own __cxa_guard_acquire which will silently replace our interceptor. 
I have not tested it, though.


http://reviews.llvm.org/D14868





More information about the llvm-commits mailing list