- ExecutionEngine *EE = ExecutionEngine::create(MP, ForceInterpreter);
- assert(EE && "Couldn't create an ExecutionEngine, not even an interpreter?");
+ // Get the module as the MP could go away once EE takes over.
+ Module *Mod = MP->getModule();
+
+ // If we are supposed to override the target triple, do so now.
+ if (!TargetTriple.empty())
+ Mod->setTargetTriple(TargetTriple);
+
+ EE = ExecutionEngine::create(MP, ForceInterpreter, &ErrorMsg);
+ if (!EE && !ErrorMsg.empty()) {
+ std::cerr << argv[0] << ":error creating EE: " << ErrorMsg << "\n";
+ exit(1);
+ }