From: NAKAMURA Takumi Date: Sun, 18 Nov 2012 06:16:32 +0000 (+0000) Subject: MCJIT: [cygming] Give noop to __main also in RecordingMemoryManger. It is emitted... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=34280412bb761f2410ec8bd3a068b2b51f9ea6d2;p=platform%2Fupstream%2Fllvm.git MCJIT: [cygming] Give noop to __main also in RecordingMemoryManger. It is emitted in @main(). XFAIL(s) can be removed. llvm-svn: 168282 --- diff --git a/llvm/test/ExecutionEngine/MCJIT/simpletest-remote.ll b/llvm/test/ExecutionEngine/MCJIT/simpletest-remote.ll index 1c0da9f..0d0459c 100644 --- a/llvm/test/ExecutionEngine/MCJIT/simpletest-remote.ll +++ b/llvm/test/ExecutionEngine/MCJIT/simpletest-remote.ll @@ -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 diff --git a/llvm/test/ExecutionEngine/MCJIT/stubs-remote.ll b/llvm/test/ExecutionEngine/MCJIT/stubs-remote.ll index 141c5af..dc4cda4 100644 --- a/llvm/test/ExecutionEngine/MCJIT/stubs-remote.ll +++ b/llvm/test/ExecutionEngine/MCJIT/stubs-remote.ll @@ -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: diff --git a/llvm/test/ExecutionEngine/MCJIT/test-common-symbols-remote.ll b/llvm/test/ExecutionEngine/MCJIT/test-common-symbols-remote.ll index 220eb2d..b269ba1 100644 --- a/llvm/test/ExecutionEngine/MCJIT/test-common-symbols-remote.ll +++ b/llvm/test/ExecutionEngine/MCJIT/test-common-symbols-remote.ll @@ -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. diff --git a/llvm/test/ExecutionEngine/MCJIT/test-data-align-remote.ll b/llvm/test/ExecutionEngine/MCJIT/test-data-align-remote.ll index 7fcb18f..86e7fcd 100644 --- a/llvm/test/ExecutionEngine/MCJIT/test-data-align-remote.ll +++ b/llvm/test/ExecutionEngine/MCJIT/test-data-align-remote.ll @@ -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. diff --git a/llvm/test/ExecutionEngine/MCJIT/test-fp-no-external-funcs-remote.ll b/llvm/test/ExecutionEngine/MCJIT/test-fp-no-external-funcs-remote.ll index eb1e3c5..ac1999d 100644 --- a/llvm/test/ExecutionEngine/MCJIT/test-fp-no-external-funcs-remote.ll +++ b/llvm/test/ExecutionEngine/MCJIT/test-fp-no-external-funcs-remote.ll @@ -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 ; [#uses=1] diff --git a/llvm/test/ExecutionEngine/MCJIT/test-global-init-nonzero-remote.ll b/llvm/test/ExecutionEngine/MCJIT/test-global-init-nonzero-remote.ll index 4c69ff7..65f8af0 100644 --- a/llvm/test/ExecutionEngine/MCJIT/test-global-init-nonzero-remote.ll +++ b/llvm/test/ExecutionEngine/MCJIT/test-global-init-nonzero-remote.ll @@ -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 diff --git a/llvm/test/ExecutionEngine/MCJIT/test-ptr-reloc-remote.ll b/llvm/test/ExecutionEngine/MCJIT/test-ptr-reloc-remote.ll index 78a8df8..83a9b43 100644 --- a/llvm/test/ExecutionEngine/MCJIT/test-ptr-reloc-remote.ll +++ b/llvm/test/ExecutionEngine/MCJIT/test-ptr-reloc-remote.ll @@ -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 diff --git a/llvm/tools/lli/RecordingMemoryManager.cpp b/llvm/tools/lli/RecordingMemoryManager.cpp index f54f174..75cb978 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; }