[PATCH] D45662: Fuzzer, add libcxx for OpenBSD

David CARLIER via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 16 23:38:41 PDT 2018


devnexen updated this revision to Diff 142740.
devnexen added a comment.

- Making base gcc 4.2.1 stdc++ having profile version supported as well.


https://reviews.llvm.org/D45662

Files:
  lib/Driver/ToolChains/OpenBSD.cpp
  lib/Driver/ToolChains/OpenBSD.h


Index: lib/Driver/ToolChains/OpenBSD.h
===================================================================
--- lib/Driver/ToolChains/OpenBSD.h
+++ lib/Driver/ToolChains/OpenBSD.h
@@ -58,6 +58,8 @@
   bool IsMathErrnoDefault() const override { return false; }
   bool IsObjCNonFragileABIDefault() const override { return true; }
   bool isPIEDefault() const override { return true; }
+  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
+                           llvm::opt::ArgStringList &CmdArgs) const override;
 
   unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
     return 2;
Index: lib/Driver/ToolChains/OpenBSD.cpp
===================================================================
--- lib/Driver/ToolChains/OpenBSD.cpp
+++ lib/Driver/ToolChains/OpenBSD.cpp
@@ -186,14 +186,17 @@
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
     if (D.CCCIsCXX()) {
       if (getToolChain().ShouldLinkCXXStdlib(Args))
-        getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
+        ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
       if (Args.hasArg(options::OPT_pg))
         CmdArgs.push_back("-lm_p");
       else
         CmdArgs.push_back("-lm");
     }
     if (NeedsSanitizerDeps) {
       CmdArgs.push_back(ToolChain.getCompilerRTArgString(Args, "builtins", false));
+      if (getToolChain().getSanitizerArgs().needsFuzzer() &&
+        !Args.hasArg(options::OPT_shared))
+        CmdArgs.push_back(Args.hasArg(options::OPT_pg) ? "-lc++_p" : "-lc++");
       linkSanitizerRuntimeDeps(ToolChain, CmdArgs);
     }
     if (NeedsXRayDeps) {
@@ -259,6 +262,12 @@
   getFilePaths().push_back("/usr/lib");
 }
 
+void OpenBSD::AddCXXStdlibLibArgs(const ArgList &Args,
+                                  ArgStringList &CmdArgs) const {
+  bool Profiling = Args.hasArg(options::OPT_pg);
+  CmdArgs.push_back(Profiling ? "-lstdc++_p" : "-lstdc++");
+}
+
 Tool *OpenBSD::buildAssembler() const {
   return new tools::openbsd::Assembler(*this);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45662.142740.patch
Type: text/x-patch
Size: 2009 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180417/bc78e0dc/attachment.bin>


More information about the cfe-commits mailing list