From: Richard Stallman Date: Mon, 26 Jul 1993 20:58:04 +0000 (+0000) Subject: (NAME__MAIN, SYMBOL__MAIN): Add default definitions. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d6cf3187658e1ba6db2a2502e8715dfbbf93d40b;p=gcc.git (NAME__MAIN, SYMBOL__MAIN): Add default definitions. (write_c_file, scan_prog_file(OSF/ROSE)): Use them instead of explicit __main. From-SVN: r4990 --- diff --git a/gcc/collect2.c b/gcc/collect2.c index a7f0f4fbd99..83821dc2915 100644 --- a/gcc/collect2.c +++ b/gcc/collect2.c @@ -149,6 +149,16 @@ extern int errno; #endif #endif /* OBJECT_FORMAT_NONE */ + +/* Some systems use __main in a way incompatible with its use in gcc, in these + cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to + give the same symbol without quotes for an alternative entry point. You + must define both, or niether. */ +#ifndef NAME__MAIN +#define NAME__MAIN "__main" +#define SYMBOL__MAIN __main +#endif + /* Linked lists of constructor and destructor names. */ @@ -1297,8 +1307,8 @@ write_c_file (stream, name) write_list (stream, "\t", destructors.first); fprintf (stream, "\t0\n};\n\n"); - fprintf (stream, "extern entry_pt __main;\n"); - fprintf (stream, "entry_pt *__main_reference = __main;\n\n"); + fprintf (stream, "extern entry_pt %s;\n", NAME__MAIN); + fprintf (stream, "entry_pt *__main_reference = %s;\n\n", NAME__MAIN); } @@ -1790,11 +1800,13 @@ scan_prog_file (prog_name, which_pass) if (rw) { - char *n = name; - while (*n == '_') - ++n; - if (*n != 'm' || (n - name) < 2 || strcmp (n, "main")) + char *n = name + strlen (name) - strlen (NAME__MAIN); + + if ((n - name) < 0 || strcmp (n, NAME__MAIN)) continue; + while (n != name) + if (*--n != '_') + continue; main_sym = sym; }