summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2014-03-28 15:39:08 +0000
committerAlexey Samsonov <samsonov@google.com>2014-03-28 15:39:08 +0000
commit4a37d60acab7aaaf94ed7d0768ef6355fe2a87f8 (patch)
tree4f0b1cb2ec43be0830754093b5e405222087e664 /clang/lib
parent03b1bc7a2a7056f26210f73d05d19b95d134e5d7 (diff)
downloadbcm5719-llvm-4a37d60acab7aaaf94ed7d0768ef6355fe2a87f8.tar.gz
bcm5719-llvm-4a37d60acab7aaaf94ed7d0768ef6355fe2a87f8.zip
Link in profile library on Linux using --whole-archive
llvm-svn: 205012
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Driver/Tools.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 2141cc9656b..e4af66b7835 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -1817,18 +1817,16 @@ static void addProfileRT(
Args.hasArg(options::OPT_coverage)))
return;
- // Pull in runtime for -fprofile-inst-generate. This is required since there
- // are no calls to the runtime in the code.
- if (Args.hasArg(options::OPT_fprofile_instr_generate)) {
- CmdArgs.push_back("-u");
- CmdArgs.push_back("___llvm_profile_runtime");
- }
-
SmallString<128> LibProfile = getCompilerRTLibDir(TC);
llvm::sys::path::append(LibProfile,
Twine("libclang_rt.profile-") + getArchNameForCompilerRTLib(TC) + ".a");
- CmdArgs.push_back(Args.MakeArgString(LibProfile));
+ SmallVector<const char *, 3> LibProfileArgs;
+ LibProfileArgs.push_back("-whole-archive");
+ LibProfileArgs.push_back(Args.MakeArgString(LibProfile));
+ LibProfileArgs.push_back("-no-whole-archive");
+
+ CmdArgs.insert(CmdArgs.end(), LibProfileArgs.begin(), LibProfileArgs.end());
}
static void addSanitizerRTLinkFlags(
OpenPOWER on IntegriCloud