[compiler-rt] 80c95bb - [sanitizer] Fix compress_stack_depot.cpp test on Darwin

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 20 18:15:34 PST 2021


Author: Vitaly Buka
Date: 2021-12-20T18:15:23-08:00
New Revision: 80c95bbdf359c54abaeacdbcc070b7b5d3b25b6a

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

LOG: [sanitizer] Fix compress_stack_depot.cpp test on Darwin

All platforms which can start the thread should stop it as well.

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
index a703db48d4c3..c4cc0e45193e 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
@@ -22,7 +22,6 @@ namespace __sanitizer {
 #if (SANITIZER_LINUX || SANITIZER_NETBSD) && !SANITIZER_GO
 // Weak default implementation for when sanitizer_stackdepot is not linked in.
 SANITIZER_WEAK_ATTRIBUTE StackDepotStats StackDepotGetStats() { return {}; }
-SANITIZER_WEAK_ATTRIBUTE void StackDepotStopBackgroundThread() {}
 
 void *BackgroundThread(void *arg) {
   VPrintf(1, "%s: Started BackgroundThread\n", SanitizerToolName);
@@ -200,13 +199,22 @@ void ProtectGap(uptr addr, uptr size, uptr zero_base_shadow_start,
 
 #endif  // !SANITIZER_FUCHSIA
 
+#if !SANITIZER_WINDOWS && !SANITIZER_GO
+// Weak default implementation for when sanitizer_stackdepot is not linked in.
+SANITIZER_WEAK_ATTRIBUTE void StackDepotStopBackgroundThread() {}
+static void StopStackDepotBackgroundThread() {
+  StackDepotStopBackgroundThread();
+}
+#else
+// SANITIZER_WEAK_ATTRIBUTE is unsupported.
+static void StopStackDepotBackgroundThread() {}
+#endif
+
 }  // namespace __sanitizer
 
 SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_sandbox_on_notify,
                              __sanitizer_sandbox_arguments *args) {
-#if (SANITIZER_LINUX || SANITIZER_NETBSD) && !SANITIZER_GO
-  __sanitizer::StackDepotStopBackgroundThread();
-#endif
+  __sanitizer::StopStackDepotBackgroundThread();
   __sanitizer::PlatformPrepareForSandboxing(args);
   if (__sanitizer::sandboxing_callback)
     __sanitizer::sandboxing_callback();


        


More information about the llvm-commits mailing list