diff options
author | Richard Stallman <rms@gnu.org> | 1993-07-26 20:58:04 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1993-07-26 20:58:04 +0000 |
commit | d6cf3187658e1ba6db2a2502e8715dfbbf93d40b (patch) | |
tree | 9dfa6d4dde8dcabcf8674f565db8213a6cc62f66 | |
parent | d3984356259c6f6cf2f590da378b0d227cfcf29a (diff) | |
download | gcc-d6cf3187658e1ba6db2a2502e8715dfbbf93d40b.zip gcc-d6cf3187658e1ba6db2a2502e8715dfbbf93d40b.tar.gz gcc-d6cf3187658e1ba6db2a2502e8715dfbbf93d40b.tar.bz2 |
(NAME__MAIN, SYMBOL__MAIN): Add default definitions.
(write_c_file, scan_prog_file(OSF/ROSE)): Use them instead of explicit
__main.
From-SVN: r4990
-rw-r--r-- | gcc/collect2.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/gcc/collect2.c b/gcc/collect2.c index a7f0f4f..83821dc 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; } |