[compiler-rt] 7a90ff7 - [compiler-rt][profile] Use `flock` shim on Windows even if detection fails (#112695)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 15:09:19 PDT 2024


Author: Yuta Saito
Date: 2024-10-22T07:09:16+09:00
New Revision: 7a90ff752c4e07e6826d9e1f23871401a6592b23

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

LOG: [compiler-rt][profile] Use `flock` shim on Windows even if detection fails (#112695)

Added: 
    

Modified: 
    compiler-rt/lib/profile/InstrProfilingUtil.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/profile/InstrProfilingUtil.c b/compiler-rt/lib/profile/InstrProfilingUtil.c
index 95ec4080ba2504..c637b9d0b893cd 100644
--- a/compiler-rt/lib/profile/InstrProfilingUtil.c
+++ b/compiler-rt/lib/profile/InstrProfilingUtil.c
@@ -152,7 +152,8 @@ COMPILER_RT_VISIBILITY int lprofLockFd(int fd) {
     }
   }
   return 0;
-#elif defined(COMPILER_RT_HAS_FLOCK)
+#elif defined(COMPILER_RT_HAS_FLOCK) || defined(_WIN32)
+  // Windows doesn't have flock but WindowsMMap.h provides a shim
   flock(fd, LOCK_EX);
   return 0;
 #else
@@ -179,7 +180,8 @@ COMPILER_RT_VISIBILITY int lprofUnlockFd(int fd) {
     }
   }
   return 0;
-#elif defined(COMPILER_RT_HAS_FLOCK)
+#elif defined(COMPILER_RT_HAS_FLOCK) || defined(_WIN32)
+  // Windows doesn't have flock but WindowsMMap.h provides a shim
   flock(fd, LOCK_UN);
   return 0;
 #else


        


More information about the llvm-commits mailing list