diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2011-11-09 03:46:20 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2011-11-09 03:46:20 +0000 |
commit | 6e46ca2c1065a50318bdbb47437709ff4f45acc3 (patch) | |
tree | 2cf6c5a7d3075256b7a75b76771b7732881b11a3 /clang/lib/Driver/ToolChains.cpp | |
parent | a6db70b049ded3704a2e3cd190733f5abd3cdd82 (diff) | |
download | bcm5719-llvm-6e46ca2c1065a50318bdbb47437709ff4f45acc3.tar.gz bcm5719-llvm-6e46ca2c1065a50318bdbb47437709ff4f45acc3.zip |
Fix an issue that Duncan discovered on a specific (no longer current)
version of Ubuntu. It has a very broken multiarch configuration, and so
we need special logic to handle it correctly. Fixing and testing this
uncovered a few other trivial issues with the logic that are fixed as
well.
I added tests to cover this as it is hard to notice if you install
recent versions of the OS.
llvm-svn: 144165
Diffstat (limited to 'clang/lib/Driver/ToolChains.cpp')
-rw-r--r-- | clang/lib/Driver/ToolChains.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp index e5f82bab7db..79eff7b9cda 100644 --- a/clang/lib/Driver/ToolChains.cpp +++ b/clang/lib/Driver/ToolChains.cpp @@ -1146,7 +1146,7 @@ Generic_GCC::GCCInstallationDetector::GCCInstallationDetector(const Driver &D) if (!llvm::sys::fs::exists(LibDir)) continue; for (unsigned k = 0, ke = CandidateTriples.size(); k < ke; ++k) - ScanLibDirForGCCTriple(LibDir, CandidateTriples[k]); + ScanLibDirForGCCTriple(HostArch, LibDir, CandidateTriples[k]); } } } @@ -1226,7 +1226,8 @@ Generic_GCC::GCCInstallationDetector::GCCInstallationDetector(const Driver &D) } void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( - const std::string &LibDir, StringRef CandidateTriple) { + llvm::Triple::ArchType HostArch, const std::string &LibDir, + StringRef CandidateTriple) { // There are various different suffixes involving the triple we // check for. We also record what is necessary to walk from each back // up to the lib directory. @@ -1238,7 +1239,7 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( // match. // FIXME: It may be worthwhile to generalize this and look for a second // triple. - "/" + CandidateTriple.str() + "/gcc/i686-linux-gnu" + "/i386-linux-gnu/gcc/" + CandidateTriple.str() }; const std::string InstallSuffixes[] = { "/../../..", @@ -1247,7 +1248,7 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( }; // Only look at the final, weird Ubuntu suffix for i386-linux-gnu. const unsigned NumSuffixes = (llvm::array_lengthof(Suffixes) - - (CandidateTriple != "i386-linux-gnu")); + (HostArch != llvm::Triple::x86)); for (unsigned i = 0; i < NumSuffixes; ++i) { StringRef Suffix = Suffixes[i]; llvm::error_code EC; @@ -1889,12 +1890,9 @@ Linux::Linux(const HostInfo &Host, const llvm::Triple &Triple) if (!Suffix.empty()) addPathIfExists(GCCInstallation.getInstallPath(), Paths); addPathIfExists(LibPath + "/../" + GccTriple + "/lib", Paths); - addPathIfExists(LibPath + "/" + MultiarchTriple, Paths); addPathIfExists(LibPath, Paths); } - addPathIfExists(SysRoot + "/lib/" + MultiarchTriple, Paths); addPathIfExists(SysRoot + "/lib", Paths); - addPathIfExists(SysRoot + "/usr/lib/" + MultiarchTriple, Paths); addPathIfExists(SysRoot + "/usr/lib", Paths); } @@ -2002,7 +2000,7 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs, for (ArrayRef<StringRef>::iterator I = MultiarchIncludeDirs.begin(), E = MultiarchIncludeDirs.end(); I != E; ++I) { - if (llvm::sys::fs::exists(*I)) { + if (llvm::sys::fs::exists(D.SysRoot + *I)) { addExternCSystemInclude(DriverArgs, CC1Args, D.SysRoot + *I); break; } |