elfcpp/ChangeLog:

* elfcpp.h (enum SHT): Add SHT_GNU_INCREMENTAL_GOT_PLT.

gold/ChangeLog:

	* arm.cc (Target_arm::got_size): Add const.
	(Target_arm::got_entry_count): New function.
	(Target_arm::plt_entry_count): New function.
	(Target_arm::first_plt_entry_offset): New function.
	(Target_arm::plt_entry_size): New function.
	(Output_data_plt_arm::entry_count): New function.
	(Output_data_plt_arm::first_plt_entry_offset): New function.
	(Output_data_plt_arm::get_plt_entry_size): New function.
	* i386.cc (Target_i386::got_size): Add const.
	(Target_i386::got_entry_count): New function.
	(Target_i386::plt_entry_count): New function.
	(Target_i386::first_plt_entry_offset): New function.
	(Target_i386::plt_entry_size): New function.
	(Output_data_plt_i386::entry_count): New function.
	(Output_data_plt_i386::first_plt_entry_offset): New function.
	(Output_data_plt_i386::get_plt_entry_size): New function.
	* incremental-dump.cc (dump_incremental_inputs): Adjust call to
	find_incremental_inputs_sections.  Dump incremental_got_plt section.
	* incremental.cc: Include target.h.
	(Sized_incremental_binary::do_find_incremental_inputs_sections): Add
	parameter.  Adjust all callers.  Find incremental_got_plt section.
	(Incremental_inputs::create_data_sections): Create incremental_got_plt
	section.
	(Output_section_incremental_inputs::set_final_data_size): Calculate
	size of incremental_got_plt section.
	(Output_section_incremental_inputs::do_write): Write the
	incremental_got_plt section.
	(Got_plt_view_info): New struct.
	(Local_got_offset_visitor): New class.
	(Global_got_offset_visitor): New class.
	(Global_symbol_visitor_got_plt): New class.
	(Output_section_incremental_inputs::write_got_plt): New function.
	* incremental.h (Incremental_binary::find_incremental_inputs_sections):
	Add parameter.  Adjust all callers.
	(Incremental_binary::do_find_incremental_inputs_sections): Likewise.
	(Incremental_inputs::got_plt_section): New function.
	(Incremental_inputs::got_plt_section_): New data member.
	(Incremental_got_plt_reader): New class.
	* layout.cc (Layout::create_incremental_info_sections): Add the
	incremental_got_plt section.
	* object.h (Got_offset_list::get_list): New function.
	(Got offset_list::for_all_got_offsets): New function.
	(Sized_relobj::local_got_offset_list): New function.
	* powerpc.cc (Target_powerpc::got_size): Add const.
	(Target_powerpc::got_entry_count): New function.
	(Target_powerpc::plt_entry_count): New function.
	(Target_powerpc::first_plt_entry_offset): New function.
	(Target_powerpc::plt_entry_size): New function.
	(Output_data_plt_powerpc::entry_count): New function.
	(Output_data_plt_powerpc::first_plt_entry_offset): New function.
	(Output_data_plt_powerpc::get_plt_entry_size): New function.
	* sparc.cc (Target_sparc::got_size): Add const.
	(Target_sparc::got_entry_count): New function.
	(Target_sparc::plt_entry_count): New function.
	(Target_sparc::first_plt_entry_offset): New function.
	(Target_sparc::plt_entry_size): New function.
	(Output_data_plt_sparc::entry_count): New function.
	(Output_data_plt_sparc::first_plt_entry_offset): New function.
	(Output_data_plt_sparc::get_plt_entry_size): New function.
	* symtab.h (Symbol::got_offset_list): New function.
	(Symbol_table::for_all_symbols): New function.
	* target.h (Sized_target::got_entry_count): New function.
	(Sized_target::plt_entry_count): New function.
	(Sized_target::plt_entry_size): New function.
	* x86_64.cc (Target_x86_64::got_size): Add const.
	(Target_x86_64::got_entry_count): New function.
	(Target_x86_64::plt_entry_count): New function.
	(Target_x86_64::first_plt_entry_offset): New function.
	(Target_x86_64::plt_entry_size): New function.
	(Output_data_plt_x86_64::entry_count): New function.
	(Output_data_plt_x86_64::first_plt_entry_offset): New function.
	(Output_data_plt_x86_64::get_plt_entry_size): New function.
This commit is contained in:
Cary Coutant
2010-08-12 22:15:00 +00:00
parent 09ec0418c0
commit 0e70b9111a
13 changed files with 866 additions and 27 deletions

View File

