Skip to content

Commit

Permalink
Fixing problems in lli's RemoteMemoryManager.
Browse files Browse the repository at this point in the history
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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192514 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Andrew Kaylor committed Oct 11, 2013
1 parent 528f6d7 commit 4bad07f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion test/ExecutionEngine/MCJIT/remote/stubs-remote.ll
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
3 changes: 2 additions & 1 deletion test/ExecutionEngine/MCJIT/remote/stubs-sm-pic.ll
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tools/lli/RemoteMemoryManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class RemoteMemoryManager : public JITMemoryManager {
// 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);

Expand Down
12 changes: 6 additions & 6 deletions tools/lli/lli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,18 +398,18 @@ int main(int argc, char **argv, char * const *envp) {
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.
Expand Down

0 comments on commit 4bad07f

Please sign in to comment.