[cfe-commits] r144108 - in /cfe/trunk/lib/Driver: ToolChains.cpp Tools.cpp

Eli Friedman eli.friedman at gmail.com
Tue Nov 8 11:43:38 PST 2011


Author: efriedma
Date: Tue Nov  8 13:43:37 2011
New Revision: 144108

URL: http://llvm.org/viewvc/llvm-project?rev=144108&view=rev
Log:
Misc fixes for clang driver on Mips Linux.  Patch by Simon Atanasyan.


Modified:
    cfe/trunk/lib/Driver/ToolChains.cpp
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=144108&r1=144107&r2=144108&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Nov  8 13:43:37 2011
@@ -1191,6 +1191,20 @@
     };
     LibDirs.append(X86LibDirs, X86LibDirs + llvm::array_lengthof(X86LibDirs));
     Triples.append(X86Triples, X86Triples + llvm::array_lengthof(X86Triples));
+  } else if (HostArch == llvm::Triple::mips) {
+    static const char *const MIPSLibDirs[] = { "/lib" };
+    static const char *const MIPSTriples[] = { "mips-linux-gnu" };
+    LibDirs.append(MIPSLibDirs,
+                   MIPSLibDirs + llvm::array_lengthof(MIPSLibDirs));
+    Triples.append(MIPSTriples,
+                   MIPSTriples + llvm::array_lengthof(MIPSTriples));
+  } else if (HostArch == llvm::Triple::mipsel) {
+    static const char *const MIPSELLibDirs[] = { "/lib" };
+    static const char *const MIPSELTriples[] = { "mipsel-linux-gnu" };
+    LibDirs.append(MIPSELLibDirs,
+                   MIPSELLibDirs + llvm::array_lengthof(MIPSELLibDirs));
+    Triples.append(MIPSELTriples,
+                   MIPSELTriples + llvm::array_lengthof(MIPSELTriples));
   } else if (HostArch == llvm::Triple::ppc) {
     static const char *const PPCLibDirs[] = { "/lib32", "/lib" };
     static const char *const PPCTriples[] = {
@@ -1773,6 +1787,14 @@
     if (llvm::sys::fs::exists(SysRoot + "/lib/x86_64-linux-gnu"))
       return "x86_64-linux-gnu";
     return TargetTriple.str();
+  case llvm::Triple::mips:
+    if (llvm::sys::fs::exists(SysRoot + "/lib/mips-linux-gnu"))
+      return "mips-linux-gnu";
+    return TargetTriple.str();
+  case llvm::Triple::mipsel:
+    if (llvm::sys::fs::exists(SysRoot + "/lib/mipsel-linux-gnu"))
+      return "mipsel-linux-gnu";
+    return TargetTriple.str();
   }
 }
 
@@ -1829,6 +1851,8 @@
   // to the link paths.
   path_list &Paths = getFilePaths();
   const bool Is32Bits = (getArch() == llvm::Triple::x86 ||
+                         getArch() == llvm::Triple::mips ||
+                         getArch() == llvm::Triple::mipsel ||
                          getArch() == llvm::Triple::ppc);
 
   const std::string Suffix32 = Arch == llvm::Triple::x86_64 ? "/32" : "";

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=144108&r1=144107&r2=144108&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Nov  8 13:43:37 2011
@@ -4338,6 +4338,14 @@
     CmdArgs.push_back("elf32ppclinux");
   else if (ToolChain.getArch() == llvm::Triple::ppc64)
     CmdArgs.push_back("elf64ppc");
+  else if (ToolChain.getArch() == llvm::Triple::mips)
+    CmdArgs.push_back("elf32btsmip");
+  else if (ToolChain.getArch() == llvm::Triple::mipsel)
+    CmdArgs.push_back("elf32ltsmip");
+  else if (ToolChain.getArch() == llvm::Triple::mips64)
+    CmdArgs.push_back("elf64btsmip");
+  else if (ToolChain.getArch() == llvm::Triple::mips64el)
+    CmdArgs.push_back("elf64ltsmip");
   else
     CmdArgs.push_back("elf_x86_64");
 
@@ -4361,6 +4369,9 @@
     else if (ToolChain.getArch() == llvm::Triple::arm ||
              ToolChain.getArch() == llvm::Triple::thumb)
       CmdArgs.push_back("/lib/ld-linux.so.3");
+    else if (ToolChain.getArch() == llvm::Triple::mips ||
+             ToolChain.getArch() == llvm::Triple::mipsel)
+      CmdArgs.push_back("/lib/ld.so.1");
     else if (ToolChain.getArch() == llvm::Triple::ppc)
       CmdArgs.push_back("/lib/ld.so.1");
     else if (ToolChain.getArch() == llvm::Triple::ppc64)





More information about the cfe-commits mailing list