// main.cc -- gold main function.
-// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
main(int argc, char** argv)
{
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
- setlocale (LC_MESSAGES, "");
+ setlocale(LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
- setlocale (LC_CTYPE, "");
+ setlocale(LC_CTYPE, "");
#endif
- bindtextdomain (PACKAGE, LOCALEDIR);
- textdomain (PACKAGE);
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
program_name = argv[0];
// The symbol table. We're going to guess here how many symbols
// we're going to see based on the number of input files. Even when
// this is off, it means at worst we don't quite optimize hashtable
- // resizing as well as we could have (perhap using more memory).
+ // resizing as well as we could have (perhaps using more memory).
Symbol_table symtab(command_line.number_of_input_files() * 1024,
command_line.version_script());
&command_line.script_options());
if (layout.incremental_inputs() != NULL)
- {
- layout.incremental_inputs()->report_command_line(argc, argv);
- layout.incremental_inputs()->report_inputs(command_line.inputs());
- }
+ layout.incremental_inputs()->report_command_line(argc, argv);
+
+ if (parameters->options().section_ordering_file())
+ layout.read_layout_from_file();
// Get the search path from the -L options.
Dirsearch search_path;
"(user: %ld.%06ld sys: %ld.%06ld wall: %ld.%06ld)\n"),
program_name,
elapsed.user / 1000, (elapsed.user % 1000) * 1000,
- elapsed.sys / 1000, (elapsed.user % 1000) * 1000,
+ elapsed.sys / 1000, (elapsed.sys % 1000) * 1000,
elapsed.wall / 1000, (elapsed.wall % 1000) * 1000);
#ifdef HAVE_MALLINFO
#endif
File_read::print_stats();
Archive::print_stats();
+ Lib_group::print_stats();
fprintf(stderr, _("%s: output file size: %lld bytes\n"),
program_name, static_cast<long long>(layout.output_file_size()));
symtab.print_stats();
layout.print_stats();
+ Free_list::print_stats();
}
- if (mapfile != NULL)
- mapfile->close();
-
// Issue defined symbol report.
if (command_line.options().user_set_print_symbol_counts())
input_objects.print_symbol_counts(&symtab);
+ // Output cross reference table.
+ if (command_line.options().cref())
+ input_objects.print_cref(&symtab,
+ mapfile == NULL ? stdout : mapfile->file());
+
+ if (mapfile != NULL)
+ mapfile->close();
+
if (parameters->options().fatal_warnings()
&& errors.warning_count() > 0
&& errors.error_count() == 0)
// If the user used --noinhibit-exec, we force the exit status to be
// successful. This is compatible with GNU ld.
- gold_exit(errors.error_count() == 0
- || parameters->options().noinhibit_exec());
+ gold_exit((errors.error_count() == 0
+ || parameters->options().noinhibit_exec())
+ ? GOLD_OK
+ : GOLD_ERR);
}