This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gold patch] Incremental 13/18: Dynamic relocations


This patch adds incremental update support for dynamic relocations.
For dynamic relocations that result from static relocations from input
files, I record the range of output dynamic relocs for each input
file, and copy those over to the output file (adding two more fields
to the incremental info for each input file). For dynamic relocations
generated for other purposes, I let the linker regenerate them. In
order to regenerate the dynamic relocations for GOT entries, I added a
couple more target hooks, moved a bunch of GOT-related methods up to
Sized_relobj_base, and adjusted the types of the relobj parameter to
Output_data_got and Output_data_reloc methods.

-cary


	* 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_incr_relobj::Sized_incr_relobj): Adjust initializers; record
	map from input file index to object.
	(Sized_incr_relobj::do_layout): Replace direct data member reference
	with accessor function.
	(Sized_incr_relobj::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_incr_relobj::invalid_address): Move to base class.
	(Sized_incr_relobj::is_output_section_offset_invalid): Move to base
	class.
	(Sized_incr_relobj::do_output_section_offset): Likewise.
	(Sized_incr_relobj::do_for_all_local_got_entries): Likewise.
	(Sized_incr_relobj::section_offsets_): Likewise.
	* object.cc (Sized_relobj_base::do_for_all_local_got_entries): New
	function.
	(Sized_relobj::Sized_relobj): Remove local_got_offsets_.
	(Sized_relobj::layout_section): Replace refs to section_offsets_
	with accessor function.
	(Sized_relobj::do_layout): Likewise.
	(Sized_relobj::do_layout_deferred_sections): Likewise.
	(Sized_relobj::do_for_all_local_got_entries): Move to base class.
	(Sized_relobj::compute_final_local_value): Replace refs to
	section_offsets_ with accessor function.
	(Sized_relobj::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_base::Address): New typedef.
	(Sized_relobj_base::invalid_address): Move here from child class.
	(Sized_relobj_base::Sized_relobj_base): Initialize new data members.
	(Sized_relobj_base::sized_relobj): New function.
	(Sized_relobj_base::is_output_section_offset_invalid): Move here from
	child class.
	(Sized_relobj_base::get_output_section_offset): Likewise.
	(Sized_relobj_base::local_has_got_offset): Likewise.
	(Sized_relobj_base::local_got_offset): Likewise.
	(Sized_relobj_base::set_local_got_offset): Likewise.
	(Sized_relobj_base::do_for_all_local_got_entries): Likewise.
	(Sized_relobj_base::clear_got_offsets): New function.
	(Sized_relobj_base::section_offsets): Move here from child class.
	(Sized_relobj_base::do_output_section_offset): Likewise.
	(Sized_relobj_base::do_set_section_offset): Likewise.
	(Sized_relobj_base::Local_got_offsets): Likewise.
	(Sized_relobj_base::local_got_offsets_): Likewise.
	(Sized_relobj_base::section_offsets_): Likewise.
	(Sized_relobj::is_output_section_offset_invalid): Move to base class.
	(Sized_relobj::sized_relobj): New function
	(Sized_relobj::local_has_got_offset): Move to base class.
	(Sized_relobj::local_got_offset): Likewise.
	(Sized_relobj::set_local_got_offset): Likewise.
	(Sized_relobj::get_output_section_offset): Likewise.
	(Sized_relobj::do_for_all_local_got_entries): Likewise.
	(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.
	* 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::do_read_relocs): Replace refs to
	section_offsets_ with accessor function.
	(Sized_relobj::write_sections): Likewise.
	(Sized_relobj::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.

Attachment: incr-patch-13.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]