1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-26 20:29:34 +00:00

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
This commit is contained in:
uz 2009-07-28 18:55:23 +00:00
parent 81464a1214
commit dff0e86458
3 changed files with 18 additions and 0 deletions

View File

@ -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 */
{

View File

@ -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 */

View File

@ -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.