diff options
author | Cary Coutant <ccoutant@google.com> | 2011-05-23 23:27:11 +0000 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2011-05-23 23:27:11 +0000 |
commit | 4829d394dedd7953e0ee0cf540ffccc01936499d (patch) | |
tree | eb77be5d59cedf93ed8a5ed3e7feb32530d51a65 /gold/output.h | |
parent | dd931b2ff2bf7cecc09dba03e8916e4adc9406be (diff) | |
download | gdb-4829d394dedd7953e0ee0cf540ffccc01936499d.zip gdb-4829d394dedd7953e0ee0cf540ffccc01936499d.tar.gz gdb-4829d394dedd7953e0ee0cf540ffccc01936499d.tar.bz2 |
* gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
* incremental-dump.cc (dump_incremental_inputs): Mask high-order
bit when checking got_type.
* incremental.cc (Sized_incremental_binary::setup_readers):
Store symbol table and string table locations; initialize bit vector
of file status flags.
(Sized_incremental_binary::do_reserve_layout): Set bit flag for
unchanged files.
(Sized_incremental_binary::do_process_got_plt): New function.
(Sized_incremental_binary::get_symtab_view): Use stored locations.
(Output_section_incremental_inputs::set_final_data_size): Record
file index for each input file.
(Output_section_incremental_inputs::write_got_plt): Store file index
instead of input entry offset for each GOT entry.
* incremental.h
(Incremental_input_entry::Incremental_input_entry): Initialize new
data member.
(Incremental_input_entry::set_offset): Store file index.
(Incremental_input_entry::get_file_index): New function.
(Incremental_input_entry::file_index_): New data member.
(Incremental_binary::process_got_plt): New function.
(Incremental_binary::do_process_got_plt): New function.
(Sized_incremental_binary::Sized_incremental_binary): Initialize new
data members.
(Sized_incremental_binary::~Sized_incremental_binary): New destructor.
(Sized_incremental_binary::set_file_is_unchanged): New function.
(Sized_incremental_binary::file_is_unchanged): New function.
(Sized_incremental_binary::do_process_got_plt): New function.
(Sized_incremental_binary::file_status_): New data member.
(Sized_incremental_binary::main_symtab_loc_): New data member.
(Sized_incremental_binary::main_strtab_loc_): New data member.
* output.cc (Output_data_got::Got_entry::write): Add case
RESERVED_CODE.
(Output_data_got::add_global): Call add_got_entry.
(Output_data_got::add_global_plt): Likewise.
(Output_data_got::add_global_with_rel): Likewise.
(Output_data_got::add_global_with_rela): Likewise.
(Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
(Output_data_got::add_global_pair_with_rela): Likewise.
(Output_data_got::add_local): Call add_got_entry.
(Output_data_got::add_local_plt): Likewise.
(Output_data_got::add_local_with_rel): Likewise.
(Output_data_got::add_local_with_rela): Likewise.
(Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
(Output_data_got::add_local_pair_with_rela): Likewise.
(Output_data_got::reserve_slot): New function.
(Output_data_got::reserve_slot_for_global): New function.
(Output_data_got::add_got_entry): New function.
(Output_data_got::add_got_entry_pair): New function.
(Output_section::add_output_section_data): Edit FIXME.
* output.h
(Output_section_data_build::Output_section_data_build): New
constructor with size parameter.
(Output_data_space::Output_data_space): Likewise.
(Output_data_got::Output_data_got): Initialize new data member; new
constructor with size parameter.
(Output_data_got::add_constant): Call add_got_entry.
(Output_data_got::reserve_slot): New function.
(Output_data_got::reserve_slot_for_global): New function.
(class Output_data_got::Got_entry): Add RESERVED_CODE.
(Output_data_got::add_got_entry): New function.
(Output_data_got::add_got_entry_pair): New function.
(Output_data_got::free_list_): New data member.
* target.h (Sized_target::init_got_plt_for_update): New function.
(Sized_target::register_global_plt_entry): New function.
* x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
Initialize new data member; call init; add constructor with PLT count.
(Output_data_plt_x86_64::init): New function.
(Output_data_plt_x86_64::add_relocation): New function.
(Output_data_plt_x86_64::reserve_slot): New function.
(Output_data_plt_x86_64::free_list_): New data member.
(Target_x86_64::init_got_plt_for_update): New function.
(Target_x86_64::register_global_plt_entry): New function.
(Output_data_plt_x86_64::add_entry): Allocate from free list for
incremental updates.
(Output_data_plt_x86_64::add_relocation): New function.
* testsuite/object_unittest.cc (Object_test): Set default options.
Diffstat (limited to 'gold/output.h')
-rw-r--r-- | gold/output.h | 54 |
1 files changed, 48 insertions, 6 deletions
diff --git a/gold/output.h b/gold/output.h index f47c724..418f016 100644 --- a/gold/output.h +++ b/gold/output.h @@ -764,6 +764,10 @@ class Output_section_data_build : public Output_section_data : Output_section_data(addralign) { } + Output_section_data_build(off_t data_size, uint64_t addralign) + : Output_section_data(data_size, addralign, false) + { } + // Set the current data size. void set_current_data_size(off_t data_size) @@ -890,6 +894,12 @@ class Output_data_space : public Output_section_data_build map_name_(map_name) { } + explicit Output_data_space(off_t data_size, uint64_t addralign, + const char* map_name) + : Output_section_data_build(data_size, addralign), + map_name_(map_name) + { } + // Set the alignment. void set_space_alignment(uint64_t align) @@ -1942,9 +1952,20 @@ class Output_data_got : public Output_section_data_build Output_data_got() : Output_section_data_build(Output_data::default_alignment_for_size(size)), - entries_() + entries_(), free_list_() { } + Output_data_got(off_t data_size) + : Output_section_data_build(data_size, + Output_data::default_alignment_for_size(size)), + entries_(), free_list_() + { + // For an incremental update, we have an existing GOT section. + // Initialize the list of entries and the free list. + this->entries_.resize(data_size / (size / 8)); + this->free_list_.init(data_size, false); + } + // Add an entry for a global symbol to the GOT. Return true if this // is a new GOT entry, false if the symbol was already in the GOT. bool @@ -2021,11 +2042,18 @@ class Output_data_got : public Output_section_data_build unsigned int add_constant(Valtype constant) { - this->entries_.push_back(Got_entry(constant)); - this->set_got_size(); - return this->last_got_offset(); + unsigned int got_offset = this->add_got_entry(Got_entry(constant)); + return got_offset; } + // Reserve a slot in the GOT for a local symbol or the second slot of a pair. + void + reserve_slot(unsigned int i); + + // Reserve a slot in the GOT for a global symbol. + void + reserve_slot_for_global(unsigned int i, Symbol* gsym, unsigned int got_type); + protected: // Write out the GOT table. void @@ -2043,7 +2071,7 @@ class Output_data_got : public Output_section_data_build public: // Create a zero entry. Got_entry() - : local_sym_index_(CONSTANT_CODE), use_plt_offset_(false) + : local_sym_index_(RESERVED_CODE), use_plt_offset_(false) { this->u_.constant = 0; } // Create a global symbol entry. @@ -2058,6 +2086,7 @@ class Output_data_got : public Output_section_data_build { gold_assert(local_sym_index != GSYM_CODE && local_sym_index != CONSTANT_CODE + && local_sym_index != RESERVED_CODE && local_sym_index == this->local_sym_index_); this->u_.object = object; } @@ -2076,7 +2105,8 @@ class Output_data_got : public Output_section_data_build enum { GSYM_CODE = 0x7fffffff, - CONSTANT_CODE = 0x7ffffffe + CONSTANT_CODE = 0x7ffffffe, + RESERVED_CODE = 0x7ffffffd }; union @@ -2097,6 +2127,14 @@ class Output_data_got : public Output_section_data_build typedef std::vector<Got_entry> Got_entries; + // Create a new GOT entry and return its offset. + unsigned int + add_got_entry(Got_entry got_entry); + + // Create a pair of new GOT entries and return the offset of the first. + unsigned int + add_got_entry_pair(Got_entry got_entry_1, Got_entry got_entry_2); + // Return the offset into the GOT of GOT entry I. unsigned int got_offset(unsigned int i) const @@ -2114,6 +2152,10 @@ class Output_data_got : public Output_section_data_build // The list of GOT entries. Got_entries entries_; + + // List of available regions within the section, for incremental + // update links. + Free_list free_list_; }; // Output_data_dynamic is used to hold the data in SHT_DYNAMIC |