diff options
author | Steve Chamberlain <sac@cygnus> | 1992-10-05 16:15:11 +0000 |
---|---|---|
committer | Steve Chamberlain <sac@cygnus> | 1992-10-05 16:15:11 +0000 |
commit | f3739bc34994cd33a9ea23d359297d5bf3443c6b (patch) | |
tree | caa187f63cd19291533a7495963b8775af7962f4 /ld/ldmain.c | |
parent | 984cf2d71af2a849f63e37fb692f0295bc2d8d2f (diff) | |
download | gdb-f3739bc34994cd33a9ea23d359297d5bf3443c6b.zip gdb-f3739bc34994cd33a9ea23d359297d5bf3443c6b.tar.gz gdb-f3739bc34994cd33a9ea23d359297d5bf3443c6b.tar.bz2 |
Mon Oct 5 08:55:14 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* ldmain.c (linear_library): don't even think about processing
an object file if it's already been done
Diffstat (limited to 'ld/ldmain.c')
-rw-r--r-- | ld/ldmain.c | 117 |
1 files changed, 59 insertions, 58 deletions
diff --git a/ld/ldmain.c b/ld/ldmain.c index 965aa72..bc0938c 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -184,13 +184,16 @@ main (argc, argv) ldemul_before_parse (); lang_has_input_file = false; parse_args (argc, argv); + + if (config.relocateable_output && command_line.relax) + { + einfo ("%P%F: -relax and -r may not be used together\n"); + } lang_final (); if (trace_files) { - info ("%P: mode %s\n", emulation); - } if (lang_has_input_file == false) { @@ -236,43 +239,34 @@ main (argc, argv) } if (config.relocateable_output) - { - output_bfd->flags &= ~EXEC_P; - - ldwrite (); - bfd_close (output_bfd); - } - + output_bfd->flags &= ~EXEC_P; else - { - - output_bfd->flags |= EXEC_P; - - ldwrite (); - - - if (config.make_executable == false && force_make_executable == false) - { + output_bfd->flags |= EXEC_P; - if (trace_files == true) - { - einfo ("%P: Link errors found, deleting executable `%s'\n", - output_filename); - } + ldwrite (); - if (output_bfd->iostream) - fclose ((FILE *) (output_bfd->iostream)); + /* Even if we're producing relocateable output, some non-fatal errors should + be reported in the exit status. (What non-fatal errors, if any, do we + want to ignore for relocateable output?) */ - unlink (output_filename); - exit (1); - } - else + if (config.make_executable == false && force_make_executable == false) + { + if (trace_files == true) { - bfd_close (output_bfd); + einfo ("%P: Link errors found, deleting executable `%s'\n", + output_filename); } - } + if (output_bfd->iostream) + fclose ((FILE *) (output_bfd->iostream)); + unlink (output_filename); + exit (1); + } + else + { + bfd_close (output_bfd); + } exit (0); } /* main() */ @@ -836,39 +830,46 @@ linear_library (entry) more_to_do = false; while (archive) { + /* Don't check this file if it's already been read in + once */ + + if (!archive->usrdata || + ! ((lang_input_statement_type *)(archive->usrdata))->loaded) + { #ifdef GNU960 - if (gnu960_check_format (archive, bfd_object)) + if (gnu960_check_format (archive, bfd_object)) #else - if (bfd_check_format (archive, bfd_object)) + if (bfd_check_format (archive, bfd_object)) #endif - { - register struct lang_input_statement_struct *subentry; + { + register struct lang_input_statement_struct *subentry; - subentry = decode_library_subfile (entry, - archive); + subentry = decode_library_subfile (entry, + archive); - archive->usrdata = (PTR) subentry; - if (!subentry) + archive->usrdata = (PTR) subentry; + if (!subentry) return; - if (subentry->loaded == false) - { - Q_read_entry_symbols (archive, subentry); - - if (subfile_wanted_p (subentry) == true) - { - Q_enter_file_symbols (subentry); - - if (prev) - prev->chain = subentry; - else - entry->subfiles = subentry; - prev = subentry; - - more_to_do = true; - subentry->loaded = true; - } - } - } + if (subentry->loaded == false) + { + Q_read_entry_symbols (archive, subentry); + + if (subfile_wanted_p (subentry) == true) + { + Q_enter_file_symbols (subentry); + + if (prev) + prev->chain = subentry; + else + entry->subfiles = subentry; + prev = subentry; + + more_to_do = true; + subentry->loaded = true; + } + } + } + } archive = bfd_openr_next_archived_file (entry->the_bfd, archive); } |