[llvm] r192514 - Fixing problems in lli's RemoteMemoryManager.

Andrew Kaylor andrew.kaylor at intel.com
Fri Oct 11 15:47:10 PDT 2013


Author: akaylor
Date: Fri Oct 11 17:47:10 2013
New Revision: 192514

URL: http://llvm.org/viewvc/llvm-project?rev=192514&view=rev
Log:
Fixing problems in lli's RemoteMemoryManager.

This fixes a problem from a previous check-in where a return value was omitted.

Previously the remote/stubs-remote.ll and remote/stubs-sm-pic.ll tests were reporting passes, but they should have been failing.  Those tests attempt to link against an external symbol and remote symbol resolution is not supported.  The old RemoteMemoryManager implementation resulted in local symbols being used for resolution and the child process crashed but the test didn't notice.  With this check-in remote symbol resolution fails, and so the test (correctly) fails.


Modified:
    llvm/trunk/test/ExecutionEngine/MCJIT/remote/stubs-remote.ll
    llvm/trunk/test/ExecutionEngine/MCJIT/remote/stubs-sm-pic.ll
    llvm/trunk/tools/lli/RemoteMemoryManager.h
    llvm/trunk/tools/lli/lli.cpp

Modified: llvm/trunk/test/ExecutionEngine/MCJIT/remote/stubs-remote.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/remote/stubs-remote.ll?rev=192514&r1=192513&r2=192514&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/remote/stubs-remote.ll (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/remote/stubs-remote.ll Fri Oct 11 17:47:10 2013
@@ -1,5 +1,6 @@
 ; RUN: %lli_mcjit -remote-mcjit -disable-lazy-compilation=false -mcjit-remote-process=lli-child-target %s
-; XFAIL:  mips
+; XFAIL: *
+; This test should fail until remote symbol resolution is supported.
 
 define i32 @main() nounwind {
 entry:

Modified: llvm/trunk/test/ExecutionEngine/MCJIT/remote/stubs-sm-pic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/remote/stubs-sm-pic.ll?rev=192514&r1=192513&r2=192514&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/remote/stubs-sm-pic.ll (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/remote/stubs-sm-pic.ll Fri Oct 11 17:47:10 2013
@@ -1,5 +1,6 @@
 ; RUN: %lli_mcjit -remote-mcjit -disable-lazy-compilation=false -relocation-model=pic -code-model=small %s
-; XFAIL: mips, i686, i386, aarch64, arm
+; XFAIL: *
+; This function should fail until remote symbol resolution is supported.
 
 define i32 @main() nounwind {
 entry:

Modified: llvm/trunk/tools/lli/RemoteMemoryManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/RemoteMemoryManager.h?rev=192514&r1=192513&r2=192514&view=diff
==============================================================================
--- llvm/trunk/tools/lli/RemoteMemoryManager.h (original)
+++ llvm/trunk/tools/lli/RemoteMemoryManager.h Fri Oct 11 17:47:10 2013
@@ -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);
 

Modified: llvm/trunk/tools/lli/lli.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/lli.cpp?rev=192514&r1=192513&r2=192514&view=diff
==============================================================================
--- llvm/trunk/tools/lli/lli.cpp (original)
+++ llvm/trunk/tools/lli/lli.cpp Fri Oct 11 17:47:10 2013
@@ -398,18 +398,18 @@ int main(int argc, char **argv, char * c
     return -1;
   }
 
-  // If the program doesn't explicitly call exit, we will need the Exit
-  // function later on to make an explicit call, so get the function now.
-  Constant *Exit = Mod->getOrInsertFunction("exit", Type::getVoidTy(Context),
-                                                    Type::getInt32Ty(Context),
-                                                    NULL);
-
   // Reset errno to zero on entry to main.
   errno = 0;
 
   int Result;
 
   if (!RemoteMCJIT) {
+    // If the program doesn't explicitly call exit, we will need the Exit
+    // function later on to make an explicit call, so get the function now.
+    Constant *Exit = Mod->getOrInsertFunction("exit", Type::getVoidTy(Context),
+                                                      Type::getInt32Ty(Context),
+                                                      NULL);
+
     // Run static constructors.
     if (UseMCJIT && !ForceInterpreter) {
       // Give MCJIT a chance to apply relocations and set page permissions.





More information about the llvm-commits mailing list