diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2013-10-26 13:52:31 +0000 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2013-10-26 13:52:31 +0000 |
commit | da469ecbbdc033b38842335e8e8ed68dfe93be28 (patch) | |
tree | 31cdc1484060d95fd90b3075a9c60327c32ba38f /llvm/tools/lli/RemoteMemoryManager.cpp | |
parent | 853b460e4f1e169b6d806233a298a9a2f56bed4c (diff) | |
download | bcm5719-llvm-da469ecbbdc033b38842335e8e8ed68dfe93be28.tar.gz bcm5719-llvm-da469ecbbdc033b38842335e8e8ed68dfe93be28.zip |
lli/RemoteMemoryManager.cpp: Resurrect __main stuff removed in r192504 to unbreak mingw32.
llvm-svn: 193472
Diffstat (limited to 'llvm/tools/lli/RemoteMemoryManager.cpp')
-rw-r--r-- | llvm/tools/lli/RemoteMemoryManager.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/tools/lli/RemoteMemoryManager.cpp b/llvm/tools/lli/RemoteMemoryManager.cpp index 04fc40e426f..f730f0984f4 100644 --- a/llvm/tools/lli/RemoteMemoryManager.cpp +++ b/llvm/tools/lli/RemoteMemoryManager.cpp @@ -204,3 +204,19 @@ uint8_t *RemoteMemoryManager::allocateGlobal(uintptr_t Size, unsigned Alignment) void RemoteMemoryManager::deallocateFunctionBody(void *Body) { llvm_unreachable("Unexpected!"); } + +static int jit_noop() { + return 0; +} + +uint64_t RemoteMemoryManager::getSymbolAddress(const std::string &Name) { + // 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 (uintptr_t)&jit_noop; + + return 0; +} |