[PATCH] D51017: Enable -fsanitize=fuzzer and -fsanitize=fuzzer-no-link on Windows.

Jonathan Metzman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 20 17:09:53 PDT 2018


metzman created this revision.
Herald added a subscriber: llvm-commits.

This allows -fsanitize=fuzzer and -fsanitize=fuzzer-no-link for the MSVC toolchain (Windows).
It puts arrays for storing the PC  table, 8 bit counters, and coverage guards, in their own sections, so their sizes can be determined (since ___start isn't supported by linkers targeting MSVC toolchain).


Repository:
  rL LLVM

https://reviews.llvm.org/D51017

Files:
  lib/Transforms/Instrumentation/SanitizerCoverage.cpp


Index: lib/Transforms/Instrumentation/SanitizerCoverage.cpp
===================================================================
--- lib/Transforms/Instrumentation/SanitizerCoverage.cpp
+++ lib/Transforms/Instrumentation/SanitizerCoverage.cpp
@@ -806,8 +806,13 @@
 
 std::string
 SanitizerCoverageModule::getSectionName(const std::string &Section) const {
-  if (TargetTriple.getObjectFormat() == Triple::COFF)
-    return ".SCOV$M";
+  if (TargetTriple.getObjectFormat() == Triple::COFF) {
+    if (Section == SanCovCountersSectionName)
+      return ".SCOVC$M";
+    else if (Section == SanCovPCsSectionName)
+      return ".SCOVP$M";
+    return ".SCOVG$M";  // For SanCovGuardsSectionName.
+  }
   if (TargetTriple.isOSBinFormatMachO())
     return "__DATA,__" + Section;
   return "__" + Section;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51017.161625.patch
Type: text/x-patch
Size: 801 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180821/c3e9844b/attachment.bin>


More information about the llvm-commits mailing list