MCJIT: [cygming] Give noop to __main also in RecordingMemoryManger. It is emitted...
authorNAKAMURA Takumi <geek4civic@gmail.com>
Sun, 18 Nov 2012 06:16:32 +0000 (06:16 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Sun, 18 Nov 2012 06:16:32 +0000 (06:16 +0000)
XFAIL(s) can be removed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168282 91177308-0d34-0410-b5e6-96231b3b80d8

test/ExecutionEngine/MCJIT/simpletest-remote.ll
test/ExecutionEngine/MCJIT/stubs-remote.ll
test/ExecutionEngine/MCJIT/test-common-symbols-remote.ll
test/ExecutionEngine/MCJIT/test-data-align-remote.ll
test/ExecutionEngine/MCJIT/test-fp-no-external-funcs-remote.ll
test/ExecutionEngine/MCJIT/test-global-init-nonzero-remote.ll
test/ExecutionEngine/MCJIT/test-ptr-reloc-remote.ll
tools/lli/RecordingMemoryManager.cpp

index 1c0da9f1b5dd6931e5c2ee73cefe25c10d0f8cc1..0d0459cd149c28a854601c6ebaec0f6989ff862e 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -remote-mcjit %s > /dev/null
-; XFAIL: arm, mingw32
+; XFAIL: arm
 
 define i32 @bar() {
        ret i32 0
index 141c5af8f02c2a9a6aad027dbb037675050adddc..dc4cda4a59fb67842681a49b1b15cb75a63773ee 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -remote-mcjit -disable-lazy-compilation=false %s
-; XFAIL: arm, mingw32
+; XFAIL: arm
 
 define i32 @main() nounwind {
 entry:
index 220eb2d01b9682b6e977dd0972c5f3bc3baebf60..b269ba182e8452dfa768b0c460a8ca8b50164960 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -remote-mcjit -O0 -disable-lazy-compilation=false %s
-; XFAIL: arm, mingw32, cygwin
+; XFAIL: arm
 
 ; The intention of this test is to verify that symbols mapped to COMMON in ELF
 ; work as expected.
index 7fcb18f05391c8d888357397783da8a99b5a49a8..86e7fcdd2ec5ea723e47a237b3a7e42b1f918104 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN:  %lli -mtriple=%mcjit_triple -use-mcjit -remote-mcjit -O0 %s
-; XFAIL: arm, mingw32
+; XFAIL: arm
 
 ; Check that a variable is always aligned as specified.
 
index eb1e3c5e0ad02598482f0ad8462080363a5313f0..ac1999d4c36672ec1d9c33d42e6756528930f13d 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -remote-mcjit %s > /dev/null
-; XFAIL: arm, mingw32
+; XFAIL: arm
 
 define double @test(double* %DP, double %Arg) {
        %D = load double* %DP           ; <double> [#uses=1]
index 4c69ff7a2c19d95e8cf340d70f0d1c41ed10aaf3..65f8af047a28603dd33100376b5d9c4b4cc8bca4 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -remote-mcjit %s > /dev/null
-; XFAIL: arm, mingw32, cygwin
+; XFAIL: arm
 
 @count = global i32 1, align 4
 
index 78a8df8f716456a5a3d5d894205ad78be76ab662..83a9b43e3994f481cebc3707a0342b440bda5c0c 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -remote-mcjit -O0 %s
-; XFAIL: arm, mingw32
+; XFAIL: arm
 
 @.str = private unnamed_addr constant [6 x i8] c"data1\00", align 1
 @ptr = global i8* getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 0), align 4
index f54f17461e110a1c26e9612d51a2d0828aea215f..75cb978130629afc18e9d070398690c7f1f5742a 100644 (file)
@@ -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;
 }