return hasCrtBeginObj(Path + Suffix);
}
-void Generic_GCC::GCCInstallationDetector::findMultiLibSuffix(
- std::string &Suffix,
- llvm::Triple::ArchType TargetArch,
- StringRef Path,
+void Generic_GCC::GCCInstallationDetector::findMIPSABIDirSuffix(
+ std::string &Suffix, llvm::Triple::ArchType TargetArch, StringRef Path,
const llvm::opt::ArgList &Args) {
if (!isMipsArch(TargetArch))
return;
if (CandidateVersion <= Version)
continue;
- std::string MultiLibSuffix;
- findMultiLibSuffix(MultiLibSuffix, TargetArch, LI->path(), Args);
+ std::string MIPSABIDirSuffix;
+ findMIPSABIDirSuffix(MIPSABIDirSuffix, TargetArch, LI->path(), Args);
// Some versions of SUSE and Fedora on ppc64 put 32-bit libs
// in what would normally be GCCInstallPath and put the 64-bit
std::string BiarchSuffix;
if (findTargetBiarchSuffix(BiarchSuffix,
- LI->path() + MultiLibSuffix,
+ LI->path() + MIPSABIDirSuffix,
TargetArch, Args)) {
GCCBiarchSuffix = BiarchSuffix;
} else if (NeedsBiarchSuffix ||
- !hasCrtBeginObj(LI->path() + MultiLibSuffix)) {
+ !hasCrtBeginObj(LI->path() + MIPSABIDirSuffix)) {
continue;
} else {
GCCBiarchSuffix.clear();
// Linux.
GCCInstallPath = LibDir + LibSuffixes[i] + "/" + VersionText.str();
GCCParentLibPath = GCCInstallPath + InstallSuffixes[i];
- GCCMultiLibSuffix = MultiLibSuffix;
+ GCCMIPSABIDirSuffix = MIPSABIDirSuffix;
IsValid = true;
}
}
//
// FIXME: It would be cleaner to model this as a variant of bi-arch. IE,
// instead of a '64' biarch suffix it would be 'el' or something.
- //
- // FIXME: it is also deeply confusing that the suffix is called
- // 'MultiLibSuffix' on the GCCInstallation class. It has nothing to do with
- // multilib setups, and much more in common with a combined biarch and
- // multiarch suffix set. (biarch for the GCC installation, multiarch for
- // the lib directories.)
if (IsAndroid && IsMips && isMips32r2(Args)) {
assert(GCCInstallation.getBiarchSuffix().empty() &&
"Unexpected bi-arch suffix");
addPathIfExists(GCCInstallation.getInstallPath() + "/mips-r2", Paths);
} else {
addPathIfExists((GCCInstallation.getInstallPath() +
- GCCInstallation.getMultiLibSuffix() +
+ GCCInstallation.getMIPSABIDirSuffix() +
GCCInstallation.getBiarchSuffix()),
Paths);
}
//
// Note that this matches the GCC behavior. See the below comment for where
// Clang diverges from GCC's behavior.
- //
- // FIXME: The GCCInstallation MultiLibSuffix is totally orthogonal from the
- // Multilib directory component. It is misnamed and needs clarification.
addPathIfExists(LibPath + "/../" + GCCTriple.str() + "/lib/../" + Multilib +
- GCCInstallation.getMultiLibSuffix(),
+ GCCInstallation.getMIPSABIDirSuffix(),
Paths);
// If the GCC installation we found is inside of the sysroot, we want to
const llvm::Triple &GCCTriple = GCCInstallation.getTriple();
if (!GCCInstallation.getBiarchSuffix().empty())
addPathIfExists(GCCInstallation.getInstallPath() +
- GCCInstallation.getMultiLibSuffix(), Paths);
+ GCCInstallation.getMIPSABIDirSuffix(), Paths);
// See comments above on the multilib variant for details of why this is
// included even from outside the sysroot.
addPathIfExists(LibPath + "/../" + GCCTriple.str() +
- "/lib" + GCCInstallation.getMultiLibSuffix(), Paths);
+ "/lib" + GCCInstallation.getMIPSABIDirSuffix(), Paths);
// See comments above on the multilib variant for details of why this is
// only included from within the sysroot.
const StringRef InstallDir = GCCInstallation.getInstallPath();
const StringRef TripleStr = GCCInstallation.getTriple().str();
- const StringRef MultiLibSuffix = GCCInstallation.getMultiLibSuffix();
+ const StringRef MIPSABIDirSuffix = GCCInstallation.getMIPSABIDirSuffix();
- std::string Path =
- (InstallDir + "/../../../../" + TripleStr + "/libc" + MultiLibSuffix).str();
+ std::string Path = (InstallDir + "/../../../../" + TripleStr + "/libc" +
+ MIPSABIDirSuffix).str();
if (llvm::sys::fs::exists(Path))
return Path;
- Path = (InstallDir + "/../../../../sysroot" + MultiLibSuffix).str();
+ Path = (InstallDir + "/../../../../sysroot" + MIPSABIDirSuffix).str();
if (llvm::sys::fs::exists(Path))
return Path;
/// libstdc++ installation.
/*static*/ bool Linux::addLibStdCXXIncludePaths(Twine Base, Twine Suffix,
Twine TargetArchDir,
- Twine MultiLibSuffix,
+ Twine BiarchSuffix,
+ Twine MIPSABIDirSuffix,
const ArgList &DriverArgs,
ArgStringList &CC1Args) {
- if (!addLibStdCXXIncludePaths(Base+Suffix, TargetArchDir + MultiLibSuffix,
+ // FIXME: The MIPS folks added this code with the MIPS ABI suffix *preceding*
+ // the biarch suffix here, but following it almost everywhere else. This is
+ // almost certainly a bug, or if not, the most confusing part of the MIPS
+ // toolchain tree layout.
+ if (!addLibStdCXXIncludePaths(Base + Suffix,
+ TargetArchDir + MIPSABIDirSuffix + BiarchSuffix,
DriverArgs, CC1Args))
return false;
addSystemInclude(DriverArgs, CC1Args, Base + "/" + TargetArchDir + Suffix
- + MultiLibSuffix);
+ + MIPSABIDirSuffix + BiarchSuffix);
return true;
}
StringRef LibDir = GCCInstallation.getParentLibPath();
StringRef InstallDir = GCCInstallation.getInstallPath();
StringRef TripleStr = GCCInstallation.getTriple().str();
- StringRef MultiLibSuffix = GCCInstallation.getMultiLibSuffix();
+ StringRef MIPSABIDirSuffix = GCCInstallation.getMIPSABIDirSuffix();
StringRef BiarchSuffix = GCCInstallation.getBiarchSuffix();
const GCCVersion &Version = GCCInstallation.getVersion();
- if (addLibStdCXXIncludePaths(
- LibDir.str() + "/../include", "/c++/" + Version.Text, TripleStr,
- MultiLibSuffix + BiarchSuffix, DriverArgs, CC1Args))
+ if (addLibStdCXXIncludePaths(LibDir.str() + "/../include",
+ "/c++/" + Version.Text, TripleStr, BiarchSuffix,
+ MIPSABIDirSuffix, DriverArgs, CC1Args))
return;
const std::string IncludePathCandidates[] = {
};
for (unsigned i = 0; i < llvm::array_lengthof(IncludePathCandidates); ++i) {
- if (addLibStdCXXIncludePaths(
- IncludePathCandidates[i],
- TripleStr + MultiLibSuffix + BiarchSuffix, DriverArgs, CC1Args))
+ if (addLibStdCXXIncludePaths(IncludePathCandidates[i],
+ TripleStr + MIPSABIDirSuffix + BiarchSuffix,
+ DriverArgs, CC1Args))
break;
}
}
std::string GCCInstallPath;
std::string GCCBiarchSuffix;
std::string GCCParentLibPath;
- std::string GCCMultiLibSuffix;
+ std::string GCCMIPSABIDirSuffix;
GCCVersion Version;
/// \brief Get the detected GCC parent lib path.
StringRef getParentLibPath() const { return GCCParentLibPath; }
- /// \brief Get the detected GCC lib path suffix.
- StringRef getMultiLibSuffix() const { return GCCMultiLibSuffix; }
+ /// \brief Get the detected GCC MIPS ABI directory suffix.
+ ///
+ /// This is used as a suffix both to the install directory of GCC and as
+ /// a suffix to its parent lib path in order to select a MIPS ABI-specific
+ /// subdirectory.
+ ///
+ /// This will always be empty for any non-MIPS target.
+ ///
+ // FIXME: This probably shouldn't exist at all, and should be factored
+ // into the multiarch and/or biarch support. Please don't add more uses of
+ // this interface, it is meant as a legacy crutch for the MIPS driver
+ // logic.
+ StringRef getMIPSABIDirSuffix() const { return GCCMIPSABIDirSuffix; }
/// \brief Get the detected GCC version string.
const GCCVersion &getVersion() const { return Version; }
StringRef CandidateTriple,
bool NeedsBiarchSuffix = false);
- void findMultiLibSuffix(std::string &Suffix,
- llvm::Triple::ArchType TargetArch,
- StringRef Path,
- const llvm::opt::ArgList &Args);
+ void findMIPSABIDirSuffix(std::string &Suffix,
+ llvm::Triple::ArchType TargetArch, StringRef Path,
+ const llvm::opt::ArgList &Args);
};
GCCInstallationDetector GCCInstallation;
private:
static bool addLibStdCXXIncludePaths(Twine Base, Twine Suffix,
Twine TargetArchDir,
- Twine MultiLibSuffix,
+ Twine BiarchSuffix,
+ Twine MIPSABIDirSuffix,
const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args);
static bool addLibStdCXXIncludePaths(Twine Base, Twine TargetArchDir,