summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-03-28 17:53:17 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-03-28 17:53:17 +0000
commit2d8f93e8692d743a17c737a5376b2051ad303320 (patch)
tree8d84d998e2a6cd2d196d004151b9f0ebed838258 /clang
parentf0ae3c2de29db0fe4aa4e934c83ec28968c26ee5 (diff)
downloadbcm5719-llvm-2d8f93e8692d743a17c737a5376b2051ad303320.tar.gz
bcm5719-llvm-2d8f93e8692d743a17c737a5376b2051ad303320.zip
Revert "Link in profile library on Linux using --whole-archive"
This reverts commit r205012. llvm-svn: 205022
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Driver/Tools.cpp14
-rw-r--r--clang/test/Driver/coverage-ld.c7
2 files changed, 10 insertions, 11 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index e4af66b7835..2141cc9656b 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -1817,16 +1817,18 @@ 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");
- 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());
+ CmdArgs.push_back(Args.MakeArgString(LibProfile));
}
static void addSanitizerRTLinkFlags(
diff --git a/clang/test/Driver/coverage-ld.c b/clang/test/Driver/coverage-ld.c
index bb70fe56c81..0e39249a2f3 100644
--- a/clang/test/Driver/coverage-ld.c
+++ b/clang/test/Driver/coverage-ld.c
@@ -16,11 +16,8 @@
// RUN: | FileCheck --check-prefix=CHECK-LINUX-X86-64 %s
//
// CHECK-LINUX-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
-// CHECK-LINUX-X86-64: "-whole-archive"
-// CHECK-LINUX-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.profile-x86_64.a"
-// CHECK-LINUX-X86-64: "-no-whole-archive"
-// CHECK-LINUX-X86-64: "-lc"
-
+// CHECK-LINUX-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.profile-x86_64.a" {{.*}} "-lc"
+//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: -target x86_64-unknown-freebsd --coverage \
// RUN: -resource-dir=%S/Inputs/resource_dir \
OpenPOWER on IntegriCloud