Line 56... |
Line 56... |
process_incremental_input(Incremental_binary*, unsigned int, Input_objects*,
|
process_incremental_input(Incremental_binary*, unsigned int, Input_objects*,
|
Symbol_table*, Layout*, Dirsearch*, Mapfile*,
|
Symbol_table*, Layout*, Dirsearch*, Mapfile*,
|
Task_token*, Task_token*);
|
Task_token*, Task_token*);
|
|
|
void
|
void
|
gold_exit(bool status)
|
gold_exit(Exit_status status)
|
{
|
{
|
if (parameters != NULL
|
if (parameters != NULL
|
&& parameters->options_valid()
|
&& parameters->options_valid()
|
&& parameters->options().has_plugins())
|
&& parameters->options().has_plugins())
|
parameters->options().plugins()->cleanup();
|
parameters->options().plugins()->cleanup();
|
if (!status && parameters != NULL && parameters->options_valid())
|
if (status != GOLD_OK && parameters != NULL && parameters->options_valid())
|
unlink_if_ordinary(parameters->options().output_file_name());
|
unlink_if_ordinary(parameters->options().output_file_name());
|
exit(status ? EXIT_SUCCESS : EXIT_FAILURE);
|
exit(status);
|
}
|
}
|
|
|
void
|
void
|
gold_nomem()
|
gold_nomem()
|
{
|
{
|
Line 85... |
Line 85... |
if (len >= 0)
|
if (len >= 0)
|
{
|
{
|
const char* const s = ": out of memory\n";
|
const char* const s = ": out of memory\n";
|
len = write(2, s, strlen(s));
|
len = write(2, s, strlen(s));
|
}
|
}
|
gold_exit(false);
|
gold_exit(GOLD_ERR);
|
}
|
}
|
|
|
// Handle an unreachable case.
|
// Handle an unreachable case.
|
|
|
void
|
void
|
do_gold_unreachable(const char* filename, int lineno, const char* function)
|
do_gold_unreachable(const char* filename, int lineno, const char* function)
|
{
|
{
|
fprintf(stderr, _("%s: internal error in %s, at %s:%d\n"),
|
fprintf(stderr, _("%s: internal error in %s, at %s:%d\n"),
|
program_name, function, filename, lineno);
|
program_name, function, filename, lineno);
|
gold_exit(false);
|
gold_exit(GOLD_ERR);
|
}
|
}
|
|
|
// This class arranges to run the functions done in the middle of the
|
// This class arranges to run the functions done in the middle of the
|
// link. It is just a closure.
|
// link. It is just a closure.
|
|
|
Line 174... |
Line 174... |
Symbol_table* symtab, Layout* layout, Mapfile* mapfile)
|
Symbol_table* symtab, Layout* layout, Mapfile* mapfile)
|
{
|
{
|
if (cmdline.begin() == cmdline.end())
|
if (cmdline.begin() == cmdline.end())
|
{
|
{
|
if (options.printed_version())
|
if (options.printed_version())
|
gold_exit(true);
|
gold_exit(GOLD_OK);
|
gold_fatal(_("no input files"));
|
gold_fatal(_("no input files"));
|
}
|
}
|
|
|
int thread_count = options.thread_count_initial();
|
int thread_count = options.thread_count_initial();
|
if (thread_count == 0)
|
if (thread_count == 0)
|
Line 198... |
Line 198... |
gold_error(_("incremental linking is incompatible with --gc-sections"));
|
gold_error(_("incremental linking is incompatible with --gc-sections"));
|
if (options.icf_enabled())
|
if (options.icf_enabled())
|
gold_error(_("incremental linking is incompatible with --icf"));
|
gold_error(_("incremental linking is incompatible with --icf"));
|
if (options.has_plugins())
|
if (options.has_plugins())
|
gold_error(_("incremental linking is incompatible with --plugin"));
|
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 220... |
Line 223... |
if (ibase == NULL)
|
if (ibase == NULL)
|
{
|
{
|
if (set_parameters_incremental_full())
|
if (set_parameters_incremental_full())
|
gold_info(_("linking with --incremental-full"));
|
gold_info(_("linking with --incremental-full"));
|
else
|
else
|
gold_fatal(_("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
|
Line 620... |
Line 623... |
(*p)->name().c_str());
|
(*p)->name().c_str());
|
}
|
}
|
}
|
}
|
}
|
}
|
|
|
// For incremental updates, record the existing GOT and PLT entries.
|
// For incremental updates, record the existing GOT and PLT entries,
|
|
// and the COPY relocations.
|
if (parameters->incremental_update())
|
if (parameters->incremental_update())
|
{
|
{
|
Incremental_binary* ibase = layout->incremental_base();
|
Incremental_binary* ibase = layout->incremental_base();
|
ibase->process_got_plt(symtab, layout);
|
ibase->process_got_plt(symtab, layout);
|
|
ibase->emit_copy_relocs(symtab);
|
}
|
}
|
|
|
if (is_debugging_enabled(DEBUG_SCRIPT))
|
if (is_debugging_enabled(DEBUG_SCRIPT))
|
layout->script_options()->print(stderr);
|
layout->script_options()->print(stderr);
|
|
|
Line 744... |
Line 749... |
{
|
{
|
// If we failed to open any input files, it's possible for
|
// If we failed to open any input files, it's possible for
|
// THIS_BLOCKER to be NULL here. There's no real point in
|
// THIS_BLOCKER to be NULL here. There's no real point in
|
// continuing if that happens.
|
// continuing if that happens.
|
gold_assert(parameters->errors()->error_count() > 0);
|
gold_assert(parameters->errors()->error_count() > 0);
|
gold_exit(false);
|
gold_exit(GOLD_ERR);
|
}
|
}
|
}
|
}
|
|
|
// When all those tasks are complete, we can start laying out the
|
// When all those tasks are complete, we can start laying out the
|
// output file.
|
// output file.
|