summaryrefslogtreecommitdiffstats
path: root/tools/lli
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2012-11-18 06:16:32 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2012-11-18 06:16:32 +0000
commitfad9751d6e7449867384f87ae296373559d41b0b (patch)
treec59af3437b3d0157393aa3fabf16c4af2235c90a /tools/lli
parent64b501590099f275189bbed130b6e5d5ed3ff27f (diff)
downloadexternal_llvm-fad9751d6e7449867384f87ae296373559d41b0b.zip
external_llvm-fad9751d6e7449867384f87ae296373559d41b0b.tar.gz
external_llvm-fad9751d6e7449867384f87ae296373559d41b0b.tar.bz2
MCJIT: [cygming] Give noop to __main also in RecordingMemoryManger. It is emitted in @main().
XFAIL(s) can be removed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168282 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lli')
-rw-r--r--tools/lli/RecordingMemoryManager.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/lli/RecordingMemoryManager.cpp b/tools/lli/RecordingMemoryManager.cpp
index f54f174..75cb978 100644
--- a/tools/lli/RecordingMemoryManager.cpp
+++ b/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;
}