MCJIT-remote: __main should be resolved in child context.
authorNAKAMURA Takumi <geek4civic@gmail.com>
Sun, 27 Oct 2013 10:22:52 +0000 (10:22 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Sun, 27 Oct 2013 10:22:52 +0000 (10:22 +0000)
  - Mark tests as XFAIL:cygming in test/ExecutionEngine/MCJIT/remote.
    Rather to suppress them, I'd like to leave them running as XFAIL.
  - Revert r193472. RecordMemoryManager no longer resolves __main on cygming.

There are a couple of issues.

  - X86 Codegen emits "call __main" in @main for targeting cygming.
    It is useless in JIT. FYI, tests are passing when emitting __main is disabled.
  - Current remote JIT does not resolve any symbols in child context.

FIXME: __main should be disabled, or remote JIT should resolve __main.

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

test/ExecutionEngine/MCJIT/remote/cross-module-a.ll
test/ExecutionEngine/MCJIT/remote/multi-module-a.ll
test/ExecutionEngine/MCJIT/remote/simpletest-remote.ll
test/ExecutionEngine/MCJIT/remote/test-common-symbols-remote.ll
test/ExecutionEngine/MCJIT/remote/test-data-align-remote.ll
test/ExecutionEngine/MCJIT/remote/test-fp-no-external-funcs-remote.ll
test/ExecutionEngine/MCJIT/remote/test-global-init-nonzero-remote.ll
test/ExecutionEngine/MCJIT/remote/test-ptr-reloc-remote.ll
tools/lli/RemoteMemoryManager.cpp
tools/lli/RemoteMemoryManager.h

index 1e55d2d6a28608cd1855bab9b7025008b7f3049e..97f4edaf22e50fdd3825bfd23c51105e333345ac 100644 (file)
@@ -1,5 +1,8 @@
 ; RUN: %lli_mcjit -extra-modules=%p/cross-module-b.ir  -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target %s > /dev/null
 
+; This fails because __main is not resolved in remote mcjit.
+; XFAIL: cygwin,mingw32
+
 declare i32 @FB()
 
 define i32 @FA() {
index f49acf7c181b3ff0c0baed6649e293bd7ec1324a..b80965de3d39a009d9e134dea04515334b026f40 100644 (file)
@@ -1,5 +1,8 @@
 ; RUN: %lli_mcjit -extra-modules=%p/multi-module-b.ir,%p/multi-module-c.ir  -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target %s > /dev/null
 
+; This fails because __main is not resolved in remote mcjit.
+; XFAIL: cygwin,mingw32
+
 declare i32 @FB()
 
 define i32 @main() {
index 797121831f5370485581ae7f8180a45f3ea32088..f717fde4f9efee58e0f8c84743c291e635eda134 100644 (file)
@@ -1,5 +1,7 @@
 ; RUN: %lli_mcjit -remote-mcjit -mcjit-remote-process=lli-child-target %s > /dev/null
-; XFAIL:  mips
+
+; This fails because __main is not resolved in remote mcjit on cygming.
+; XFAIL: cygwin,mingw32,mips
 
 define i32 @bar() {
        ret i32 0
index 023263ec011dfd3d805088370eb59d160a03d156..c3dbac3269359dc9a9346667c1b8c0c995f0ac53 100644 (file)
@@ -1,5 +1,7 @@
 ; RUN: %lli_mcjit -remote-mcjit -O0 -disable-lazy-compilation=false -mcjit-remote-process=lli-child-target %s
-; XFAIL: mips
+
+; This fails because __main is not resolved in remote mcjit on cygming.
+; XFAIL: cygwin,mingw32,mips
 
 ; The intention of this test is to verify that symbols mapped to COMMON in ELF
 ; work as expected.
index ca520c8000bb42ba0313164a65fe41bab0e54959..8583bfe87870be3dccf529c2f99b0b4b786577bf 100644 (file)
@@ -1,5 +1,7 @@
 ; RUN:  %lli_mcjit -remote-mcjit -O0 -mcjit-remote-process=lli-child-target %s
-; XFAIL: mips
+
+; This fails because __main is not resolved in remote mcjit on cygming.
+; XFAIL: cygwin,mingw32,mips
 
 ; Check that a variable is always aligned as specified.
 
index dd3e3edae308e3f603184efbc87fdbe3e5dfc81e..4f658ac92068a35a5c940f9924b44a7ab1ae31d8 100644 (file)
@@ -1,5 +1,7 @@
 ; RUN: %lli_mcjit -remote-mcjit -mcjit-remote-process=lli-child-target %s > /dev/null
-; XFAIL:  mips
+
+; This fails because __main is not resolved in remote mcjit on cygming.
+; XFAIL: cygwin,mingw32,mips
 
 define double @test(double* %DP, double %Arg) {
        %D = load double* %DP           ; <double> [#uses=1]
index 90a8822a79c73379371b295dad88ed169e4d33b3..77868b91830088a68e4be001c0f6c5174a42dc34 100644 (file)
@@ -1,5 +1,7 @@
 ; RUN: %lli_mcjit -remote-mcjit -mcjit-remote-process=lli-child-target %s > /dev/null
-; XFAIL: mips
+
+; This fails because __main is not resolved in remote mcjit on cygming.
+; XFAIL: cygwin,mingw32,mips
 
 @count = global i32 1, align 4
 
index 8b562972b5d18089f775f1c8d1412bdb9ae7f2d2..3b542c39b16bf6fe054bd105a62986dcbed13123 100644 (file)
@@ -1,5 +1,8 @@
 ; RUN: %lli_mcjit -remote-mcjit -O0 -mcjit-remote-process=lli-child-target %s
 
+; This fails because __main is not resolved in remote mcjit.
+; XFAIL: cygwin,mingw32
+
 @.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
 @.str1 = private unnamed_addr constant [6 x i8] c"data2\00", align 1
index f730f0984f4445b5c65d73edaa97469fe4b4e311..04fc40e426f0c90323859a79df6ac4350bbd0528 100644 (file)
@@ -204,19 +204,3 @@ 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;
-}
index 3368b30ed6a5fea220585d9c5da390e330276568..5d0456f509802cb6e1bdc370b459f8638221730e 100644 (file)
@@ -78,7 +78,7 @@ public:
   // interface does support this, but clients must provide their own
   // mechanism for finding remote symbol addresses.  MCJIT will resolve
   // symbols from Modules it contains.
-  uint64_t getSymbolAddress(const std::string &Name);
+  uint64_t getSymbolAddress(const std::string &Name) { return 0; }
 
   void notifyObjectLoaded(ExecutionEngine *EE, const ObjectImage *Obj);