#include "gold.h"
+#include <cstdio>
#include <cstring>
#ifdef HAVE_MALLINFO
#include "options.h"
#include "parameters.h"
#include "errors.h"
+#include "mapfile.h"
#include "dirsearch.h"
#include "workqueue.h"
#include "object.h"
+#include "archive.h"
#include "symtab.h"
#include "layout.h"
+#include "plugin.h"
using namespace gold;
write_debug_script(command_line.options().output_file_name(),
program_name, args.c_str());
+ // If the user asked for a map file, open it.
+ Mapfile* mapfile = NULL;
+ if (command_line.options().user_set_Map())
+ {
+ mapfile = new Mapfile();
+ if (!mapfile->open(command_line.options().Map()))
+ {
+ delete mapfile;
+ mapfile = NULL;
+ }
+ }
+
// The GNU linker ignores version scripts when generating
// relocatable output. If we are not compatible, then we break the
// Linux kernel build, which uses a linker script with -r which must
if (parameters->options().relocatable())
command_line.script_options().version_script_info()->clear();
+ // Load plugin libraries.
+ if (command_line.options().has_plugins())
+ command_line.options().plugins()->load_plugins();
+
// The work queue.
Workqueue workqueue(command_line.options());
// Queue up the first set of tasks.
queue_initial_tasks(command_line.options(), search_path,
command_line, &workqueue, &input_objects,
- &symtab, &layout);
+ &symtab, &layout, mapfile);
// Run the main task processing loop.
workqueue.process(0);
program_name, m.arena);
#endif
File_read::print_stats();
+ Archive::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();
}
+ if (mapfile != NULL)
+ mapfile->close();
+
+ // Issue defined symbol report.
+ if (command_line.options().user_set_print_symbol_counts())
+ input_objects.print_symbol_counts(&symtab);
+
if (parameters->options().fatal_warnings()
&& errors.warning_count() > 0
&& errors.error_count() == 0)