Index: lib/asan/CMakeLists.txt =================================================================== --- lib/asan/CMakeLists.txt +++ lib/asan/CMakeLists.txt @@ -222,6 +222,7 @@ ARCHS ${arch} SOURCES asan_win_dynamic_runtime_thunk.cc asan_globals_win.cc + asan_win_coverage_sections.cc CFLAGS ${ASAN_CFLAGS} ${DYNAMIC_RUNTIME_THUNK_CFLAGS} DEFS ${ASAN_COMMON_DEFINITIONS} PARENT_TARGET asan) Index: lib/asan/asan_win_coverage_sections.cc =================================================================== --- /dev/null +++ lib/asan/asan_win_coverage_sections.cc @@ -0,0 +1,20 @@ +//===-- asan_win_coverage_sections.cc -------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines delimiters for Sanitizer Coverage's section. +//===----------------------------------------------------------------------===// +#ifdef _WIN32 +#include +#pragma section(".SCOV$A", read, write) // NOLINT +#pragma section(".SCOV$Z", read, write) // NOLINT +extern "C" { +__declspec(allocate(".SCOV$A")) uint32_t __start___sancov_guards = 0; +__declspec(allocate(".SCOV$Z")) uint32_t __stop___sancov_guards = 0; +} +#endif // _WIN32