r195751 - [Mips] Do not detect a used MIPS toolchain. Build a path suffix for FSF
Simon Atanasyan
simon at atanasyan.com
Tue Nov 26 03:57:14 PST 2013
Author: atanasyan
Date: Tue Nov 26 05:57:14 2013
New Revision: 195751
URL: http://llvm.org/viewvc/llvm-project?rev=195751&view=rev
Log:
[Mips] Do not detect a used MIPS toolchain. Build a path suffix for FSF
toolchain first and check the path existence. If the path does not
exist build and check a path suffix for Code Sourcery toolchain.
Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=195751&r1=195750&r2=195751&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Nov 26 05:57:14 2013
@@ -1019,7 +1019,7 @@ static StringRef getGCCToolchainDir(cons
/// triple.
Generic_GCC::GCCInstallationDetector::GCCInstallationDetector(
const Driver &D, const llvm::Triple &TargetTriple, const ArgList &Args)
- : IsValid(false), D(D) {
+ : IsValid(false) {
llvm::Triple BiarchVariantTriple =
TargetTriple.isArch32Bit() ? TargetTriple.get64BitArchVariant()
: TargetTriple.get32BitArchVariant();
@@ -1410,65 +1410,62 @@ void Generic_GCC::GCCInstallationDetecto
// /mips32
// /usr
// /lib <= crt*.o files compiled with '-mips32'
- //
- // Unfortunately different toolchains use different and partially
- // overlapped naming schemes. So we have to make a trick for detection
- // of using toolchain. We lookup a path which unique for each toolchains.
-
- bool IsMentorToolChain = hasCrtBeginObj(Path + "/mips16/soft-float");
- bool IsFSFToolChain = hasCrtBeginObj(Path + "/mips32/mips16/sof");
- if (IsMentorToolChain && IsFSFToolChain)
- D.Diag(diag::err_drv_unknown_toolchain);
+ // Check FSF Toolchain path
+ Suffix.clear();
+ if (TargetArch == llvm::Triple::mips ||
+ TargetArch == llvm::Triple::mipsel) {
+ if (isMicroMips(Args))
+ Suffix += "/micromips";
+ else if (isMips32r2(Args))
+ Suffix += "";
+ else
+ Suffix += "/mips32";
- if (IsMentorToolChain) {
if (isMips16(Args))
Suffix += "/mips16";
- else if (isMicroMips(Args))
- Suffix += "/micromips";
+ } else {
+ if (isMips64r2(Args))
+ Suffix += hasMipsN32ABIArg(Args) ? "/mips64r2" : "/mips64r2/64";
+ else
+ Suffix += hasMipsN32ABIArg(Args) ? "/mips64" : "/mips64/64";
+ }
- if (isSoftFloatABI(Args))
- Suffix += "/soft-float";
+ if (TargetArch == llvm::Triple::mipsel ||
+ TargetArch == llvm::Triple::mips64el)
+ Suffix += "/el";
+
+ if (isSoftFloatABI(Args))
+ Suffix += "/sof";
+ else {
+ if (isMipsFP64(Args))
+ Suffix += "/fp64";
- if (TargetArch == llvm::Triple::mipsel ||
- TargetArch == llvm::Triple::mips64el)
- Suffix += "/el";
- } else if (IsFSFToolChain) {
- if (TargetArch == llvm::Triple::mips ||
- TargetArch == llvm::Triple::mipsel) {
- if (isMicroMips(Args))
- Suffix += "/micromips";
- else if (isMips32r2(Args))
- Suffix += "";
- else
- Suffix += "/mips32";
+ if (isMipsNan2008(Args))
+ Suffix += "/nan2008";
+ }
- if (isMips16(Args))
- Suffix += "/mips16";
- } else {
- if (isMips64r2(Args))
- Suffix += hasMipsN32ABIArg(Args) ? "/mips64r2" : "/mips64r2/64";
- else
- Suffix += hasMipsN32ABIArg(Args) ? "/mips64" : "/mips64/64";
- }
+ if (hasCrtBeginObj(Path + Suffix))
+ return;
- if (TargetArch == llvm::Triple::mipsel ||
- TargetArch == llvm::Triple::mips64el)
- Suffix += "/el";
-
- if (isSoftFloatABI(Args))
- Suffix += "/sof";
- else {
- if (isMipsFP64(Args))
- Suffix += "/fp64";
+ // Check Code Sourcery Toolchain path
+ Suffix.clear();
+ if (isMips16(Args))
+ Suffix += "/mips16";
+ else if (isMicroMips(Args))
+ Suffix += "/micromips";
+
+ if (isSoftFloatABI(Args))
+ Suffix += "/soft-float";
+
+ if (TargetArch == llvm::Triple::mipsel ||
+ TargetArch == llvm::Triple::mips64el)
+ Suffix += "/el";
- if (isMipsNan2008(Args))
- Suffix += "/nan2008";
- }
- }
+ if (hasCrtBeginObj(Path + Suffix))
+ return;
- if (!hasCrtBeginObj(Path + Suffix))
- Suffix.clear();
+ Suffix.clear();
}
void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=195751&r1=195750&r2=195751&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Tue Nov 26 05:57:14 2013
@@ -76,7 +76,6 @@ protected:
/// Driver, and has logic for fuzzing that where appropriate.
class GCCInstallationDetector {
bool IsValid;
- const Driver &D;
llvm::Triple GCCTriple;
// FIXME: These might be better as path objects.
More information about the cfe-commits
mailing list