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

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


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

None

>From 72bc42bdb9a1ad5959655aa194093411a2f372e2 Mon Sep 17 00:00:00 2001
From: trcrsired <uwgghhbcad at gmail.com>
Date: Wed, 4 Dec 2024 14:31:24 -0500
Subject: [PATCH] [clang] enable mingw fuzzer support

---
 clang/lib/Driver/ToolChains/MinGW.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

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;
 }
 



More information about the cfe-commits mailing list