Skip to content

Commit 5cb7534

Browse files
authored
[tsan] Only intercept pthread_mutex_clocklock on Linux (#76220)
`tsan_interceptors_posix.cpp` doesn't compile on FreeBSD 14.0/amd64: ``` In file included from /vol/llvm/src/llvm-project/local-freebsd/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:25: /vol/llvm/src/llvm-project/local-freebsd/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp: In function ‘void __tsan::InitializeInterceptors()’: /vol/llvm/src/llvm-project/local-freebsd/compiler-rt/lib/tsan/rtl/../../interception/interception.h:243:25: error: ‘real_pthread_mutex_clocklock’ is not a member of ‘__interception’; did you mean ‘real_pthread_mutex_unlock’? ``` Fixed by wrapping the `TSAN_INTERCEPT` invocation with `SANITIZER_LINUX` as is already done for the interceptor definition. Tested on `amd64-pc-freebsd14.0`.
1 parent e4f1c52 commit 5cb7534

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2918,7 +2918,9 @@ void InitializeInterceptors() {
29182918
TSAN_INTERCEPT(pthread_mutex_trylock);
29192919
TSAN_INTERCEPT(pthread_mutex_timedlock);
29202920
TSAN_INTERCEPT(pthread_mutex_unlock);
2921+
#if SANITIZER_LINUX
29212922
TSAN_INTERCEPT(pthread_mutex_clocklock);
2923+
#endif
29222924
#if SANITIZER_GLIBC
29232925
# if !__GLIBC_PREREQ(2, 34)
29242926
TSAN_INTERCEPT(__pthread_mutex_lock);

0 commit comments

Comments
 (0)