[PATCH] D21983: Add C++ dependencies to xray runtime

Dean Michael Berris via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 13 22:06:13 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL275368: Add C++ dependencies to xray runtime (authored by dberris).

Changed prior to commit:
  http://reviews.llvm.org/D21983?vs=63917&id=63919#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21983

Files:
  cfe/trunk/lib/Driver/Tools.cpp

Index: cfe/trunk/lib/Driver/Tools.cpp
===================================================================
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -3193,12 +3193,17 @@
   return false;
 }
 
-static void linkXRayRuntimeDeps(const ToolChain &TC, ArgStringList &CmdArgs) {
+static void linkXRayRuntimeDeps(const ToolChain &TC, const ArgList &Args,
+                                ArgStringList &CmdArgs) {
   CmdArgs.push_back("--no-as-needed");
   CmdArgs.push_back("-lpthread");
   CmdArgs.push_back("-lrt");
   CmdArgs.push_back("-lm");
   CmdArgs.push_back("-latomic");
+  if (TC.GetCXXStdlibType(Args) == ToolChain::CST_Libcxx)
+    CmdArgs.push_back("-lc++");
+  else
+    CmdArgs.push_back("-lstdc++");
   if (TC.getTriple().getOS() != llvm::Triple::FreeBSD)
     CmdArgs.push_back("-ldl");
 }
@@ -4604,6 +4609,16 @@
 
   Args.AddAllArgs(CmdArgs, options::OPT_finstrument_functions);
 
+  if (Args.hasArg(options::OPT_fxray_instrument,
+                  options::OPT_fnoxray_instrument, false)) {
+    CmdArgs.push_back("-fxray-instrument");
+    if (Arg *A = Args.getLastArg(options::OPT_fxray_instruction_threshold_,
+                                 options::OPT_fxray_instruction_threshold_EQ)) {
+      CmdArgs.push_back("-fxray-instruction-threshold");
+      CmdArgs.push_back(A->getValue());
+    }
+  }
+
   if (Args.hasFlag(options::OPT_fxray_instrument,
                    options::OPT_fnoxray_instrument, false)) {
     CmdArgs.push_back("-fxray-instrument");
@@ -9451,7 +9466,7 @@
         linkSanitizerRuntimeDeps(ToolChain, CmdArgs);
 
       if (NeedsXRayDeps)
-        linkXRayRuntimeDeps(ToolChain, CmdArgs);
+        linkXRayRuntimeDeps(ToolChain, Args, CmdArgs);
 
       bool WantPthread = Args.hasArg(options::OPT_pthread) ||
                          Args.hasArg(options::OPT_pthreads);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21983.63919.patch
Type: text/x-patch
Size: 1849 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160714/91e1f2b2/attachment.bin>


More information about the cfe-commits mailing list