Index: utils/lit/lit/TestRunner.py
===================================================================
--- utils/lit/lit/TestRunner.py	(revision 156555)
+++ utils/lit/lit/TestRunner.py	(working copy)
@@ -442,7 +442,8 @@
             if script and script[-1][-1] == '\\':
                 script[-1] = script[-1][:-1] + ln
             else:
-                script.append(ln)
+                script.append('gtimeout 5m ' +ln)
+		# do not commit this patch
         elif 'XFAIL:' in ln:
             items = ln[ln.index('XFAIL:') + 6:].split(',')
             xfails.extend([s.strip() for s in items])
Index: utils/lit/lit/LitConfig.py
===================================================================
--- utils/lit/lit/LitConfig.py	(revision 156555)
+++ utils/lit/lit/LitConfig.py	(working copy)
@@ -36,7 +36,8 @@
         self.debug = debug
         self.isWindows = bool(isWindows)
         self.params = dict(params)
-        self.bashPath = None
+	# local hack only, don't commit this patch
+        self.bashPath = '/sw/bin/bash'
 
         self.numErrors = 0
         self.numWarnings = 0
Index: lib/ExecutionEngine/MCJIT/CMakeLists.txt
===================================================================
--- lib/ExecutionEngine/MCJIT/CMakeLists.txt	(revision 156555)
+++ lib/ExecutionEngine/MCJIT/CMakeLists.txt	(working copy)
@@ -2,3 +2,4 @@
   MCJIT.cpp
   MCJITMemoryManager.cpp
   )
+target_link_libraries( LLVMMCJIT LLVMJIT )
Index: lib/MC/MCDisassembler/CMakeLists.txt
===================================================================
--- lib/MC/MCDisassembler/CMakeLists.txt	(revision 156555)
+++ lib/MC/MCDisassembler/CMakeLists.txt	(working copy)
@@ -6,3 +6,27 @@
   EDOperand.cpp
   EDToken.cpp
   )
+
+target_link_libraries(LLVMMCDisassembler
+  LLVMMC
+  LLVMMCParser
+  LLVMSupport
+  LLVMTarget
+  )
+
+foreach(t ${LLVM_TARGETS_TO_BUILD})
+  set(td ${LLVM_MAIN_SRC_DIR}/lib/Target/${t})
+  if(EXISTS ${td}/TargetInfo/CMakeLists.txt)
+    target_link_libraries(LLVMMCDisassembler "LLVM${t}Info")
+  endif()
+  if(EXISTS ${td}/MCTargetDesc/CMakeLists.txt)
+    target_link_libraries(LLVMMCDisassembler "LLVM${t}Desc")
+  endif()
+  if(EXISTS ${td}/AsmParser/CMakeLists.txt)
+    target_link_libraries(LLVMMCDisassembler "LLVM${t}AsmParser")
+  endif()
+  if(EXISTS ${td}/Disassembler/CMakeLists.txt)
+    target_link_libraries(LLVMMCDisassembler "LLVM${t}Disassembler")
+  endif()
+endforeach(t)
+
Index: lib/Support/APFloat.cpp
===================================================================
--- lib/Support/APFloat.cpp	(revision 156555)
+++ lib/Support/APFloat.cpp	(working copy)
@@ -61,7 +61,8 @@
   // The PowerPC format consists of two doubles.  It does not map cleanly
   // onto the usual format above.  For now only storage of constants of
   // this type is supported, no arithmetic.
