Skip to content

Commit e777317

Browse files
committed
[tsan] Make pthread_mutex_clocklock Linux only
Many systems (glibc<2.30, Bionic before 2019, musl, macOS, etc) do not have the function.
1 parent 0767711 commit e777317

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
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
@@ -1380,6 +1380,7 @@ TSAN_INTERCEPTOR(int, pthread_mutex_unlock, void *m) {
13801380
return res;
13811381
}
13821382

1383+
#if SANITIZER_LINUX
13831384
TSAN_INTERCEPTOR(int, pthread_mutex_clocklock, void *m,
13841385
__sanitizer_clockid_t clock, void *abstime) {
13851386
SCOPED_TSAN_INTERCEPTOR(pthread_mutex_clocklock, m, clock, abstime);
@@ -1393,6 +1394,7 @@ TSAN_INTERCEPTOR(int, pthread_mutex_clocklock, void *m,
13931394
MutexInvalidAccess(thr, pc, (uptr)m);
13941395
return res;
13951396
}
1397+
#endif
13961398

13971399
#if SANITIZER_GLIBC
13981400
# if !__GLIBC_PREREQ(2, 34)

compiler-rt/test/tsan/pthread_mutex_clocklock.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
2-
// UNSUPPORTED: darwin
2+
// REQUIRES: glibc-2.30
33
#include <pthread.h>
44
#include <stdio.h>
55

@@ -26,4 +26,4 @@ int main() {
2626
}
2727

2828
// CHECK-NOT: WARNING: ThreadSanitizer: unlock of an unlocked mutex
29-
// CHECK: PASS
29+
// CHECK: PASS

0 commit comments

Comments
 (0)