From db29c030dfea83bbdaa05408bf37d46461adf008 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 16 Jul 2021 19:55:32 +0200 Subject: [PATCH] sanitizer_common: link Synchronization.lib on Windows Windows bot failed with: sanitizer_win.cpp.obj : error LNK2019: unresolved external symbol WaitOnAddress referenced in function "void __cdecl __sanitizer::FutexWait(struct __sanitizer::atomic_uint32_t *,unsigned int)" (?FutexWait@__sanitizer@@YAXPEAUatomic_uint32_t@1@I@Z) sanitizer_win.cpp.obj : error LNK2019: unresolved external symbol WakeByAddressSingle referenced in function "void __cdecl __sanitizer::FutexWake(struct __sanitizer::atomic_uint32_t *,unsigned int)" (?FutexWake@__sanitizer@@YAXPEAUatomic_uint32_t@1@I@Z) sanitizer_win.cpp.obj : error LNK2019: unresolved external symbol WakeByAddressAll referenced in function "void __cdecl __sanitizer::FutexWake(struct __sanitizer::atomic_uint32_t *,unsigned int)" (?FutexWake@__sanitizer@@YAXPEAUatomic_uint32_t@1@I@Z) https://lab.llvm.org/buildbot/#/builders/127/builds/14046 According to MSDN we need to link Synchronization.lib: https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitonaddress Differential Revision: https://reviews.llvm.org/D106167 --- compiler-rt/lib/sanitizer_common/sanitizer_win.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp index dcdcba7c6231..dda3b0e07069 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp @@ -44,6 +44,9 @@ TRACELOGGING_DEFINE_PROVIDER(g_asan_provider, "AddressSanitizerLoggingProvider", #define TraceLoggingUnregister(x) #endif +// For WaitOnAddress +# pragma comment(lib, "Synchronization.lib") + // A macro to tell the compiler that this part of the code cannot be reached, // if the compiler supports this feature. Since we're using this in // code that is called when terminating the process, the expansion of the