aboutsummaryrefslogtreecommitdiff
path: root/gold/layout.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2011-04-22 22:39:55 +0000
committerCary Coutant <ccoutant@google.com>2011-04-22 22:39:55 +0000
commit94a3fc8b837eb39007fa4e82120f60ec9429317d (patch)
tree36553d09d1690d090951979ae7df2653c6bb471a /gold/layout.cc
parentc87e430233549c1670ff335b0d4614f1ea1d7edb (diff)
downloadgdb-94a3fc8b837eb39007fa4e82120f60ec9429317d.zip
gdb-94a3fc8b837eb39007fa4e82120f60ec9429317d.tar.gz
gdb-94a3fc8b837eb39007fa4e82120f60ec9429317d.tar.bz2
* incremental.cc (Sized_incremental_binary::setup_readers): Allocate
global symbol map. (Sized_incremental_binary::do_apply_incremental_relocs): New function. (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map. (Sized_incr_relobj::do_relocate): Remap section indices in incremental relocations. (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map. (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME. (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise. * incremental.h (Incremental_inputs_reader::global_symbol_reader_at_offset): New function. (Incremental_binary::apply_incremental_relocs): New function. (Incremental_binary::do_apply_incremental_relocs): New function. (Sized_incremental_binary::Sized_incremental_binary): Initialize new data member. (Sized_incremental_binary::add_global_symbol): New function. (Sized_incremental_binary::global_symbol): New function. (Sized_incremental_binary::do_apply_incremental_relocs): New function. (Sized_incremental_binary::symbol_map_): New data member. * layout.cc (Layout_task_runner::run): Apply incremental relocations. * target.h (Sized_target::apply_relocation): New function. * target-reloc.h (apply_relocation): New function. * x86_64.cc (Target_x86_64::apply_relocation): New function.
Diffstat (limited to 'gold/layout.cc')
-rw-r--r--gold/layout.cc28
1 files changed, 20 insertions, 8 deletions
diff --git a/gold/layout.cc b/gold/layout.cc
index 7afb21f..e397204 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -298,10 +298,11 @@ Layout::Relaxation_debug_check::verify_sections(
void
Layout_task_runner::run(Workqueue* workqueue, const Task* task)
{
- off_t file_size = this->layout_->finalize(this->input_objects_,
- this->symtab_,
- this->target_,
- task);
+ Layout* layout = this->layout_;
+ off_t file_size = layout->finalize(this->input_objects_,
+ this->symtab_,
+ this->target_,
+ task);
// Now we know the final size of the output file and we know where
// each piece of information goes.
@@ -309,11 +310,11 @@ Layout_task_runner::run(Workqueue* workqueue, const Task* task)
if (this->mapfile_ != NULL)
{
this->mapfile_->print_discarded_sections(this->input_objects_);
- this->layout_->print_to_mapfile(this->mapfile_);
+ layout->print_to_mapfile(this->mapfile_);
}
Output_file* of;
- if (this->layout_->incremental_base() == NULL)
+ if (layout->incremental_base() == NULL)
{
of = new Output_file(parameters->options().output_file_name());
if (this->options_.oformat_enum() != General_options::OBJECT_FORMAT_ELF)
@@ -322,13 +323,24 @@ Layout_task_runner::run(Workqueue* workqueue, const Task* task)
}
else
{
- of = this->layout_->incremental_base()->output_file();
+ of = layout->incremental_base()->output_file();
+
+ // Apply the incremental relocations for symbols whose values
+ // have changed. We do this before we resize the file and start
+ // writing anything else to it, so that we can read the old
+ // incremental information from the file before (possibly)
+ // overwriting it.
+ if (parameters->incremental_update())
+ layout->incremental_base()->apply_incremental_relocs(this->symtab_,
+ this->layout_,
+ of);
+
of->resize(file_size);
}
// Queue up the final set of tasks.
gold::queue_final_tasks(this->options_, this->input_objects_,
- this->symtab_, this->layout_, workqueue, of);
+ this->symtab_, layout, workqueue, of);
}
// Layout methods.