aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-21 19:59:37 +0000
committerChris Lattner <sabre@nondot.org>2005-01-21 19:59:37 +0000
commit28edd69eb4b14ca33ef0f00ebffab5ba8ca3073c (patch)
treebf273ad1bb7f633067210df951de681204565d88 /llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
parentc78776d209e9a7a56bb6a28ffa016567256e7ff1 (diff)
downloadllvm-28edd69eb4b14ca33ef0f00ebffab5ba8ca3073c.zip
llvm-28edd69eb4b14ca33ef0f00ebffab5ba8ca3073c.tar.gz
llvm-28edd69eb4b14ca33ef0f00ebffab5ba8ca3073c.tar.bz2
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
Diffstat (limited to 'llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp14
1 files changed, 8 insertions, 6 deletions
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<GenericValue> &ArgVals) {
TheInterpreter = this;
// Do a lookup to see if the function is in our cache... this should just be a
// deferred annotation!
- std::map<const Function *, ExFunc>::iterator FI = Functions.find(M);
- ExFunc Fn = (FI == Functions.end()) ? lookupFunction(M) : FI->second;
+ std::map<const Function *, ExFunc>::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<FunctionType*>(M->getFunctionType()),
+ GenericValue Result = Fn(const_cast<FunctionType*>(F->getFunctionType()),
ArgVals);
return Result;
}