Index: lib/asan/CMakeLists.txt =================================================================== --- lib/asan/CMakeLists.txt +++ lib/asan/CMakeLists.txt @@ -100,7 +100,6 @@ append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread ASAN_DYNAMIC_LIBS) append_list_if(COMPILER_RT_HAS_LIBLOG log ASAN_DYNAMIC_LIBS) append_list_if(MINGW "${MINGW_LIBRARIES}" ASAN_DYNAMIC_LIBS) -append_list_if(MINGW psapi ASAN_DYNAMIC_LIBS) # Compile ASan sources into an object library. Index: lib/sanitizer_common/sanitizer_win.cc =================================================================== --- lib/sanitizer_common/sanitizer_win.cc +++ lib/sanitizer_common/sanitizer_win.cc @@ -29,6 +29,14 @@ #include "sanitizer_placement_new.h" #include "sanitizer_win_defs.h" +#if defined(PSAPI_VERSION) && PSAPI_VERSION == 1 +#ifdef __MINGW32__ +#pragma comment(lib, "libpsapi.a") +#else +#pragma comment(lib, "psapi") +#endif +#endif + // 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