aboutsummaryrefslogtreecommitdiff
path: root/gold/incremental.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2011-03-30 21:07:13 +0000
committerCary Coutant <ccoutant@google.com>2011-03-30 21:07:13 +0000
commitc7975edd9eba42c2bd59948060d8d5c715456517 (patch)
tree2648d7512cb58f600066d281834f1c4d4aa53398 /gold/incremental.cc
parentef23e70580c5c6353e916d10f2f94eceba7a70cd (diff)
downloadgdb-c7975edd9eba42c2bd59948060d8d5c715456517.zip
gdb-c7975edd9eba42c2bd59948060d8d5c715456517.tar.gz
gdb-c7975edd9eba42c2bd59948060d8d5c715456517.tar.bz2
* archive.cc (Archive::include_member): Adjust call to report_object.
(Add_archive_symbols::run): Add script_info to call to report_archive_begin. (Lib_group::include_member): Adjust call to report_object. (Add_lib_group_symbols::run): Adjust call to report_object. * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary blocks. Add object count for script input files. * incremental.cc (Incremental_inputs::report_archive_begin): Add script_info parameter; change all callers. (Incremental_inputs::report_object): Add script_info parameter; change all callers. (Incremental_inputs::report_script): Store backpointer to incremental info entry. (Output_section_incremental_inputs::set_final_data_size): Record additional information for scripts. (Output_section_incremental_inputs::write_info_blocks): Likewise. * incremental.h (Incremental_script_entry::add_object): New function. (Incremental_script_entry::get_object_count): New function. (Incremental_script_entry::get_object): New function. (Incremental_script_entry::objects_): New data member; adjust constructor. (Incremental_inputs::report_archive_begin): Add script_info parameter. (Incremental_inputs::report_object): Add script_info parameter. (Incremental_inputs_reader::get_object_count): New function. (Incremental_inputs_reader::get_object_offset): New function. * options.cc (Input_arguments::add_file): Return reference to new input argument. * options.h (Input_argument::set_script_info): New function. (Input_argument::script_info): New function. (Input_argument::script_info_): New data member; adjust all constructors. (Input_file_group::add_file): Return reference to new input argument. (Input_file_lib::add_file): Likewise. (Input_arguments::add_file): Likewise. * readsyms.cc (Add_symbols::run): Adjust call to report_object. * script.cc (Parser_closure::Parser_closure): Add script_info parameter; adjust all callers. (Parser_closure::script_info): New function. (Parser_closure::script_info_): New data member. (read_input_script): Report scripts earlier to incremental info. (script_add_file): Set script_info in Input_argument. (script_add_library): Likewise. * script.h (Script_options::Script_info): Rewrite class.
Diffstat (limited to 'gold/incremental.cc')
-rw-r--r--gold/incremental.cc52
1 files changed, 47 insertions, 5 deletions
diff --git a/gold/incremental.cc b/gold/incremental.cc
index f7edf04..e5f71f5 100644
--- a/gold/incremental.cc
+++ b/gold/incremental.cc
@@ -436,7 +436,8 @@ Incremental_inputs::report_command_line(int argc, const char* const* argv)
// input objects until report_archive_end is called.
void
-Incremental_inputs::report_archive_begin(Library_base* arch)
+Incremental_inputs::report_archive_begin(Library_base* arch,
+ Script_info* script_info)
{
Stringpool::Key filename_key;
Timespec mtime = arch->get_mtime();
@@ -446,6 +447,13 @@ Incremental_inputs::report_archive_begin(Library_base* arch)
new Incremental_archive_entry(filename_key, mtime);
arch->set_incremental_info(entry);
this->inputs_.push_back(entry);
+
+ if (script_info != NULL)
+ {
+ Incremental_script_entry* script_entry = script_info->incremental_info();
+ gold_assert(script_entry != NULL);
+ script_entry->add_object(entry);
+ }
}
// Visitor class for processing the unused global symbols in a library.
@@ -496,7 +504,8 @@ Incremental_inputs::report_archive_end(Library_base* arch)
// Add_symbols task after finding out the type of the file.
void
-Incremental_inputs::report_object(Object* obj, Library_base* arch)
+Incremental_inputs::report_object(Object* obj, Library_base* arch,
+ Script_info* script_info)
{
Stringpool::Key filename_key;
Timespec mtime = obj->input_file()->file().get_mtime();
@@ -513,6 +522,13 @@ Incremental_inputs::report_object(Object* obj, Library_base* arch)
arch_entry->add_object(obj_entry);
}
+ if (script_info != NULL)
+ {
+ Incremental_script_entry* script_entry = script_info->incremental_info();
+ gold_assert(script_entry != NULL);
+ script_entry->add_object(obj_entry);
+ }
+
this->current_object_ = obj;
this->current_object_entry_ = obj_entry;
}
@@ -548,6 +564,7 @@ Incremental_inputs::report_script(const std::string& filename,
Incremental_script_entry* entry =
new Incremental_script_entry(filename_key, script, mtime);
this->inputs_.push_back(entry);
+ script->set_incremental_info(entry);
}
// Finalize the incremental link information. Called from
@@ -640,8 +657,15 @@ Output_section_incremental_inputs<size, big_endian>::set_final_data_size()
switch ((*p)->type())
{
case INCREMENTAL_INPUT_SCRIPT:
- // No supplemental info for a script.
- (*p)->set_info_offset(0);
+ {
+ Incremental_script_entry *entry = (*p)->script_entry();
+ gold_assert(entry != NULL);
+ (*p)->set_info_offset(info_offset);
+ // Object count.
+ info_offset += 4;
+ // Each member.
+ info_offset += (entry->get_object_count() * 4);
+ }
break;
case INCREMENTAL_INPUT_OBJECT:
case INCREMENTAL_INPUT_ARCHIVE_MEMBER:
@@ -845,7 +869,25 @@ Output_section_incremental_inputs<size, big_endian>::write_info_blocks(
switch ((*p)->type())
{
case INCREMENTAL_INPUT_SCRIPT:
- // No supplemental info for a script.
+ {
+ gold_assert(static_cast<unsigned int>(pov - oview)
+ == (*p)->get_info_offset());
+ Incremental_script_entry* entry = (*p)->script_entry();
+ gold_assert(entry != NULL);
+
+ // Write the object count.
+ unsigned int nobjects = entry->get_object_count();
+ Swap32::writeval(pov, nobjects);
+ pov += 4;
+
+ // For each object, write the offset to its input file entry.
+ for (unsigned int i = 0; i < nobjects; ++i)
+ {
+ Incremental_input_entry* obj = entry->get_object(i);
+ Swap32::writeval(pov, obj->get_offset());
+ pov += 4;
+ }
+ }
break;
case INCREMENTAL_INPUT_OBJECT: