[compiler-rt] da2a16f - [tsan] Make __fxstat code path glibc only

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


Author: Fangrui Song
Date: 2022-02-11T15:23:18-08:00
New Revision: da2a16f702efe3307d407d5c6db6c8c18ef6bd9b

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

LOG: [tsan] Make __fxstat code path glibc only

This fixes Linux musl build after D118423.

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-commits mailing list