r275368 - Add C++ dependencies to xray runtime
Dean Michael Berris via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 13 21:58:44 PDT 2016
Author: dberris
Date: Wed Jul 13 23:58:44 2016
New Revision: 275368
URL: http://llvm.org/viewvc/llvm-project?rev=275368&view=rev
Log:
Add C++ dependencies to xray runtime
Summary:
Depends on D21982 which implements the in-memory logging implementation of the
XRay runtime. These additional changes also depends on D20352 which adds the
bulk of XRay flags/dependencies when using the `-fxray-instrument` flag from
Clang.
Reviewers: echristo, rnk, aaron.ballman
Subscribers: mehdi_amini, cfe-commits
Differential Revision: http://reviews.llvm.org/D21983
Modified:
cfe/trunk/lib/Driver/Tools.cpp
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=275368&r1=275367&r2=275368&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Jul 13 23:58:44 2016
@@ -3193,12 +3193,17 @@ static bool addXRayRuntime(const ToolCha
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 @@ void Clang::ConstructJob(Compilation &C,
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 @@ void gnutools::Linker::ConstructJob(Comp
linkSanitizerRuntimeDeps(ToolChain, CmdArgs);
if (NeedsXRayDeps)
- linkXRayRuntimeDeps(ToolChain, CmdArgs);
+ linkXRayRuntimeDeps(ToolChain, Args, CmdArgs);
bool WantPthread = Args.hasArg(options::OPT_pthread) ||
Args.hasArg(options::OPT_pthreads);
More information about the cfe-commits
mailing list