]> granicus.if.org Git - clang/commitdiff
[Mips] Do not detect a used MIPS toolchain. Build a path suffix for FSF
authorSimon Atanasyan <simon@atanasyan.com>
Tue, 26 Nov 2013 11:57:14 +0000 (11:57 +0000)
committerSimon Atanasyan <simon@atanasyan.com>
Tue, 26 Nov 2013 11:57:14 +0000 (11:57 +0000)
toolchain first and check the path existence. If the path does not
exist build and check a path suffix for Code Sourcery toolchain.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195751 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains.cpp
lib/Driver/ToolChains.h

index b5f4c19b5c049f1a2318437910b29a7c6aa0a036..b9e97fdc38389150e414b31c02c0ba76c95db2e9 100644 (file)
@@ -1019,7 +1019,7 @@ static StringRef getGCCToolchainDir(const ArgList &Args) {
 /// 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::GCCInstallationDetector::findMIPSABIDirSuffix(
   // /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";
-  } 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 (TargetArch == llvm::Triple::mipsel ||
+      TargetArch == llvm::Triple::mips64el)
+    Suffix += "/el";
 
-      if (isMips16(Args))
-        Suffix += "/mips16";
-    } else {
-      if (isMips64r2(Args))
-        Suffix += hasMipsN32ABIArg(Args) ? "/mips64r2" : "/mips64r2/64";
-      else
-        Suffix += hasMipsN32ABIArg(Args) ? "/mips64" : "/mips64/64";
-    }
+  if (isSoftFloatABI(Args))
+    Suffix += "/sof";
+  else {
+    if (isMipsFP64(Args))
+      Suffix += "/fp64";
 
-    if (TargetArch == llvm::Triple::mipsel ||
-        TargetArch == llvm::Triple::mips64el)
-      Suffix += "/el";
+    if (isMipsNan2008(Args))
+      Suffix += "/nan2008";
+  }
 
-    if (isSoftFloatABI(Args))
-      Suffix += "/sof";
-    else {
-      if (isMipsFP64(Args))
-        Suffix += "/fp64";
+  if (hasCrtBeginObj(Path + Suffix))
+    return;
 
-      if (isMipsNan2008(Args))
-        Suffix += "/nan2008";
-    }
-  }
+  // 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 (hasCrtBeginObj(Path + Suffix))
+    return;
 
-  if (!hasCrtBeginObj(Path + Suffix))
-    Suffix.clear();
+  Suffix.clear();
 }
 
 void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
index cf7be5436d7a6561c5e226db41bfca15566b056c..0368458b4090a43d4d6ee20f6ff9581cddaefb6a 100644 (file)
@@ -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.