Mercurial > hg > index.cgi
changeset 183:c6a38fd8bd33
Added --entry option for lwlink
author | lost@l-w.ca |
---|---|
date | Thu, 22 Dec 2011 18:01:59 -0700 |
parents | e0cc66fd0551 |
children | 6433cb024174 |
files | lwlink/lwlink.c lwlink/lwlink.h lwlink/main.c lwlink/script.c |
diffstat | 4 files changed, 31 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/lwlink/lwlink.c Wed Sep 21 21:14:09 2011 -0600 +++ b/lwlink/lwlink.c Thu Dec 22 18:01:59 2011 -0700 @@ -51,6 +51,8 @@ char *sysroot = "/"; +char *entrysym = NULL; + void add_input_file(char *fn) { inputfiles = lw_realloc(inputfiles, sizeof(fileinfo_t *) * (ninputfiles + 1));
--- a/lwlink/lwlink.h Wed Sep 21 21:14:09 2011 -0600 +++ b/lwlink/lwlink.h Thu Dec 22 18:01:59 2011 -0700 @@ -109,6 +109,7 @@ extern int ninputfiles; extern fileinfo_t **inputfiles; extern char *scriptfile; +extern char *entrysym; extern int nlibdirs; extern char **libdirs;
--- a/lwlink/main.c Wed Sep 21 21:14:09 2011 -0600 +++ b/lwlink/main.c Thu Dec 22 18:01:59 2011 -0700 @@ -55,6 +55,11 @@ // debug debug_level++; break; + + case 'e': + // entry symbol + entrysym = arg; + break; case 'b': // decb output @@ -138,6 +143,8 @@ "Add DIR to the library search path" }, { "section-base", 0x100, "SECT=BASE", 0, "Load section SECT at BASE" }, + { "entry", 'e', "SYM", 0, + "Specify SYM as program entry point" }, { "sysroot", 0x101, "DIR", 0, "Specify the path to replace an initial = with in library paths" }, { "map", 'm', "FILE", 0,
--- a/lwlink/script.c Wed Sep 21 21:14:09 2011 -0600 +++ b/lwlink/script.c Thu Dec 22 18:01:59 2011 -0700 @@ -326,4 +326,25 @@ if (scriptfile || nscriptls) lw_free(oscript); + + if (entrysym) + { + int eaddr; + char *ptr2; + + lw_free(linkscript.execsym); + + eaddr = strtol(entrysym, &ptr2, 0); + if (*ptr2) + { + linkscript.execaddr = -1; + linkscript.execsym = lw_strdup(entrysym); + } + else + { + linkscript.execaddr = eaddr; + linkscript.execsym = NULL; + } + + } }