Index: lib/tsan/rtl/tsan_interceptors.cc =================================================================== --- lib/tsan/rtl/tsan_interceptors.cc +++ lib/tsan/rtl/tsan_interceptors.cc @@ -2475,6 +2475,42 @@ #define TSAN_MAYBE_INTERCEPT__LWP_EXIT #endif +#if SANITIZER_NETBSD +// NetBSD uses indirection for old threading functions for historical reasons +TSAN_INTERCEPTOR(void, __libc_cond_init, void *c, void *a) \ + ALIAS(WRAPPER_NAME(pthread_cond_init)); +TSAN_INTERCEPTOR(void, __libc_cond_signal, void *c) \ + ALIAS(WRAPPER_NAME(pthread_cond_signal)); +TSAN_INTERCEPTOR(void, __libc_cond_broadcast, void *c) \ + ALIAS(WRAPPER_NAME(pthread_cond_broadcast)); +TSAN_INTERCEPTOR(void, __libc_cond_wait, void *c, void *m) \ + ALIAS(WRAPPER_NAME(pthread_cond_wait)); +TSAN_INTERCEPTOR(void, __libc_cond_destroy, void *c) \ + ALIAS(WRAPPER_NAME(pthread_cond_destroy)); +TSAN_INTERCEPTOR(void, __libc_mutex_init, void *m, void *a) \ + ALIAS(WRAPPER_NAME(pthread_mutex_init)); +TSAN_INTERCEPTOR(void, __libc_mutex_destroy, void *m) \ + ALIAS(WRAPPER_NAME(pthread_mutex_destroy)); +TSAN_INTERCEPTOR(void, __libc_mutex_trylock, void *m) \ + ALIAS(WRAPPER_NAME(pthread_mutex_trylock)); +TSAN_INTERCEPTOR(void, __libc_rwlock_init, void *m, void *a) \ + ALIAS(WRAPPER_NAME(pthread_rwlock_init)); +TSAN_INTERCEPTOR(void, __libc_rwlock_destroy, void *m) \ + ALIAS(WRAPPER_NAME(pthread_rwlock_destroy)); +TSAN_INTERCEPTOR(void, __libc_rwlock_rdlock, void *m) \ + ALIAS(WRAPPER_NAME(pthread_rwlock_rdlock)); +TSAN_INTERCEPTOR(void, __libc_rwlock_tryrdlock, void *m) \ + ALIAS(WRAPPER_NAME(pthread_rwlock_tryrdlock)); +TSAN_INTERCEPTOR(void, __libc_rwlock_wrlock, void *m) \ + ALIAS(WRAPPER_NAME(pthread_rwlock_wrlock)); +TSAN_INTERCEPTOR(void, __libc_rwlock_trywrlock, void *m) \ + ALIAS(WRAPPER_NAME(pthread_rwlock_trywrlock)); +TSAN_INTERCEPTOR(void, __libc_rwlock_unlock, void *m) \ + ALIAS(WRAPPER_NAME(pthread_rwlock_unlock)); +TSAN_INTERCEPTOR(void, __libc_thr_once, void *o, void (*f)()) \ + ALIAS(WRAPPER_NAME(pthread_once)); +#endif + namespace __tsan { static void finalize(void *arg) { @@ -2664,6 +2700,26 @@ } #endif +#if SANITIZE_NETBSD + // NetBSD uses indirection for old threading functions for historical reasons + TSAN_INTERCEPT(__libc_cond_init); + TSAN_INTERCEPT(__libc_cond_signal); + TSAN_INTERCEPT(__libc_cond_broadcast); + TSAN_INTERCEPT(__libc_cond_wait); + TSAN_INTERCEPT(__libc_cond_destroy); + TSAN_INTERCEPT(__libc_mutex_init); + TSAN_INTERCEPT(__libc_mutex_destroy); + TSAN_INTERCEPT(__libc_mutex_trylock); + TSAN_INTERCEPT(__libc_rwlock_init); + TSAN_INTERCEPT(__libc_rwlock_destroy); + TSAN_INTERCEPT(__libc_rwlock_rdlock); + TSAN_INTERCEPT(__libc_rwlock_tryrdlock); + TSAN_INTERCEPT(__libc_rwlock_wrlock); + TSAN_INTERCEPT(__libc_rwlock_trywrlock); + TSAN_INTERCEPT(__libc_rwlock_unlock); + TSAN_INTERCEPT(__libc_thr_once); +#endif + FdInit(); }