Index: cmake/modules/TableGen.cmake
===================================================================
--- cmake/modules/TableGen.cmake	(revision 311547)
+++ cmake/modules/TableGen.cmake	(working copy)
@@ -175,7 +175,8 @@
     endif()
   endif()
 
-  if (${project} STREQUAL LLVM AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+  if ((${project} STREQUAL LLVM OR ${project} STREQUAL CLANG) AND
+      NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
     if(${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
         NOT LLVM_DISTRIBUTION_COMPONENTS)
       set(export_to_llvmexports EXPORT LLVMExports)
Index: include/llvm/ADT/Triple.h
===================================================================
--- include/llvm/ADT/Triple.h	(revision 311547)
+++ include/llvm/ADT/Triple.h	(working copy)
@@ -130,6 +130,7 @@
 
     Apple,
     PC,
+    ELLCC,
     SCEI,
     BGP,
     BGQ,
Index: include/llvm/Analysis/TargetLibraryInfo.h
===================================================================
--- include/llvm/Analysis/TargetLibraryInfo.h	(revision 311547)
+++ include/llvm/Analysis/TargetLibraryInfo.h	(working copy)
@@ -19,6 +19,16 @@
 #include "llvm/IR/PassManager.h"
 #include "llvm/Pass.h"
 
+#if defined(__ELLCC__)
+#undef fopen64
+#undef fseeko64
+#undef ftello64
+#undef tmpfile64
+#undef fstat64
+#undef lstat64
+#undef stat64
+#endif
+
 namespace llvm {
 template <typename T> class ArrayRef;
 
Index: lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
===================================================================
--- lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp	(revision 311547)
+++ lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp	(working copy)
@@ -33,8 +33,9 @@
 RTDyldMemoryManager::~RTDyldMemoryManager() {}
 
 // Determine whether we can register EH tables.
+// RICH: Added mips.
 #if (defined(__GNUC__) && !defined(__ARM_EABI__) && !defined(__ia64__) && \
-     !defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__))
+     !defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)) && !defined(__mips__)
 #define HAVE_EHTABLE_SUPPORT 1
 #else
 #define HAVE_EHTABLE_SUPPORT 0
Index: lib/Support/Triple.cpp
===================================================================
--- lib/Support/Triple.cpp	(revision 311547)
+++ lib/Support/Triple.cpp	(working copy)
@@ -152,6 +152,7 @@
 
   case Apple: return "apple";
   case PC: return "pc";
+  case ELLCC: return "ellcc";
   case SCEI: return "scei";
   case BGP: return "bgp";
   case BGQ: return "bgq";
@@ -444,6 +445,7 @@
   return StringSwitch<Triple::VendorType>(VendorName)
     .Case("apple", Triple::Apple)
     .Case("pc", Triple::PC)
+    .Case("ellcc", Triple::ELLCC)
     .Case("scei", Triple::SCEI)
     .Case("bgp", Triple::BGP)
     .Case("bgq", Triple::BGQ)
Index: lib/Support/Unix/Path.inc
===================================================================
--- lib/Support/Unix/Path.inc	(revision 311547)
+++ lib/Support/Unix/Path.inc	(working copy)
@@ -16,6 +16,11 @@
 //===          is guaranteed to work on *all* UNIX variants.
 //===----------------------------------------------------------------------===//
 
+#if defined(__ELLCC__)
+#define _BSD_SOURCE
+#include <sys/time.h>
+#endif
+
 #include "Unix.h"
 #include <limits.h>
 #include <stdio.h>
Index: lib/Support/Unix/Process.inc
===================================================================
--- lib/Support/Unix/Process.inc	(revision 311547)
+++ lib/Support/Unix/Process.inc	(working copy)
@@ -26,6 +26,9 @@
 #ifdef HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
 #endif
+#if defined(__ELLCC__)
+#undef HAVE_MACH_MACH_H
+#endif
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
Index: lib/Support/Unix/Signals.inc
===================================================================
--- lib/Support/Unix/Signals.inc	(revision 311547)
+++ lib/Support/Unix/Signals.inc	(working copy)
@@ -25,6 +25,11 @@
 #include "llvm/Support/raw_ostream.h"
 #include <algorithm>
 #include <string>
+#if defined(__ELLCC__)
+// Our friend configure is messing this up for us.
+#undef HAVE_EXECINFO_H
+#undef HAVE_MACH_MACH_H
+#endif
 #ifdef HAVE_BACKTRACE
 # include BACKTRACE_HEADER         // For backtrace().
 #endif
