[llvm-branch-commits] [compiler-rt] 2a2286e - [tsan] Make __fxstat code path glibc only

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Feb 11 15:25:58 PST 2022


Author: Fangrui Song
Date: 2022-02-11T15:25:53-08:00
New Revision: 2a2286e9859a518a46ead8e3ef5e283662766370

URL: https://github.com/llvm/llvm-project/commit/2a2286e9859a518a46ead8e3ef5e283662766370
DIFF: https://github.com/llvm/llvm-project/commit/2a2286e9859a518a46ead8e3ef5e283662766370.diff

LOG: [tsan] Make __fxstat code path glibc only

This fixes Linux musl build after D118423.

(cherry picked from commit da2a16f702efe3307d407d5c6db6c8c18ef6bd9b)

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
index 999be79c6418b..ea99c3843075a 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
@@ -1554,16 +1554,16 @@ TSAN_INTERCEPTOR(int, __fxstat, int version, int fd, void *buf) {
 #endif
 
 TSAN_INTERCEPTOR(int, fstat, int fd, void *buf) {
-#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_ANDROID || SANITIZER_NETBSD
-  SCOPED_TSAN_INTERCEPTOR(fstat, fd, buf);
+#if SANITIZER_GLIBC
+  SCOPED_TSAN_INTERCEPTOR(__fxstat, 0, fd, buf);
   if (fd > 0)
     FdAccess(thr, pc, fd);
-  return REAL(fstat)(fd, buf);
+  return REAL(__fxstat)(0, fd, buf);
 #else
-  SCOPED_TSAN_INTERCEPTOR(__fxstat, 0, fd, buf);
+  SCOPED_TSAN_INTERCEPTOR(fstat, fd, buf);
   if (fd > 0)
     FdAccess(thr, pc, fd);
-  return REAL(__fxstat)(0, fd, buf);
+  return REAL(fstat)(fd, buf);
 #endif
 }
 


        


More information about the llvm-branch-commits mailing list