mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-04 06:09:05 +00:00
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
This commit is contained in:
parent
b62e1e296e
commit
4e7dd8f7c4
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user