aboutsummaryrefslogtreecommitdiff
path: root/gold/incremental.h
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.h
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.h')
-rw-r--r--gold/incremental.h45
1 files changed, 42 insertions, 3 deletions
diff --git a/gold/incremental.h b/gold/incremental.h
index b55aa71..b799f7b 100644
--- a/gold/incremental.h
+++ b/gold/incremental.h
@@ -342,9 +342,29 @@ class Incremental_script_entry : public Incremental_input_entry
public:
Incremental_script_entry(Stringpool::Key filename_key, Script_info* script,
Timespec mtime)
- : Incremental_input_entry(filename_key, mtime), script_(script)
+ : Incremental_input_entry(filename_key, mtime), script_(script), objects_()
{ }
+ // Add a member object to the archive.
+ void
+ add_object(Incremental_input_entry* obj_entry)
+ {
+ this->objects_.push_back(obj_entry);
+ }
+
+ // Return the number of objects included by this script.
+ unsigned int
+ get_object_count()
+ { return this->objects_.size(); }
+
+ // Return the Nth object.
+ Incremental_input_entry*
+ get_object(unsigned int n)
+ {
+ gold_assert(n < this->objects_.size());
+ return this->objects_[n];
+ }
+
protected:
virtual Incremental_input_type
do_type() const
@@ -358,6 +378,8 @@ class Incremental_script_entry : public Incremental_input_entry
private:
// Information about the script file.
Script_info* script_;
+ // Objects that have been included by this script.
+ std::vector<Incremental_input_entry*> objects_;
};
// Class for recording input object files.
@@ -530,7 +552,7 @@ class Incremental_inputs
// Record the initial info for archive file ARCHIVE.
void
- report_archive_begin(Library_base* arch);
+ report_archive_begin(Library_base* arch, Script_info* script_info);
// Record the final info for archive file ARCHIVE.
void
@@ -539,7 +561,7 @@ class Incremental_inputs
// Record the info for object file OBJ. If ARCH is not NULL,
// attach the object file to the archive.
void
- report_object(Object* obj, Library_base* arch);
+ report_object(Object* obj, Library_base* arch, Script_info* script_info);
// Record an input section belonging to object file OBJ.
void
@@ -765,6 +787,23 @@ class Incremental_inputs_reader
}
}
+ // Return the object count -- for scripts only.
+ unsigned int
+ get_object_count() const
+ {
+ gold_assert(this->type_ == INCREMENTAL_INPUT_SCRIPT);
+ return Swap32::readval(this->inputs_->p_ + this->info_offset_);
+ }
+
+ // Return the input file offset for object N -- for scripts only.
+ unsigned int
+ get_object_offset(unsigned int n) const
+ {
+ gold_assert(this->type_ == INCREMENTAL_INPUT_SCRIPT);
+ return Swap32::readval(this->inputs_->p_ + this->info_offset_
+ + 4 + n * 4);
+ }
+
// Return the member count -- for archives only.
unsigned int
get_member_count() const