forked from OSchip/llvm-project
Adjust the object files to be linked in when mcount profiling
is specified in the FreeBSD linker driver. llvm-svn: 125285
This commit is contained in:
parent
ce318e4958
commit
66f2276aee
|
@ -3179,8 +3179,12 @@ void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
if (!Args.hasArg(options::OPT_nostdlib) &&
|
||||
!Args.hasArg(options::OPT_nostartfiles)) {
|
||||
if (!Args.hasArg(options::OPT_shared)) {
|
||||
CmdArgs.push_back(Args.MakeArgString(
|
||||
getToolChain().GetFilePath("crt1.o")));
|
||||
if (Args.hasArg(options::OPT_pg))
|
||||
CmdArgs.push_back(Args.MakeArgString(
|
||||
getToolChain().GetFilePath("gcrt1.o")));
|
||||
else
|
||||
CmdArgs.push_back(Args.MakeArgString(
|
||||
getToolChain().GetFilePath("crt1.o")));
|
||||
CmdArgs.push_back(Args.MakeArgString(
|
||||
getToolChain().GetFilePath("crti.o")));
|
||||
CmdArgs.push_back(Args.MakeArgString(
|
||||
|
@ -3208,13 +3212,21 @@ void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
!Args.hasArg(options::OPT_nodefaultlibs)) {
|
||||
if (D.CCCIsCXX) {
|
||||
getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
|
||||
CmdArgs.push_back("-lm");
|
||||
if (Args.hasArg(options::OPT_pg))
|
||||
CmdArgs.push_back("-lm_p");
|
||||
else
|
||||
CmdArgs.push_back("-lm");
|
||||
}
|
||||
// FIXME: For some reason GCC passes -lgcc and -lgcc_s before adding
|
||||
// the default system libraries. Just mimic this for now.
|
||||
CmdArgs.push_back("-lgcc");
|
||||
if (Args.hasArg(options::OPT_pg))
|
||||
CmdArgs.push_back("-lgcc_p");
|
||||
else
|
||||
CmdArgs.push_back("-lgcc");
|
||||
if (Args.hasArg(options::OPT_static)) {
|
||||
CmdArgs.push_back("-lgcc_eh");
|
||||
} else if (Args.hasArg(options::OPT_pg)) {
|
||||
CmdArgs.push_back("-lgcc_eh_p");
|
||||
} else {
|
||||
CmdArgs.push_back("--as-needed");
|
||||
CmdArgs.push_back("-lgcc_s");
|
||||
|
@ -3222,12 +3234,26 @@ void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
}
|
||||
|
||||
if (Args.hasArg(options::OPT_pthread))
|
||||
CmdArgs.push_back("-lpthread");
|
||||
CmdArgs.push_back("-lc");
|
||||
if (Args.hasArg(options::OPT_pg))
|
||||
CmdArgs.push_back("-lpthread_p");
|
||||
else
|
||||
CmdArgs.push_back("-lpthread");
|
||||
|
||||
if (Args.hasArg(options::OPT_pg)) {
|
||||
if (Args.hasArg(options::OPT_shared))
|
||||
CmdArgs.push_back("-lc");
|
||||
else
|
||||
CmdArgs.push_back("-lc_p");
|
||||
CmdArgs.push_back("-lgcc_p");
|
||||
} else {
|
||||
CmdArgs.push_back("-lc");
|
||||
CmdArgs.push_back("-lgcc");
|
||||
}
|
||||
|
||||
CmdArgs.push_back("-lgcc");
|
||||
if (Args.hasArg(options::OPT_static)) {
|
||||
CmdArgs.push_back("-lgcc_eh");
|
||||
} else if (Args.hasArg(options::OPT_pg)) {
|
||||
CmdArgs.push_back("-lgcc_eh_p");
|
||||
} else {
|
||||
CmdArgs.push_back("--as-needed");
|
||||
CmdArgs.push_back("-lgcc_s");
|
||||
|
|
Loading…
Reference in New Issue