diff options
author | Jim Grosbach <grosbach@apple.com> | 2011-04-13 15:38:30 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2011-04-13 15:38:30 +0000 |
commit | d35159a17759932ec454215d2267cca11495d409 (patch) | |
tree | 9c0de7cb9061dc79bddfde036083245ccd1f98ec /llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp | |
parent | 956de1ff663c8fb371a3a0628783c396824286f3 (diff) | |
download | bcm5719-llvm-d35159a17759932ec454215d2267cca11495d409.tar.gz bcm5719-llvm-d35159a17759932ec454215d2267cca11495d409.zip |
Allow user-specified program entry point for llvm-rtdyld.
llvm-svn: 129446
Diffstat (limited to 'llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp')
-rw-r--r-- | llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp index 812be113896..ee398e7b4cf 100644 --- a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp +++ b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp @@ -38,6 +38,11 @@ Action(cl::desc("Action to perform:"), "Load, link, and execute the inputs."), clEnumValEnd)); +static cl::opt<std::string> +EntryPoint("entry", + cl::desc("Function to call as entry point."), + cl::init("_main")); + /* *** */ // A trivial memory manager that doesn't do anything fancy, just uses the @@ -93,10 +98,10 @@ static int executeInput() { // Resolve all the relocations we can. Dyld.resolveRelocations(); - // Get the address of "_main". - void *MainAddress = Dyld.getSymbolAddress("_main"); + // Get the address of the entry point (_main by default). + void *MainAddress = Dyld.getSymbolAddress(EntryPoint); if (MainAddress == 0) - return Error("no definition for '_main'"); + return Error("no definition for '" + EntryPoint + "'"); // Invalidate the instruction cache for each loaded function. for (unsigned i = 0, e = MemMgr->FunctionMemory.size(); i != e; ++i) { |