diff options
| author | Roman Divacky <rdivacky@freebsd.org> | 2011-03-01 17:53:14 +0000 |
|---|---|---|
| committer | Roman Divacky <rdivacky@freebsd.org> | 2011-03-01 17:53:14 +0000 |
| commit | ee8188a23b5ba453271c3af12ec2610b92a3b163 (patch) | |
| tree | 9e2d6a68ccc23b531d85126c430d747ce63f8ee3 /clang/lib | |
| parent | 65b88cdb3bd34e5000b30533fa1599c959029719 (diff) | |
| download | bcm5719-llvm-ee8188a23b5ba453271c3af12ec2610b92a3b163.tar.gz bcm5719-llvm-ee8188a23b5ba453271c3af12ec2610b92a3b163.zip | |
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!
llvm-svn: 126757
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Driver/Tools.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 2e11d30d042..0205cf6ff26 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -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); |

