tsan: properly intercept pthread_cond functions


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@189767 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/interception/interception_linux.h b/lib/interception/interception_linux.h
index dba60bf..200a9ae 100644
--- a/lib/interception/interception_linux.h
+++ b/lib/interception/interception_linux.h
@@ -25,6 +25,7 @@
 // returns true if a function with the given name was found.
 bool GetRealFunctionAddress(const char *func_name, uptr *func_addr,
     uptr real, uptr wrapper);
+void *GetFuncAddrVer(const char *func_name, const char *ver);
 }  // namespace __interception
 
 #define INTERCEPT_FUNCTION_LINUX(func) \
@@ -33,5 +34,10 @@
           (::__interception::uptr)&(func), \
           (::__interception::uptr)&WRAP(func))
 
+#define INTERCEPT_FUNCTION_VER(func, funcver, symver) \
+    __asm__(".symver "#funcver","#func"@"#symver); \
+    ::__interception::real_##funcver = (funcver##_f)(unsigned long) \
+        ::__interception::GetFuncAddrVer(#func, #symver)
+
 #endif  // INTERCEPTION_LINUX_H
 #endif  // __linux__