-  const fltSemantics APFloat::PPCDoubleDouble = { 1023, -1022, 106, false };
+  const fltSemantics APFloat::PPCDoubleDouble = { 1023, -1022, 106, true };
+  // temporary patch from Hal Finkel to not-crash, but will be wrong, bug #11933
 
   /* A tight upper bound on number of parts required to hold the value
      pow(5, power) is
Index: lib/Support/Unix/Signals.inc
===================================================================
--- lib/Support/Unix/Signals.inc	(revision 156555)
+++ lib/Support/Unix/Signals.inc	(working copy)
@@ -266,7 +266,7 @@
 void llvm::sys::PrintStackTraceOnErrorSignal() {
   AddSignalHandler(PrintStackTrace, 0);
 
-#if defined(__APPLE__)
+#if defined(__APPLE__) && defined(MACH_EXCEPTION_CODES) && defined(EXC_MASK_CRASH)
   // Environment variable to disable any kind of crash dialog.
   if (getenv("LLVM_DISABLE_CRASH_REPORT")) {
     mach_port_t self = mach_task_self();
Index: lib/Support/Atomic.cpp
===================================================================
--- lib/Support/Atomic.cpp	(revision 156555)
+++ lib/Support/Atomic.cpp	(working copy)
@@ -21,17 +21,29 @@
 #undef MemoryFence
 #endif
 
+#if defined(__APPLE__) && 0
+#include <libkern/OSAtomic.h>
+// __APPLE__ should take precedence over __GNUC__
+// sys::cas_flag is int32_t from Support/Atomic.h, so use '32' variants
+// prototypes lack the 'volatile' qualifier, so we need to cast them away
+template <class T>
+static inline
+T* vcast(volatile T* ptr) { return const_cast<T*>(ptr); }
+#endif
+
 void sys::MemoryFence() {
 #if LLVM_HAS_ATOMICS == 0
   return;
-#else
-#  if defined(__GNUC__)
+/**
+#elif defined(__APPLE__)
+  OSMemoryBarrier();
+**/
+#elif defined(__GNUC__)
   __sync_synchronize();
-#  elif defined(_MSC_VER)
+#elif defined(_MSC_VER)
   MemoryBarrier();
-#  else
+#else
 # error No memory fence implementation for your platform!
-#  endif
 #endif
 }
 
@@ -43,6 +55,10 @@
   if (result == old_value)
     *ptr = new_value;
   return result;
+/**
+#elif defined(__APPLE__)
+  return OSAtomicCompareAndSwap32(old_value, new_value, vcast(ptr));
+**/
 #elif defined(__GNUC__)
   return __sync_val_compare_and_swap(ptr, old_value, new_value);
 #elif defined(_MSC_VER)
@@ -56,6 +72,10 @@
 #if LLVM_HAS_ATOMICS == 0
   ++(*ptr);
   return *ptr;
+/**
+#elif defined(__APPLE__)
+  return OSAtomicIncrement32(vcast(ptr));
+**/
 #elif defined(__GNUC__)
   return __sync_add_and_fetch(ptr, 1);
 #elif defined(_MSC_VER)
@@ -69,6 +89,10 @@
 #if LLVM_HAS_ATOMICS == 0
   --(*ptr);
   return *ptr;
+/**
+#elif defined(__APPLE__)
+  return OSAtomicDecrement32(vcast(ptr));
+**/
 #elif defined(__GNUC__)
   return __sync_sub_and_fetch(ptr, 1);
 #elif defined(_MSC_VER)
@@ -82,6 +106,10 @@
 #if LLVM_HAS_ATOMICS == 0
   *ptr += val;
   return *ptr;
+/**
+#elif defined(__APPLE__)
+  return OSAtomicAdd32(val, vcast(ptr));
+**/
 #elif defined(__GNUC__)
   return __sync_add_and_fetch(ptr, val);
 #elif defined(_MSC_VER)
Index: autoconf/configure.ac
===================================================================
--- autoconf/configure.ac	(revision 156555)
+++ autoconf/configure.ac	(working copy)
@@ -1434,9 +1434,9 @@
     ]]),
   AC_LANG_POP([C++])
   AC_MSG_RESULT(yes)
-  AC_DEFINE(LLVM_HAS_ATOMICS, 1, Has gcc/MSVC atomic intrinsics),
+  AC_DEFINE(LLVM_HAS_ATOMICS, 1, Has gcc/MSVC/Apple atomic intrinsics),
   AC_MSG_RESULT(no)
-  AC_DEFINE(LLVM_HAS_ATOMICS, 0, Has gcc/MSVC atomic intrinsics)
+  AC_DEFINE(LLVM_HAS_ATOMICS, 0, Has gcc/MSVC/Apple atomic intrinsics)
   AC_MSG_WARN([LLVM will be built thread-unsafe because atomic builtins are missing]))
 
 dnl===-----------------------------------------------------------------------===
