X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=tools%2Flli%2FRemoteMemoryManager.cpp;fp=tools%2Flli%2FRemoteMemoryManager.cpp;h=f730f0984f4445b5c65d73edaa97469fe4b4e311;hb=2d60c0945102e6887fcdc752a7b714546afae354;hp=04fc40e426f0c90323859a79df6ac4350bbd0528;hpb=0435c5dbec925f6c33a5920b63b2bcb0873efe75;p=oota-llvm.git diff --git a/tools/lli/RemoteMemoryManager.cpp b/tools/lli/RemoteMemoryManager.cpp index 04fc40e426f..f730f0984f4 100644 --- a/tools/lli/RemoteMemoryManager.cpp +++ b/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; +}