[PATCH] D51008: Enable -fsanitize=fuzzer and -fsanitize=fuzzer-no-link on Windows.
Jonathan Metzman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 20 16:17:12 PDT 2018
metzman created this revision.
Herald added a subscriber: cfe-commits.
This allows -fsanitize=fuzzer and -fsanitize=fuzzer-no-link to be used on Windows.
When either used, Clang will also use some default flags that are needed (such as incremental linking and debug).
Repository:
rC Clang
https://reviews.llvm.org/D51008
Files:
lib/Driver/ToolChains/MSVC.cpp
Index: lib/Driver/ToolChains/MSVC.cpp
===================================================================
--- lib/Driver/ToolChains/MSVC.cpp
+++ lib/Driver/ToolChains/MSVC.cpp
@@ -365,6 +365,17 @@
CmdArgs.push_back(Args.MakeArgString(std::string("-implib:") + ImplibName));
}
+ if (TC.getSanitizerArgs().needsFuzzer()) {
+ if (!Args.hasArg(options::OPT_shared))
+ CmdArgs.push_back(
+ Args.MakeArgString(std::string("-wholearchive:") +
+ TC.getCompilerRTArgString(Args, "fuzzer", false)));
+ CmdArgs.push_back(Args.MakeArgString("-debug"));
+ // Prevent the linker from padding sections we use for instrumentation
+ // arrays.
+ CmdArgs.push_back(Args.MakeArgString("-incremental:no"));
+ }
+
if (TC.getSanitizerArgs().needsAsanRt()) {
CmdArgs.push_back(Args.MakeArgString("-debug"));
CmdArgs.push_back(Args.MakeArgString("-incremental:no"));
@@ -1298,6 +1309,8 @@
SanitizerMask MSVCToolChain::getSupportedSanitizers() const {
SanitizerMask Res = ToolChain::getSupportedSanitizers();
Res |= SanitizerKind::Address;
+ Res |= SanitizerKind::Fuzzer;
+ Res |= SanitizerKind::FuzzerNoLink;
Res &= ~SanitizerKind::CFIMFCall;
return Res;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51008.161606.patch
Type: text/x-patch
Size: 1231 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180820/e1b849c8/attachment-0001.bin>
More information about the cfe-commits
mailing list