Fix passing stdc++ correctly in the FreeBSD toolchain support, Credit to Roman Divacky.

llvm-svn: 89205
This commit is contained in:
Edward O'Callaghan 2009-11-18 14:51:31 +00:00
parent fb4ff27367
commit c14422223b
1 changed files with 2 additions and 4 deletions

View File

@ -2609,6 +2609,8 @@ void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
// 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 (D.CCCIsCXX)
CmdArgs.push_back("-lstdc++");
if (Args.hasArg(options::OPT_static)) {
CmdArgs.push_back("-lgcc_eh");
} else {
@ -2638,10 +2640,6 @@ void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
else
CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, "crtendS.o")));
CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, "crtn.o")));
// FIXME: g++ is more complicated here, it tries to put -lstdc++
// before -lm, for example.
if (D.CCCIsCXX)
CmdArgs.push_back("-lstdc++");
}
const char *Exec =