[llvm-commits] [llvm] r129446 - /llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
Jim Grosbach
grosbach at apple.com
Wed Apr 13 08:38:30 PDT 2011
Author: grosbach
Date: Wed Apr 13 10:38:30 2011
New Revision: 129446
URL: http://llvm.org/viewvc/llvm-project?rev=129446&view=rev
Log:
Allow user-specified program entry point for llvm-rtdyld.
Modified:
llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
Modified: llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp?rev=129446&r1=129445&r2=129446&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp (original)
+++ llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp Wed Apr 13 10:38:30 2011
@@ -38,6 +38,11 @@
"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 @@
// 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) {
More information about the llvm-commits
mailing list