diff options
author | Dean Michael Berris <dberris@google.com> | 2016-07-14 04:58:44 +0000 |
---|---|---|
committer | Dean Michael Berris <dberris@google.com> | 2016-07-14 04:58:44 +0000 |
commit | 39baab932677792de8ff028970d3aa8f8700c54f (patch) | |
tree | 182a4b6d1a98c8f00b5721f1503780abf7e3e2cd /clang/lib/Driver/Tools.cpp | |
parent | 52735fc435b1c8ea926c2ac3ba31ab6335976838 (diff) | |
download | bcm5719-llvm-39baab932677792de8ff028970d3aa8f8700c54f.tar.gz bcm5719-llvm-39baab932677792de8ff028970d3aa8f8700c54f.zip |
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
llvm-svn: 275368
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index e4dd0c6f6c0..5437ef8f5af 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -3193,12 +3193,17 @@ static bool addXRayRuntime(const ToolChain &TC, const ArgList &Args, 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, const JobAction &JA, 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(Compilation &C, const JobAction &JA, linkSanitizerRuntimeDeps(ToolChain, CmdArgs); if (NeedsXRayDeps) - linkXRayRuntimeDeps(ToolChain, CmdArgs); + linkXRayRuntimeDeps(ToolChain, Args, CmdArgs); bool WantPthread = Args.hasArg(options::OPT_pthread) || Args.hasArg(options::OPT_pthreads); |