Index: lib/ExecutionEngine/ExecutionEngine.cpp
===================================================================
--- lib/ExecutionEngine/ExecutionEngine.cpp	(revision 82523)
+++ lib/ExecutionEngine/ExecutionEngine.cpp	(working copy)
@@ -436,16 +436,23 @@
 
   // Unless the interpreter was explicitly selected or the JIT is not linked,
   // try making a JIT.
-  if (WhichEngine & EngineKind::JIT && ExecutionEngine::JITCtor) {
-    EE = ExecutionEngine::JITCtor(MP, ErrorStr, JMM, OptLevel,
-                                  AllocateGVsWithCode);
+  if (WhichEngine & EngineKind::JIT) {
+      if (ExecutionEngine::JITCtor) {
+          EE = ExecutionEngine::JITCtor(MP, ErrorStr, JMM, OptLevel,
+                                        AllocateGVsWithCode);
+      } else {
+          *ErrorStr = "JIT has not been linked in.";
+      }
   }
 
   // If we can't make a JIT and we didn't request one specifically, try making
   // an interpreter instead.
-  if (WhichEngine & EngineKind::Interpreter && EE == 0 &&
-      ExecutionEngine::InterpCtor) {
-    EE = ExecutionEngine::InterpCtor(MP, ErrorStr);
+  if (WhichEngine & EngineKind::Interpreter && EE == 0) {
+      if (ExecutionEngine::InterpCtor) {
+          EE = ExecutionEngine::InterpCtor(MP, ErrorStr);
+      } else {
+          *ErrorStr = "Interpreter has not been linked in.";
+      }
   }
 
   return EE;
