diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2011-10-03 06:41:08 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2011-10-03 06:41:08 +0000 |
commit | fde8d14ea3061ff82e9dfddb23f17648c103eae6 (patch) | |
tree | 93f42aa6b247a8b4b7c2fb315a20e70a8fd97a80 /lib/Driver/ToolChains.cpp | |
parent | 491306a83c4f0f49f95a3bcbca8580cb98a91c7a (diff) |
Add initial support for applying the sysroot to library search paths.
This is still very much a WIP, but sysroot was completely broken before
this so we are moving closer to correctness.
The crux of this is that 'ld' (on Linux, the only place I'm touching
here) doesn't apply the sysroot to any flags given to it. Instead, the
driver must translate all the paths it adds to the link step with the
system root. This is easily observed by building a GCC that supports
sysroot, and checking its driver output.
This patch just fixes the non-multilib library search paths. We should
also use this in many other places, but first things first.
This also allows us to make the Linux 'ld' test independent of the host
system. This in turn will allow me to check in test tree configurations
based on various different distro's configuration. Again, WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140990 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains.cpp')
-rw-r--r-- | lib/Driver/ToolChains.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 1b2ff2ecb7..dd35172402 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -1560,6 +1560,7 @@ Linux::Linux(const HostInfo &Host, const llvm::Triple &Triple) : Generic_ELF(Host, Triple) { llvm::Triple::ArchType Arch = llvm::Triple(getDriver().DefaultHostTriple).getArch(); + const std::string &SysRoot = getDriver().SysRoot; bool Exists; std::string GccTriple = ""; @@ -1703,8 +1704,8 @@ Linux::Linux(const HostInfo &Host, const llvm::Triple &Triple) Multilib, Paths); addPathIfExists(Base + "/../../../../" + Multilib, Paths); } - addPathIfExists("/lib/../" + Multilib, Paths); - addPathIfExists("/usr/lib/../" + Multilib, Paths); + addPathIfExists(SysRoot + "/lib/../" + Multilib, Paths); + addPathIfExists(SysRoot + "/usr/lib/../" + Multilib, Paths); } // Add the non-multiplib suffixed paths (if potentially different). @@ -1714,11 +1715,11 @@ Linux::Linux(const HostInfo &Host, const llvm::Triple &Triple) addPathIfExists(Base + "/../../../../" + GccTriple + "/lib", Paths); addPathIfExists(Base + "/../../..", Paths); } - addPathIfExists("/lib", Paths); - addPathIfExists("/usr/lib", Paths); + addPathIfExists(SysRoot + "/lib", Paths); + addPathIfExists(SysRoot + "/usr/lib", Paths); if (Arch == getArch() && IsUbuntu(Distro)) - Paths.push_back("/usr/lib/" + GccTriple); + Paths.push_back(SysRoot + "/usr/lib/" + GccTriple); } bool Linux::HasNativeLLVMSupport() const { |