[clang] [clang] enable mingw fuzzer support (PR #118688)

via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 4 11:37:27 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: cqwrteur (trcrsired)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/118688.diff


1 Files Affected:

- (modified) clang/lib/Driver/ToolChains/MinGW.cpp (+7) 


``````````diff
diff --git a/clang/lib/Driver/ToolChains/MinGW.cpp b/clang/lib/Driver/ToolChains/MinGW.cpp
index 963de81027ca9f..039f124ebbdbe3 100644
--- a/clang/lib/Driver/ToolChains/MinGW.cpp
+++ b/clang/lib/Driver/ToolChains/MinGW.cpp
@@ -218,6 +218,11 @@ void tools::MinGW::Linker::ConstructJob(Compilation &C, const JobAction &JA,
     CmdArgs.push_back(
         TC.getCompilerRTArgString(Args, "asan_dynamic", ToolChain::FT_Shared));
   }
+  if (Sanitize.needsFuzzer() && !Args.hasArg(options::OPT_nostdlib) &&
+      !Args.hasArg(options::OPT_nodefaultlibs)) {
+    CmdArgs.push_back(
+        TC.getCompilerRTArgString(Args, "fuzzer", ToolChain::FT_Static));
+  }
 
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
     if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_mdll)) {
@@ -617,6 +622,8 @@ SanitizerMask toolchains::MinGW::getSupportedSanitizers() const {
   Res |= SanitizerKind::PointerCompare;
   Res |= SanitizerKind::PointerSubtract;
   Res |= SanitizerKind::Vptr;
+  Res |= SanitizerKind::Fuzzer;
+  Res |= SanitizerKind::FuzzerNoLink;
   return Res;
 }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/118688


More information about the cfe-commits mailing list