From: frief Date: Sat, 15 May 2004 20:48:32 +0000 (+0000) Subject: save 2 bytes stack space with the option --main-return. The ljmp could probably be... X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=54e36d034b522545f65a088bd90e1ee15ab8c32b;p=fw%2Fsdcc save 2 bytes stack space with the option --main-return. The ljmp could probably be avoided too? git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3311 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/SDCCglue.c b/src/SDCCglue.c index d8f216e2..9b3b509f 100644 --- a/src/SDCCglue.c +++ b/src/SDCCglue.c @@ -1880,21 +1880,18 @@ glue (void) /* entry point @ start of CSEG */ fprintf (asmFile, "__sdcc_program_startup:\n"); - /* put in the call to main */ - fprintf (asmFile, "\tlcall\t_main\n"); + /* put in jump or call to main */ if (options.mainreturn) - { - - fprintf (asmFile, ";\treturn from main ; will return to caller\n"); - fprintf (asmFile, "\tret\n"); - - } + { + fprintf (asmFile, "\tljmp\t_main\n"); /* needed? */ + fprintf (asmFile, ";\treturn from main will return to caller\n"); + } else - { - - fprintf (asmFile, ";\treturn from main will lock up\n"); - fprintf (asmFile, "\tsjmp .\n"); - } + { + fprintf (asmFile, "\tlcall\t_main\n"); + fprintf (asmFile, ";\treturn from main will lock up\n"); + fprintf (asmFile, "\tsjmp .\n"); + } } copyFile (asmFile, code->oFile);