mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-04 07:32:13 +00:00
Allow user-specified program entry point for llvm-rtdyld.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129446 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
69e813282d
commit
6b32e7e213
@ -38,6 +38,11 @@ Action(cl::desc("Action to perform:"),
|
|||||||
"Load, link, and execute the inputs."),
|
"Load, link, and execute the inputs."),
|
||||||
clEnumValEnd));
|
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
|
// 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.
|
// Resolve all the relocations we can.
|
||||||
Dyld.resolveRelocations();
|
Dyld.resolveRelocations();
|
||||||
|
|
||||||
// Get the address of "_main".
|
// Get the address of the entry point (_main by default).
|
||||||
void *MainAddress = Dyld.getSymbolAddress("_main");
|
void *MainAddress = Dyld.getSymbolAddress(EntryPoint);
|
||||||
if (MainAddress == 0)
|
if (MainAddress == 0)
|
||||||
return Error("no definition for '_main'");
|
return Error("no definition for '" + EntryPoint + "'");
|
||||||
|
|
||||||
// Invalidate the instruction cache for each loaded function.
|
// Invalidate the instruction cache for each loaded function.
|
||||||
for (unsigned i = 0, e = MemMgr->FunctionMemory.size(); i != e; ++i) {
|
for (unsigned i = 0, e = MemMgr->FunctionMemory.size(); i != e; ++i) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user