diff options
author | Per Bothner <per@bothner.com> | 2001-05-18 11:34:51 -0700 |
---|---|---|
committer | Per Bothner <bothner@gcc.gnu.org> | 2001-05-18 11:34:51 -0700 |
commit | 9d2896044874f318d09f171ef5a8581f50ca8d7b (patch) | |
tree | 317916a4b2bad48f4f182a4e224dbad018ff6510 /gcc | |
parent | 3a5a9edc34b1d170c5f342f2eb2f3210a4252e55 (diff) | |
download | gcc-9d2896044874f318d09f171ef5a8581f50ca8d7b.zip gcc-9d2896044874f318d09f171ef5a8581f50ca8d7b.tar.gz gcc-9d2896044874f318d09f171ef5a8581f50ca8d7b.tar.bz2 |
jvspec.c (lang_specific_pre_link): Re-arrange the linker command line so the jvgenmain-generated main program...
* jvspec.c (lang_specific_pre_link): Re-arrange the linker
command line so the jvgenmain-generated main program comes first.
From-SVN: r42270
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/java/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/java/jvspec.c | 16 |
2 files changed, 20 insertions, 1 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 7fd7de5..677d507 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2001-05-18 Per Bothner <per@bothner.com> + + * jvspec.c (lang_specific_pre_link): Re-arrange the linker + command line so the jvgenmain-generated main program comes first. + 2001-05-15 Tom Tromey <tromey@redhat.com> * class.c (build_utf8_ref): Don't generate identifier based on diff --git a/gcc/java/jvspec.c b/gcc/java/jvspec.c index c02071f..4a8c333 100644 --- a/gcc/java/jvspec.c +++ b/gcc/java/jvspec.c @@ -525,9 +525,23 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) int lang_specific_pre_link () { + int err; if (main_class_name == NULL) return 0; input_filename = main_class_name; input_filename_length = strlen (main_class_name); - return do_spec (jvgenmain_spec); + err = do_spec (jvgenmain_spec); + if (err == 0) + { + /* Shift the outfiles array so the generated main comes first. + This is important when linking against (non-shared) libraries, + since otherwise we risk (a) nothing getting linked or + (b) 'main' getting picked up from a library. */ + int i = n_infiles; + const char *generated = outfiles[i]; + while (--i >= 0) + outfiles[i + 1] = outfiles[i]; + outfiles[0] = generated; + } + return err; } |