* incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc

info; adjust display of GOT entries.
	* incremental.cc (Sized_incremental_binary::setup_readers): Allocate
	vector of input objects; remove file_status_.
	(Sized_incremental_binary::do_reserve_layout): Remove file_status_.
	(Sized_incremental_binary::do_process_got_plt): Adjust calls to
	got_plt reader; call target hooks to reserve GOT entries.
	(Output_section_incremental_inputs::set_final_data_size): Adjust size
	of input file info header and GOT info entry.
	(Output_section_incremental_inputs::write_info_blocks): Write dynamic
	relocation info.
	(Got_plt_view_info::got_descriptor): Remove.
	(Got_plt_view_info::sym_index): New data member.
	(Got_plt_view_info::input_index): New data member.
	(Local_got_offset_visitor::visit): Write input file index.
	(Global_got_offset_visitor::visit): Write 0 for input file index.
	(Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
	with sym_index and input_index.
	(Output_section_incremental_inputs::write_got_plt): Adjust size of
	incremental info GOT entry; replace got_descriptor with input_index.
	(Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
	map from input file index to object.
	(Sized_relobj_incr::do_layout): Replace direct data member reference
	with accessor function.
	(Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
	* incremental.h (Incremental_input_entry_reader::get_symbol_offset):
	Adjust size of input file info header.
	(Incremental_input_entry_reader::get_first_dyn_reloc): New function.
	(Incremental_input_entry_reader::get_dyn_reloc_count): New function.
	(Incremental_input_entry_reader::get_input_section): Adjust size of
	input file info header.
	(Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
	of incremental info GOT entry.
	(Incremental_got_plt_reader::get_got_desc): Remove.
	(Incremental_got_plt_reader::get_got_symndx): New function.
	(Incremental_got_plt_reader::get_got_input_index): New function.
	(Sized_incremental_binary::Sized_incremental_binary): Remove
	file_status_; add input_objects_.
	(Sized_incremental_binary::~Sized_incremental_binary): Remove.
	(Sized_incremental_binary::set_file_is_unchanged): Remove.
	(Sized_incremental_binary::file_is_unchanged): Remove.
	(Sized_incremental_binary::set_input_object): New function.
	(Sized_incremental_binary::input_object): New function.
	(Sized_incremental_binary::file_status_): Remove.
	(Sized_incremental_binary::input_objects_): New data member.
	(Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
	references.
	(Sized_relobj_incr::invalid_address): Move to base class.
	(Sized_relobj_incr::is_output_section_offset_invalid): Move to base
	class.
	(Sized_relobj_incr::do_output_section_offset): Likewise.
	(Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
	(Sized_relobj_incr::section_offsets_): Likewise.
	* object.cc (Sized_relobj::do_for_all_local_got_entries): New
	function.
	(Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
	(Sized_relobj_file::layout_section): Replace refs to section_offsets_
	with accessor function.
	(Sized_relobj_file::do_layout): Likewise.
	(Sized_relobj_file::do_layout_deferred_sections): Likewise.
	(Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
	(Sized_relobj_file::compute_final_local_value): Replace refs to
	section_offsets_ with accessor function.
	(Sized_relobj_file::do_finalize_local_symbols): Likewise.
	* object.h (Relobj::Relobj): Initialize new data members.
	(Relobj::add_dyn_reloc): New function.
	(Relobj::first_dyn_reloc): New function.
	(Relobj::dyn_reloc_count): New function.
	(Relobj::first_dyn_reloc_): New data member.
	(Relobj::dyn_reloc_count_): New data member.
	(Sized_relobj): Rename Sized_relobj_base to this; adjust all
	references.
	(Sized_relobj::Address): New typedef.
	(Sized_relobj::invalid_address): Move here from child class.
	(Sized_relobj::Sized_relobj): Initialize new data members.
	(Sized_relobj::sized_relobj): New function.
	(Sized_relobj::is_output_section_offset_invalid): Move here from
	child class.
	(Sized_relobj::get_output_section_offset): Likewise.
	(Sized_relobj::local_has_got_offset): Likewise.
	(Sized_relobj::local_got_offset): Likewise.
	(Sized_relobj::set_local_got_offset): Likewise.
	(Sized_relobj::do_for_all_local_got_entries): Likewise.
	(Sized_relobj::clear_got_offsets): New function.
	(Sized_relobj::section_offsets): Move here from child class.
	(Sized_relobj::do_output_section_offset): Likewise.
	(Sized_relobj::do_set_section_offset): Likewise.
	(Sized_relobj::Local_got_offsets): Likewise.
	(Sized_relobj::local_got_offsets_): Likewise.
	(Sized_relobj::section_offsets_): Likewise.
	(Sized_relobj_file): Rename Sized_relobj to this; adjust all
	references.
	(Sized_relobj_file::is_output_section_offset_invalid): Move to base
	class.
	(Sized_relobj_file::sized_relobj): New function
	(Sized_relobj_file::local_has_got_offset): Move to base class.
	(Sized_relobj_file::local_got_offset): Likewise.
	(Sized_relobj_file::set_local_got_offset): Likewise.
	(Sized_relobj_file::get_output_section_offset): Likewise.
	(Sized_relobj_file::do_for_all_local_got_entries): Likewise.
	(Sized_relobj_file::do_output_section_offset): Likewise.
	(Sized_relobj_file::do_set_section_offset): Likewise.
	(Sized_relobj_file::Local_got_offsets): Likewise.
	(Sized_relobj_file::local_got_offsets_): Likewise.
	(Sized_relobj_file::section_offsets_): Likewise.
	* output.cc (Output_reloc::Output_reloc): Adjust type of relobj
	(all constructors).
	(set_needs_dynsym_index): Convert relobj to derived class pointer.
	(Output_reloc::get_symbol_index): Likewise.
	(Output_reloc::local_section_offset): Likewise.
	(Output_reloc::get_address): Likewise.
	(Output_reloc::symbol_value): Likewise.
	(Output_data_got::reserve_slot): Move to class definition.
	(Output_data_got::reserve_local): New function.
	(Output_data_got::reserve_slot_for_global): Remove.
	(Output_data_got::reserve_global): New function.
	* output.h (Output_reloc::Output_reloc): Adjust type of relobj
	(all constructors, two instantiations).
	(Output_reloc::get_relobj): New function (two instantiations).
	(Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
	(Output_data_reloc_base::add): Convert relobj to derived class pointer.
	(Output_data_reloc::add_global): Adjust type of relobj.
	(Output_data_reloc::add_global_relative): Likewise.
	(Output_data_reloc::add_symbolless_global_addend): Likewise.
	(Output_data_reloc::add_local): Likewise.
	(Output_data_reloc::add_local_relative): Likewise.
	(Output_data_reloc::add_symbolless_local_addend): Likewise.
	(Output_data_reloc::add_local_section): Likewise.
	(Output_data_reloc::add_output_section): Likewise.
	(Output_data_reloc::add_absolute): Likewise.
	(Output_data_reloc::add_target_specific): Likewise.
	(Output_data_got::reserve_slot): Move definition here.
	(Output_data_got::reserve_local): New function.
	(Output_data_got::reserve_global): New function.
	* reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
	section_offsets_ with accessor function.
	(Sized_relobj_file::write_sections): Likewise.
	(Sized_relobj_file::do_relocate_sections): Likewise.
	* target.h (Sized_target::reserve_local_got_entry): New function.
	(Sized_target::reserve_global_got_entry): New function.
	* x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
	(Target_x86_64::reserve_global_got_entry): New function.
	(Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
This commit is contained in:
Cary Coutant
2011-05-24 21:41:10 +00:00
parent 2e21250dbc
commit 6fa2a40bf4
32 changed files with 1265 additions and 874 deletions

View File

@ -941,10 +941,13 @@ set_needs_dynsym_index()
default:
{
const unsigned int lsi = this->local_sym_index_;
Sized_relobj_file<size, big_endian>* relobj =
this->u1_.relobj->sized_relobj();
gold_assert(relobj != NULL);
if (!this->is_section_symbol_)
this->u1_.relobj->set_needs_output_dynsym_entry(lsi);
relobj->set_needs_output_dynsym_entry(lsi);
else
this->u1_.relobj->output_section(lsi)->set_needs_dynsym_index();
relobj->output_section(lsi)->set_needs_dynsym_index();
}
break;
}
@ -994,16 +997,19 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::get_symbol_index()
default:
{
const unsigned int lsi = this->local_sym_index_;
Sized_relobj_file<size, big_endian>* relobj =
this->u1_.relobj->sized_relobj();
gold_assert(relobj != NULL);
if (!this->is_section_symbol_)
{
if (dynamic)
index = this->u1_.relobj->dynsym_index(lsi);
index = relobj->dynsym_index(lsi);
else
index = this->u1_.relobj->symtab_index(lsi);
index = relobj->symtab_index(lsi);
}
else
{
Output_section* os = this->u1_.relobj->output_section(lsi);
Output_section* os = relobj->output_section(lsi);
gold_assert(os != NULL);
if (dynamic)
index = os->dynsym_index();
@ -1038,7 +1044,10 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::
if (offset != invalid_address)
return offset + addend;
// This is a merge section.
offset = os->output_address(this->u1_.relobj, lsi, addend);
Sized_relobj_file<size, big_endian>* relobj =
this->u1_.relobj->sized_relobj();
gold_assert(relobj != NULL);
offset = os->output_address(relobj, lsi, addend);
gold_assert(offset != invalid_address);
return offset;
}
@ -1059,8 +1068,10 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::get_address() const
address += os->address() + off;
else
{
address = os->output_address(this->u2_.relobj, this->shndx_,
address);
Sized_relobj_file<size, big_endian>* relobj =
this->u2_.relobj->sized_relobj();
gold_assert(relobj != NULL);
address = os->output_address(relobj, this->shndx_, address);
gold_assert(address != invalid_address);
}
}
@ -1113,8 +1124,11 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::symbol_value(
&& this->local_sym_index_ != 0
&& !this->is_section_symbol_);
const unsigned int lsi = this->local_sym_index_;
const Symbol_value<size>* symval = this->u1_.relobj->local_symbol(lsi);
return symval->value(this->u1_.relobj, addend);
Sized_relobj_file<size, big_endian>* relobj =
this->u1_.relobj->sized_relobj();
gold_assert(relobj != NULL);
const Symbol_value<size>* symval = relobj->local_symbol(lsi);
return symval->value(relobj, addend);
}
// Reloc comparison. This function sorts the dynamic relocs for the
@ -1265,7 +1279,7 @@ Output_relocatable_relocs<sh_type, size, big_endian>::set_final_data_size()
template<int size, bool big_endian>
Output_data_group<size, big_endian>::Output_data_group(
Sized_relobj<size, big_endian>* relobj,
Sized_relobj_file<size, big_endian>* relobj,
section_size_type entry_count,
elfcpp::Elf_Word flags,
std::vector<unsigned int>* input_shndxes)
@ -1367,7 +1381,7 @@ Output_data_got<size, big_endian>::Got_entry::write(unsigned char* pov) const
default:
{
const Sized_relobj<size, big_endian>* object = this->u_.object;
const Sized_relobj_file<size, big_endian>* object = this->u_.object;
const unsigned int lsi = this->local_sym_index_;
const Symbol_value<size>* symval = object->local_symbol(lsi);
if (!this->use_plt_offset_)
@ -1505,7 +1519,7 @@ Output_data_got<size, big_endian>::add_global_pair_with_rela(
template<int size, bool big_endian>
bool
Output_data_got<size, big_endian>::add_local(
Sized_relobj<size, big_endian>* object,
Sized_relobj_file<size, big_endian>* object,
unsigned int symndx,
unsigned int got_type)
{
@ -1523,7 +1537,7 @@ Output_data_got<size, big_endian>::add_local(
template<int size, bool big_endian>
bool
Output_data_got<size, big_endian>::add_local_plt(
Sized_relobj<size, big_endian>* object,
Sized_relobj_file<size, big_endian>* object,
unsigned int symndx,
unsigned int got_type)
{
@ -1542,7 +1556,7 @@ Output_data_got<size, big_endian>::add_local_plt(
template<int size, bool big_endian>
void
Output_data_got<size, big_endian>::add_local_with_rel(
Sized_relobj<size, big_endian>* object,
Sized_relobj_file<size, big_endian>* object,
unsigned int symndx,
unsigned int got_type,
Rel_dyn* rel_dyn,
@ -1559,7 +1573,7 @@ Output_data_got<size, big_endian>::add_local_with_rel(
template<int size, bool big_endian>
void
Output_data_got<size, big_endian>::add_local_with_rela(
Sized_relobj<size, big_endian>* object,
Sized_relobj_file<size, big_endian>* object,
unsigned int symndx,
unsigned int got_type,
Rela_dyn* rela_dyn,
@ -1579,7 +1593,7 @@ Output_data_got<size, big_endian>::add_local_with_rela(
template<int size, bool big_endian>
void
Output_data_got<size, big_endian>::add_local_pair_with_rel(
Sized_relobj<size, big_endian>* object,
Sized_relobj_file<size, big_endian>* object,
unsigned int symndx,
unsigned int shndx,
unsigned int got_type,
@ -1604,7 +1618,7 @@ Output_data_got<size, big_endian>::add_local_pair_with_rel(
template<int size, bool big_endian>
void
Output_data_got<size, big_endian>::add_local_pair_with_rela(
Sized_relobj<size, big_endian>* object,
Sized_relobj_file<size, big_endian>* object,
unsigned int symndx,
unsigned int shndx,
unsigned int got_type,
@ -1630,21 +1644,26 @@ Output_data_got<size, big_endian>::add_local_pair_with_rela(
template<int size, bool big_endian>
void
Output_data_got<size, big_endian>::reserve_slot(unsigned int i)
Output_data_got<size, big_endian>::reserve_local(
unsigned int i,
Sized_relobj<size, big_endian>* object,
unsigned int sym_index,
unsigned int got_type)
{
this->free_list_.remove(i * size / 8, (i + 1) * size / 8);
this->reserve_slot(i);
object->set_local_got_offset(sym_index, got_type, this->got_offset(i));
}
// Reserve a slot in the GOT for a global symbol.
template<int size, bool big_endian>
void
Output_data_got<size, big_endian>::reserve_slot_for_global(
Output_data_got<size, big_endian>::reserve_global(
unsigned int i,
Symbol* gsym,
unsigned int got_type)
{
this->free_list_.remove(i * size / 8, (i + 1) * size / 8);
this->reserve_slot(i);
gsym->set_got_offset(got_type, this->got_offset(i));
}
@ -2189,7 +2208,7 @@ Output_section::set_entsize(uint64_t v)
template<int size, bool big_endian>
off_t
Output_section::add_input_section(Layout* layout,
Sized_relobj<size, big_endian>* object,
Sized_relobj_file<size, big_endian>* object,
unsigned int shndx,
const char* secname,
const elfcpp::Shdr<size, big_endian>& shdr,
@ -4821,7 +4840,7 @@ template
off_t
Output_section::add_input_section<32, false>(
Layout* layout,
Sized_relobj<32, false>* object,
Sized_relobj_file<32, false>* object,
unsigned int shndx,
const char* secname,
const elfcpp::Shdr<32, false>& shdr,
@ -4834,7 +4853,7 @@ template
off_t
Output_section::add_input_section<32, true>(
Layout* layout,
Sized_relobj<32, true>* object,
Sized_relobj_file<32, true>* object,
unsigned int shndx,
const char* secname,
const elfcpp::Shdr<32, true>& shdr,
@ -4847,7 +4866,7 @@ template
off_t
Output_section::add_input_section<64, false>(
Layout* layout,
Sized_relobj<64, false>* object,
Sized_relobj_file<64, false>* object,
unsigned int shndx,
const char* secname,
const elfcpp::Shdr<64, false>& shdr,
@ -4860,7 +4879,7 @@ template
off_t
Output_section::add_input_section<64, true>(
Layout* layout,
Sized_relobj<64, true>* object,
Sized_relobj_file<64, true>* object,
unsigned int shndx,
const char* secname,
const elfcpp::Shdr<64, true>& shdr,