[compiler-rt] tsan: Refine conditions to intercept pthread_cond_t functions (PR #154268)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 19 10:04:04 PDT 2025
================
@@ -3041,12 +3025,26 @@ void InitializeInterceptors() {
TSAN_INTERCEPT(pthread_timedjoin_np);
#endif
- TSAN_INTERCEPT_VER(pthread_cond_init, PTHREAD_ABI_BASE);
- TSAN_INTERCEPT_VER(pthread_cond_signal, PTHREAD_ABI_BASE);
- TSAN_INTERCEPT_VER(pthread_cond_broadcast, PTHREAD_ABI_BASE);
- TSAN_INTERCEPT_VER(pthread_cond_wait, PTHREAD_ABI_BASE);
- TSAN_INTERCEPT_VER(pthread_cond_timedwait, PTHREAD_ABI_BASE);
- TSAN_INTERCEPT_VER(pthread_cond_destroy, PTHREAD_ABI_BASE);
+ // In glibc versions older than 2.36, dlsym(RTLD_NEXT, "pthread_cond_init")
+ // may return an outdated symbol (max(2.2,base_version)) if the port was
+ // introduced before 2.3.2 (when the new pthread_cond_t was introduced).
+#if SANITIZER_GLIBC && !__GLIBC_PREREQ(2, 36) && \
+ (defined(__x86_64__) || defined(__mips__) || SANITIZER_PPC64V1 || \
----------------
MaskRay wrote:
The new pthread_cond symbols were introduced at 2.3.2. If a port (arch) was introduced after 2.3.2, the compatibility symbol (of non-default version) would not compiled, and there will only be one `pthread_cond_init` symbol, no need for `dlvsym`.
https://github.com/llvm/llvm-project/pull/154268
More information about the llvm-commits
mailing list