@@ -131,10 +131,12 @@ class Incremental_binary
find_incremental_inputs_sections(unsigned int* p_inputs_shndx,
unsigned int* p_symtab_shndx,
unsigned int* p_relocs_shndx,
unsigned int* p_got_plt_shndx,
unsigned int* p_strtab_shndx)
{
return do_find_incremental_inputs_sections(p_inputs_shndx, p_symtab_shndx,
p_relocs_shndx, p_strtab_shndx);
p_relocs_shndx, p_got_plt_shndx,
p_strtab_shndx);
}
// Check the .gnu_incremental_inputs section to see whether an incremental
@@ -153,6 +155,7 @@ class Incremental_binary
do_find_incremental_inputs_sections(unsigned int* p_inputs_shndx,
unsigned int* p_symtab_shndx,
unsigned int* p_relocs_shndx,
unsigned int* p_got_plt_shndx,
unsigned int* p_strtab_shndx) = 0;
// Check the .gnu_incremental_inputs section to see whether an incremental
@@ -182,6 +185,7 @@ class Sized_incremental_binary : public Incremental_binary
do_find_incremental_inputs_sections(unsigned int* p_inputs_shndx,
unsigned int* p_symtab_shndx,
unsigned int* p_relocs_shndx,
unsigned int* p_got_plt_shndx,
unsigned int* p_strtab_shndx);
virtual bool
@@ -577,6 +581,11 @@ class Incremental_inputs
relocs_section() const
{ return this->relocs_section_; }
// Return the .gnu_incremental_got_plt section.
Output_data_space*
got_plt_section() const
{ return this->got_plt_section_; }
// Return the .gnu_incremental_strtab stringpool.
Stringpool*
get_stringpool() const
@@ -635,6 +644,9 @@ class Incremental_inputs
// The .gnu_incremental_relocs section.
Output_data_space* relocs_section_;
// The .gnu_incremental_got_plt section.
Output_data_space* got_plt_section_;
// Total count of incremental relocations. Updated during Scan_relocs
// phase at the completion of each object file.
unsigned int reloc_count_;
@@ -889,7 +901,7 @@ class Incremental_symtab_reader
{ }
// Return the list head for symbol table entry N.
unsigned int get_list_head(unsigned int n)
unsigned int get_list_head(unsigned int n) const
{ return elfcpp::Swap<32, big_endian>::readval(this->p_ + 4 * n); }
private:
@@ -918,28 +930,28 @@ class Incremental_relocs_reader
// Return the relocation type for relocation entry at offset OFF.
unsigned int
get_r_type(unsigned int off)
get_r_type(unsigned int off) const
{
return elfcpp::Swap<32, big_endian>::readval(this->p_ + off);
}
// Return the output section index for relocation entry at offset OFF.
unsigned int
get_r_shndx(unsigned int off)
get_r_shndx(unsigned int off) const
{
return elfcpp::Swap<32, big_endian>::readval(this->p_ + off + 4);
}
// Return the output section offset for relocation entry at offset OFF.
Address
get_r_offset(unsigned int off)
get_r_offset(unsigned int off) const
{
return elfcpp::Swap<size, big_endian>::readval(this->p_ + off + 8);
}
// Return the addend for relocation entry at offset OFF.
Addend
get_r_addend(unsigned int off)
get_r_addend(unsigned int off) const
{
return elfcpp::Swap<size, big_endian>::readval(this->p_ + off + 8
+ this->field_size);
@@ -950,6 +962,65 @@ class Incremental_relocs_reader
const unsigned char* p_;
};
// Reader class for the .gnu_incremental_got_plt section.
template<bool big_endian>
class Incremental_got_plt_reader
{
public:
Incremental_got_plt_reader(const unsigned char* p) : p_(p)
{
this->got_count_ = elfcpp::Swap<32, big_endian>::readval(p);
this->got_desc_p_ = p + 8 + ((this->got_count_ + 3) & ~3);
this->plt_desc_p_ = this->got_desc_p_ + this->got_count_ * 4;
}
// Return the GOT entry count.
unsigned int
get_got_entry_count() const
{
return this->got_count_;
}
// Return the PLT entry count.
unsigned int
get_plt_entry_count() const
{
return elfcpp::Swap<32, big_endian>::readval(this->p_ + 4);
}
// Return the GOT type for GOT entry N.
unsigned int
get_got_type(unsigned int n)
{
return this->p_[8 + n];
}
// Return the GOT descriptor for GOT entry N.
unsigned int
get_got_desc(unsigned int n)
{
return elfcpp::Swap<32, big_endian>::readval(this->got_desc_p_ + n * 4);
}
// Return the PLT descriptor for PLT entry N.
unsigned int
get_plt_desc(unsigned int n)
{
return elfcpp::Swap<32, big_endian>::readval(this->plt_desc_p_ + n * 4);
}
private:
// Base address of the .gnu_incremental_got_plt section.
const unsigned char* p_;
// GOT entry count.
unsigned int got_count_;
// Base address of the GOT descriptor array.
const unsigned char* got_desc_p_;
// Base address of the PLT descriptor array.
const unsigned char* plt_desc_p_;
};
} // End namespace gold.
#endif // !defined(GOLD_INCREMENTAL_H)