]> granicus.if.org Git - clang/commitdiff
InstrProf: Pull in runtime on non-Darwin
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 27 Mar 2014 16:20:02 +0000 (16:20 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 27 Mar 2014 16:20:02 +0000 (16:20 +0000)
r204379 changed the way the profile runtime gets pulled in, but missed
updating non-Darwin targets.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204939 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp

index ea60551b00a9252ea589d68a491a79ea23700323..5b997e7d37933ff1adb2e9f5436056314a73e4f4 100644 (file)
@@ -1807,6 +1807,13 @@ 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");