return Args.hasArg(options::OPT_fobjc_link_runtime);
}
-static void addProfileRT(const ToolChain &TC, const ArgList &Args,
- ArgStringList &CmdArgs,
- llvm::Triple Triple) {
- if (!(Args.hasArg(options::OPT_fprofile_arcs) ||
- Args.hasArg(options::OPT_fprofile_generate) ||
- Args.hasArg(options::OPT_fprofile_instr_generate) ||
- Args.hasArg(options::OPT_fcreate_profile) ||
- Args.hasArg(options::OPT_coverage)))
- return;
-
- // GCC links libgcov.a by adding -L<inst>/gcc/lib/gcc/<triple>/<ver> -lgcov to
- // the link line. We cannot do the same thing because unlike gcov there is a
- // libprofile_rt.so. We used to use the -l:libprofile_rt.a syntax, but that is
- // not supported by old linkers.
- std::string ProfileRT =
- std::string(TC.getDriver().Dir) + "/../lib/libprofile_rt.a";
-
- CmdArgs.push_back(Args.MakeArgString(ProfileRT));
-}
-
static bool forwardToGCC(const Option &O) {
// Don't forward inputs from the original command line. They are added from
// InputInfoList.
return TC.getArchName();
}
+static StringRef getOSNameForCompilerRTLib(const ToolChain &TC) {
+ return TC.getOS();
+}
+
// This adds the static libclang_rt.arch.a directly to the command line
// FIXME: Make sure we can also emit shared objects if they're requested
// and available, check for possible errors, etc.
CmdArgs.push_back("-lgcc_eh");
}
-static void addProfileRTLinux(
+static void addProfileRT(
const ToolChain &TC, const ArgList &Args, ArgStringList &CmdArgs) {
if (!(Args.hasArg(options::OPT_fprofile_arcs) ||
Args.hasArg(options::OPT_fprofile_generate) ||
Args.hasArg(options::OPT_coverage)))
return;
- // The profile runtime is located in the Linux library directory and has name
- // "libclang_rt.profile-<ArchName>.a".
+ // The profile runtime is located in the OS-specific resource directory and
+ // has name "libclang_rt.profile-<ArchName>.a".
SmallString<128> LibProfile(TC.getDriver().ResourceDir);
llvm::sys::path::append(
- LibProfile, "lib", "linux",
+ LibProfile, "lib", getOSNameForCompilerRTLib(TC),
Twine("libclang_rt.profile-") + getArchNameForCompilerRTLib(TC) + ".a");
CmdArgs.push_back(Args.MakeArgString(LibProfile));
}
CmdArgs.push_back(Args.MakeArgString(LibPath + "crtn.o"));
- addProfileRT(getToolChain(), Args, CmdArgs, getToolChain().getTriple());
+ addProfileRT(getToolChain(), Args, CmdArgs);
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath("ld"));
getToolChain().GetFilePath("crtend.o")));
}
- addProfileRT(getToolChain(), Args, CmdArgs, getToolChain().getTriple());
+ addProfileRT(getToolChain(), Args, CmdArgs);
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath("ld"));
CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtn.o")));
}
- addProfileRT(ToolChain, Args, CmdArgs, ToolChain.getTriple());
+ addProfileRT(ToolChain, Args, CmdArgs);
const char *Exec =
Args.MakeArgString(ToolChain.GetProgramPath("ld"));
"crtn.o")));
}
- addProfileRT(getToolChain(), Args, CmdArgs, getToolChain().getTriple());
+ addProfileRT(getToolChain(), Args, CmdArgs);
const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("ld"));
C.addCommand(new Command(JA, *this, Exec, CmdArgs));
addDfsanRTLinux(getToolChain(), Args, CmdArgs);
// The profile runtime also needs access to system libraries.
- addProfileRTLinux(getToolChain(), Args, CmdArgs);
+ addProfileRT(getToolChain(), Args, CmdArgs);
if (D.CCCIsCXX() &&
!Args.hasArg(options::OPT_nostdlib) &&
AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
- addProfileRT(getToolChain(), Args, CmdArgs, getToolChain().getTriple());
+ addProfileRT(getToolChain(), Args, CmdArgs);
if (!Args.hasArg(options::OPT_nostdlib) &&
!Args.hasArg(options::OPT_nodefaultlibs)) {
getToolChain().GetFilePath("crtn.o")));
}
- addProfileRT(getToolChain(), Args, CmdArgs, getToolChain().getTriple());
+ addProfileRT(getToolChain(), Args, CmdArgs);
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath("ld"));