diff options
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
| -rw-r--r-- | clang/lib/Driver/Tools.cpp | 14 |
1 files changed, 8 insertions, 6 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( |

