From 28edd69eb4b14ca33ef0f00ebffab5ba8ca3073c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 21 Jan 2005 19:59:37 +0000 Subject: If the interpreter tries to execute an external function, kill it. Of course since we are dirty, special case __main. This should fix the infinite loop horrible stuff that happens on linux-alpha when configuring llvm-gcc. It might also help cygwin, who knows?? llvm-svn: 19729 --- llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp') diff --git a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp index d2a6741..c260697 100644 --- a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp +++ b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp @@ -82,22 +82,24 @@ static ExFunc lookupFunction(const Function *F) { return FnPtr; } -GenericValue Interpreter::callExternalFunction(Function *M, +GenericValue Interpreter::callExternalFunction(Function *F, const std::vector &ArgVals) { TheInterpreter = this; // Do a lookup to see if the function is in our cache... this should just be a // deferred annotation! - std::map::iterator FI = Functions.find(M); - ExFunc Fn = (FI == Functions.end()) ? lookupFunction(M) : FI->second; + std::map::iterator FI = Functions.find(F); + ExFunc Fn = (FI == Functions.end()) ? lookupFunction(F) : FI->second; if (Fn == 0) { std::cout << "Tried to execute an unknown external function: " - << M->getType()->getDescription() << " " << M->getName() << "\n"; - return GenericValue(); + << F->getType()->getDescription() << " " << F->getName() << "\n"; + if (F->getName() == "__main") + return GenericValue(); + abort(); } // TODO: FIXME when types are not const! - GenericValue Result = Fn(const_cast(M->getFunctionType()), + GenericValue Result = Fn(const_cast(F->getFunctionType()), ArgVals); return Result; } -- cgit v1.1