[PATCH] D28435: [compiler-rt] Define delimiters for sanitizer coverage's binary section on Windows.

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 6 20:25:49 PST 2017


mpividori created this revision.
mpividori added reviewers: kcc, aizatsky, rnk, zturner.
mpividori added a subscriber: llvm-commits.
mpividori set the repository for this revision to rL LLVM.
Herald added subscribers: mgorny, dberris, kubabrecka.

Related to the changes explained in: https://reviews.llvm.org/D28434
`___[start|stop]___sancov_guard` should be defined only once per module, because of that, I include them inside the static asan runtime: "clang_rt.asan_dynamic_runtime_thunk", that will be included in both, dlls and executables.


Repository:
  rL LLVM

https://reviews.llvm.org/D28435

Files:
  lib/asan/CMakeLists.txt
  lib/asan/asan_win_coverage_sections.cc


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 <stdint.h>
+#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
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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28435.83495.patch
Type: text/x-patch
Size: 1472 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170107/7680bfee/attachment.bin>


More information about the llvm-commits mailing list