summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2015-05-12 00:31:33 +0000
committerJustin Bogner <mail@justinbogner.com>2015-05-12 00:31:33 +0000
commitf44ddae71e6464851dbafba0e40c66f9db9db4cf (patch)
tree43663af11218265bdf36b066009856dc31ea2de0 /clang/lib/Driver/Tools.cpp
parent18bbe191cdfe1b1bb64fc0d80ee5113f9cd56e4d (diff)
downloadbcm5719-llvm-f44ddae71e6464851dbafba0e40c66f9db9db4cf.tar.gz
bcm5719-llvm-f44ddae71e6464851dbafba0e40c66f9db9db4cf.zip
Driver: Make profiling flags work with -nostdlib on Darwin
Compiler-rt's Profiling library isn't part of the stdlib, so -nostdlib shouldn't prevent it from being linked. This makes Darwin behave like other toolchains, and link in the profile runtime irrespective of -nostdlib, since the resulting program can't be run unless you link this. I've also added a test to show that other toolchains already behave like this. llvm-svn: 237074
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r--clang/lib/Driver/Tools.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index e215b6eed5c..c1b51583a30 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -6328,6 +6328,11 @@ void darwin::Link::ConstructJob(Compilation &C, const JobAction &JA,
if (Args.hasArg(options::OPT_fnested_functions))
CmdArgs.push_back("-allow_stack_execute");
+ // TODO: It would be nice to use addProfileRT() here, but darwin's compiler-rt
+ // paths are different enough from other toolchains that this needs a fair
+ // amount of refactoring done first.
+ getMachOToolChain().addProfileRTLibs(Args, CmdArgs);
+
if (!Args.hasArg(options::OPT_nostdlib) &&
!Args.hasArg(options::OPT_nodefaultlibs)) {
if (getToolChain().getDriver().CCCIsCXX())
OpenPOWER on IntegriCloud