For linking on FreeBSD, don't add a hardcoded "-L/usr/lib", but

retrieve the library paths from the ToolChain object instead.

Copy the relevant code from linuxtools::Link::ConstructJob(), and
replace the std::string stuff with llvm::StringRef, while we're here.

Patch by Dimitry Andric!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126757 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Roman Divacky 2011-03-01 17:53:14 +00:00
Родитель cfe9af250f
Коммит 58e5ac9d41
1 изменённых файлов: 7 добавлений и 7 удалений

Просмотреть файл

@ -3274,7 +3274,10 @@ void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
}
Args.AddAllArgs(CmdArgs, options::OPT_L);
CmdArgs.push_back("-L/usr/lib");
const ToolChain::path_list Paths = getToolChain().getFilePaths();
for (ToolChain::path_list::const_iterator i = Paths.begin(), e = Paths.end();
i != e; ++i)
CmdArgs.push_back(Args.MakeArgString(llvm::StringRef("-L") + *i));
Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
Args.AddAllArgs(CmdArgs, options::OPT_e);
Args.AddAllArgs(CmdArgs, options::OPT_s);
@ -3639,12 +3642,9 @@ void linuxtools::Link::ConstructJob(Compilation &C, const JobAction &JA,
const ToolChain::path_list Paths = ToolChain.getFilePaths();
for (ToolChain::path_list::const_iterator i = Paths.begin(),
e = Paths.end();
i != e; ++i) {
const std::string &s = *i;
CmdArgs.push_back(Args.MakeArgString(std::string("-L") + s));
}
for (ToolChain::path_list::const_iterator i = Paths.begin(), e = Paths.end();
i != e; ++i)
CmdArgs.push_back(Args.MakeArgString(llvm::StringRef("-L") + *i));
AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs);