Skip to content

Commit 80c95bb

Browse files
committed
[sanitizer] Fix compress_stack_depot.cpp test on Darwin
All platforms which can start the thread should stop it as well.
1 parent 44d23d5 commit 80c95bb

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ namespace __sanitizer {
2222
#if (SANITIZER_LINUX || SANITIZER_NETBSD) && !SANITIZER_GO
2323
// Weak default implementation for when sanitizer_stackdepot is not linked in.
2424
SANITIZER_WEAK_ATTRIBUTE StackDepotStats StackDepotGetStats() { return {}; }
25-
SANITIZER_WEAK_ATTRIBUTE void StackDepotStopBackgroundThread() {}
2625

2726
void *BackgroundThread(void *arg) {
2827
VPrintf(1, "%s: Started BackgroundThread\n", SanitizerToolName);
@@ -200,13 +199,22 @@ void ProtectGap(uptr addr, uptr size, uptr zero_base_shadow_start,
200199

201200
#endif // !SANITIZER_FUCHSIA
202201

202+
#if !SANITIZER_WINDOWS && !SANITIZER_GO
203+
// Weak default implementation for when sanitizer_stackdepot is not linked in.
204+
SANITIZER_WEAK_ATTRIBUTE void StackDepotStopBackgroundThread() {}
205+
static void StopStackDepotBackgroundThread() {
206+
StackDepotStopBackgroundThread();
207+
}
208+
#else
209+
// SANITIZER_WEAK_ATTRIBUTE is unsupported.
210+
static void StopStackDepotBackgroundThread() {}
211+
#endif
212+
203213
} // namespace __sanitizer
204214

205215
SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_sandbox_on_notify,
206216
__sanitizer_sandbox_arguments *args) {
207-
#if (SANITIZER_LINUX || SANITIZER_NETBSD) && !SANITIZER_GO
208-
__sanitizer::StackDepotStopBackgroundThread();
209-
#endif
217+
__sanitizer::StopStackDepotBackgroundThread();
210218
__sanitizer::PlatformPrepareForSandboxing(args);
211219
if (__sanitizer::sandboxing_callback)
212220
__sanitizer::sandboxing_callback();

0 commit comments

Comments
 (0)