From: uz Date: Tue, 28 Jul 2009 18:55:23 +0000 (+0000) Subject: Prepared the code for referencing a symbol that forces the startup code to get X-Git-Tag: V2.13.0rc1~279 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=dff0e864589aa8871b7b4e271813cb2ac3b5dedd;p=cc65 Prepared the code for referencing a symbol that forces the startup code to get linked in. git-svn-id: svn://svn.cc65.org/cc65/trunk@3976 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/cc65/codegen.c b/src/cc65/codegen.c index 81f4ecfb3..4f58ce015 100644 --- a/src/cc65/codegen.c +++ b/src/cc65/codegen.c @@ -385,6 +385,16 @@ void g_defimport (const char* Name, int ZP) +void g_importstartup (void) +/* Forced import of the startup segment */ +{ +#if 0 + AddTextLine ("\t.forceimport\t__STARTUP_RUN__"); +#endif +} + + + void g_importmainargs (void) /* Forced import of a special symbol that handles arguments to main */ { diff --git a/src/cc65/codegen.h b/src/cc65/codegen.h index 815482fe4..2b94ec534 100644 --- a/src/cc65/codegen.h +++ b/src/cc65/codegen.h @@ -153,6 +153,9 @@ void g_defexport (const char* Name, int ZP); void g_defimport (const char* Name, int ZP); /* Import the given label */ +void g_importstartup (void); +/* Forced import of the startup segment */ + void g_importmainargs (void); /* Forced import of a special symbol that handles arguments to main */ diff --git a/src/cc65/function.c b/src/cc65/function.c index d278fc63a..9c2c3f45d 100644 --- a/src/cc65/function.c +++ b/src/cc65/function.c @@ -381,6 +381,11 @@ void NewFunc (SymEntry* Func) Error ("`main' must always return an int"); } + /* Add a forced import of a symbol that is contained in the startup + * code. This will force the startup code to be linked in. + */ + g_importstartup (); + /* If main() takes parameters, generate a forced import to a function * that will setup these parameters. This way, programs that do not * need the additional code will not get it.