aboutsummaryrefslogtreecommitdiffstats
path: root/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
commit4e7dd8f7c4c0dc930ca64343316625cf464fb2d7 (patch)
treedd582d977daa8ea979a8bc2ff8e874eec8a918e5 /lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
parentb62e1e296efc4235e3f3c4d5ea981b08a8301a7f (diff)
downloadexternal_llvm-4e7dd8f7c4c0dc930ca64343316625cf464fb2d7.zip
external_llvm-4e7dd8f7c4c0dc930ca64343316625cf464fb2d7.tar.gz
external_llvm-4e7dd8f7c4c0dc930ca64343316625cf464fb2d7.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?? git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19729 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp')
-rw-r--r--lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
index d2a6741..c260697 100644
--- a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
+++ b/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;
}