Line 43... |
Line 43... |
#include "defstd.h"
|
#include "defstd.h"
|
#include "plugin.h"
|
#include "plugin.h"
|
#include "gc.h"
|
#include "gc.h"
|
#include "icf.h"
|
#include "icf.h"
|
#include "incremental.h"
|
#include "incremental.h"
|
|
#include "timer.h"
|
|
|
namespace gold
|
namespace gold
|
{
|
{
|
|
|
class Object;
|
class Object;
|
Line 195... |
Line 196... |
workqueue->set_thread_count(thread_count);
|
workqueue->set_thread_count(thread_count);
|
|
|
// For incremental links, the base output file.
|
// For incremental links, the base output file.
|
Incremental_binary* ibase = NULL;
|
Incremental_binary* ibase = NULL;
|
|
|
if (parameters->incremental())
|
|
{
|
|
if (options.relocatable())
|
|
gold_error(_("incremental linking is incompatible with -r"));
|
|
if (options.emit_relocs())
|
|
gold_error(_("incremental linking is incompatible with --emit-relocs"));
|
|
if (options.gc_sections())
|
|
gold_error(_("incremental linking is incompatible with --gc-sections"));
|
|
if (options.icf_enabled())
|
|
gold_error(_("incremental linking is incompatible with --icf"));
|
|
if (options.has_plugins())
|
|
gold_error(_("incremental linking is incompatible with --plugin"));
|
|
if (strcmp(options.compress_debug_sections(), "none") != 0)
|
|
gold_error(_("incremental linking is incompatible with "
|
|
"--compress-debug-sections"));
|
|
|
|
if (parameters->incremental_update())
|
if (parameters->incremental_update())
|
{
|
{
|
Output_file* of = new Output_file(options.output_file_name());
|
Output_file* of = new Output_file(options.output_file_name());
|
if (of->open_base_file(options.incremental_base(), true))
|
if (of->open_base_file(options.incremental_base(), true))
|
{
|
{
|
Line 235... |
Line 220... |
gold_info(_("linking with --incremental-full"));
|
gold_info(_("linking with --incremental-full"));
|
else
|
else
|
gold_fallback(_("restart link with --incremental-full"));
|
gold_fallback(_("restart link with --incremental-full"));
|
}
|
}
|
}
|
}
|
}
|
|
|
|
// Read the input files. We have to add the symbols to the symbol
|
// Read the input files. We have to add the symbols to the symbol
|
// table in order. We do this by creating a separate blocker for
|
// table in order. We do this by creating a separate blocker for
|
// each input file. We associate the blocker with the following
|
// each input file. We associate the blocker with the following
|
// input file, to give us a convenient place to delete it.
|
// input file, to give us a convenient place to delete it.
|
Line 502... |
Line 486... |
Symbol_table* symtab,
|
Symbol_table* symtab,
|
Layout* layout,
|
Layout* layout,
|
Workqueue* workqueue,
|
Workqueue* workqueue,
|
Mapfile* mapfile)
|
Mapfile* mapfile)
|
{
|
{
|
|
Timer* timer = parameters->timer();
|
|
if (timer != NULL)
|
|
timer->stamp(0);
|
|
|
// Add any symbols named with -u options to the symbol table.
|
// Add any symbols named with -u options to the symbol table.
|
symtab->add_undefined_symbols_from_command_line(layout);
|
symtab->add_undefined_symbols_from_command_line(layout);
|
|
|
// If garbage collection was chosen, relocs have been read and processed
|
// If garbage collection was chosen, relocs have been read and processed
|
// at this point by pre_middle_tasks. Layout can then be done for all
|
// at this point by pre_middle_tasks. Layout can then be done for all
|
Line 554... |
Line 542... |
Task_lock_obj<Object> tlo(task, *p);
|
Task_lock_obj<Object> tlo(task, *p);
|
(*p)->layout(symtab, layout, NULL);
|
(*p)->layout(symtab, layout, NULL);
|
}
|
}
|
}
|
}
|
|
|
|
/* If plugins have specified a section order, re-arrange input sections
|
|
according to a specified section order. If --section-ordering-file is
|
|
also specified, do not do anything here. */
|
|
if (parameters->options().has_plugins()
|
|
&& layout->is_section_ordering_specified()
|
|
&& !parameters->options().section_ordering_file ())
|
|
{
|
|
for (Layout::Section_list::const_iterator p
|
|
= layout->section_list().begin();
|
|
p != layout->section_list().end();
|
|
++p)
|
|
(*p)->update_section_layout(layout->get_section_order_map());
|
|
}
|
|
|
// Layout deferred objects due to plugins.
|
// Layout deferred objects due to plugins.
|
if (parameters->options().has_plugins())
|
if (parameters->options().has_plugins())
|
{
|
{
|
Plugin_manager* plugins = parameters->options().plugins();
|
Plugin_manager* plugins = parameters->options().plugins();
|
gold_assert(plugins != NULL);
|
gold_assert(plugins != NULL);
|
Line 787... |
Line 789... |
const Symbol_table* symtab,
|
const Symbol_table* symtab,
|
Layout* layout,
|
Layout* layout,
|
Workqueue* workqueue,
|
Workqueue* workqueue,
|
Output_file* of)
|
Output_file* of)
|
{
|
{
|
|
Timer* timer = parameters->timer();
|
|
if (timer != NULL)
|
|
timer->stamp(1);
|
|
|
int thread_count = options.thread_count_final();
|
int thread_count = options.thread_count_final();
|
if (thread_count == 0)
|
if (thread_count == 0)
|
thread_count = std::max(2, input_objects->number_of_input_objects());
|
thread_count = std::max(2, input_objects->number_of_input_objects());
|
workqueue->set_thread_count(thread_count);
|
workqueue->set_thread_count(thread_count);
|
|
|