diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2012-11-18 06:16:32 +0000 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2012-11-18 06:16:32 +0000 |
commit | 34280412bb761f2410ec8bd3a068b2b51f9ea6d2 (patch) | |
tree | 568521569c5b20b35810a5820132bea8cc778281 /llvm/tools/lli | |
parent | fb3690ea58abe4f52e71036cefe03b02704c873b (diff) | |
download | bcm5719-llvm-34280412bb761f2410ec8bd3a068b2b51f9ea6d2.tar.gz bcm5719-llvm-34280412bb761f2410ec8bd3a068b2b51f9ea6d2.zip |
MCJIT: [cygming] Give noop to __main also in RecordingMemoryManger. It is emitted in @main().
XFAIL(s) can be removed.
llvm-svn: 168282
Diffstat (limited to 'llvm/tools/lli')
-rw-r--r-- | llvm/tools/lli/RecordingMemoryManager.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/tools/lli/RecordingMemoryManager.cpp b/llvm/tools/lli/RecordingMemoryManager.cpp index f54f17461e1..75cb9781306 100644 --- a/llvm/tools/lli/RecordingMemoryManager.cpp +++ b/llvm/tools/lli/RecordingMemoryManager.cpp @@ -82,7 +82,20 @@ void RecordingMemoryManager::endExceptionTable(const Function *F, uint8_t *Table void RecordingMemoryManager::deallocateExceptionTable(void *ET) { llvm_unreachable("Unexpected!"); } + +static int jit_noop() { + return 0; +} + void *RecordingMemoryManager::getPointerToNamedFunction(const std::string &Name, bool AbortOnFailure) { + // We should not invoke parent's ctors/dtors from generated main()! + // On Mingw and Cygwin, the symbol __main is resolved to + // callee's(eg. tools/lli) one, to invoke wrong duplicated ctors + // (and register wrong callee's dtors with atexit(3)). + // We expect ExecutionEngine::runStaticConstructorsDestructors() + // is called before ExecutionEngine::runFunctionAsMain() is called. + if (Name == "__main") return (void*)(intptr_t)&jit_noop; + return NULL; } |