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.
+2011-05-24 Cary Coutant <ccoutant@google.com>
+
+ * 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.
+
2011-05-23 Cary Coutant <ccoutant@google.com>
* gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
// Arm_relobj class.
template<bool big_endian>
-class Arm_relobj : public Sized_relobj<32, big_endian>
+class Arm_relobj : public Sized_relobj_file<32, big_endian>
{
public:
static const Arm_address invalid_address = static_cast<Arm_address>(-1);
Arm_relobj(const std::string& name, Input_file* input_file, off_t offset,
const typename elfcpp::Ehdr<32, big_endian>& ehdr)
- : Sized_relobj<32, big_endian>(name, input_file, offset, ehdr),
+ : Sized_relobj_file<32, big_endian>(name, input_file, offset, ehdr),
stub_tables_(), local_symbol_is_thumb_function_(),
attributes_section_data_(NULL), mapping_symbols_info_(),
section_has_cortex_a8_workaround_(NULL), exidx_section_map_(),
do_setup()
{
// Call parent's setup method.
- Sized_relobj<32, big_endian>::do_setup();
+ Sized_relobj_file<32, big_endian>::do_setup();
// Initialize look-up tables.
Stub_table_list empty_stub_table_list(this->shnum(), NULL);
Stringpool_template<char>*);
void
- do_relocate_sections(const Symbol_table* symtab, const Layout* layout,
- const unsigned char* pshdrs, Output_file* of,
- typename Sized_relobj<32, big_endian>::Views* pivews);
+ do_relocate_sections(
+ const Symbol_table* symtab, const Layout* layout,
+ const unsigned char* pshdrs, Output_file* of,
+ typename Sized_relobj_file<32, big_endian>::Views* pivews);
// Read the symbol information.
void
// relocation that needs to be applied in a static link.
void
add_static_reloc(unsigned int got_offset, unsigned int r_type,
- Sized_relobj<32, big_endian>* relobj, unsigned int index)
+ Sized_relobj_file<32, big_endian>* relobj,
+ unsigned int index)
{
this->static_relocs_.push_back(Static_reloc(got_offset, r_type, relobj,
index));
// Same as the above but for a local symbol in OBJECT with INDEX.
void
add_tls_gd32_with_static_reloc(unsigned int got_type,
- Sized_relobj<32, big_endian>* object,
+ Sized_relobj_file<32, big_endian>* object,
unsigned int index);
protected:
{ this->u_.global.symbol = gsym; }
Static_reloc(unsigned int got_offset, unsigned int r_type,
- Sized_relobj<32, big_endian>* relobj, unsigned int index)
+ Sized_relobj_file<32, big_endian>* relobj, unsigned int index)
: got_offset_(got_offset), r_type_(r_type), symbol_is_global_(false)
{
this->u_.local.relobj = relobj;
}
// For a relocation against a local symbol, the defining object.
- Sized_relobj<32, big_endian>*
+ Sized_relobj_file<32, big_endian>*
relobj() const
{
gold_assert(!this->symbol_is_global_);
struct
{
// For a local symbol, the object defining object.
- Sized_relobj<32, big_endian>* relobj;
+ Sized_relobj_file<32, big_endian>* relobj;
// For a local symbol, the symbol index.
unsigned int index;
} local;
void
gc_process_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<32, big_endian>* object,
+ Sized_relobj_file<32, big_endian>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
void
scan_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<32, big_endian>* object,
+ Sized_relobj_file<32, big_endian>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
void
scan_relocatable_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<32, big_endian>* object,
+ Sized_relobj_file<32, big_endian>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
inline void
local(Symbol_table* symtab, Layout* layout, Target_arm* target,
- Sized_relobj<32, big_endian>* object,
+ Sized_relobj_file<32, big_endian>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rel<32, big_endian>& reloc, unsigned int r_type,
inline void
global(Symbol_table* symtab, Layout* layout, Target_arm* target,
- Sized_relobj<32, big_endian>* object,
+ Sized_relobj_file<32, big_endian>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rel<32, big_endian>& reloc, unsigned int r_type,
inline bool
local_reloc_may_be_function_pointer(Symbol_table* , Layout* , Target_arm* ,
- Sized_relobj<32, big_endian>* ,
+ Sized_relobj_file<32, big_endian>* ,
unsigned int ,
Output_section* ,
const elfcpp::Rel<32, big_endian>& ,
inline bool
global_reloc_may_be_function_pointer(Symbol_table* , Layout* , Target_arm* ,
- Sized_relobj<32, big_endian>* ,
+ Sized_relobj_file<32, big_endian>* ,
unsigned int ,
Output_section* ,
const elfcpp::Rel<32, big_endian>& ,
private:
static void
- unsupported_reloc_local(Sized_relobj<32, big_endian>*,
+ unsupported_reloc_local(Sized_relobj_file<32, big_endian>*,
unsigned int r_type);
static void
- unsupported_reloc_global(Sized_relobj<32, big_endian>*,
+ unsupported_reloc_global(Sized_relobj_file<32, big_endian>*,
unsigned int r_type, Symbol*);
void
// Create a GOT entry for the TLS module index.
unsigned int
got_mod_index_entry(Symbol_table* symtab, Layout* layout,
- Sized_relobj<32, big_endian>* object);
+ Sized_relobj_file<32, big_endian>* object);
// Get the PLT section.
const Output_data_plt_arm<big_endian>*
// Add a potential copy relocation.
void
copy_reloc(Symbol_table* symtab, Layout* layout,
- Sized_relobj<32, big_endian>* object,
+ Sized_relobj_file<32, big_endian>* object,
unsigned int shndx, Output_section* output_section,
Symbol* sym, const elfcpp::Rel<32, big_endian>& reloc)
{
// R_ARM_ABS8: S + A
static inline typename This::Status
abs8(unsigned char* view,
- const Sized_relobj<32, big_endian>* object,
+ const Sized_relobj_file<32, big_endian>* object,
const Symbol_value<32>* psymval)
{
typedef typename elfcpp::Swap<8, big_endian>::Valtype Valtype;
// R_ARM_THM_ABS5: S + A
static inline typename This::Status
thm_abs5(unsigned char* view,
- const Sized_relobj<32, big_endian>* object,
+ const Sized_relobj_file<32, big_endian>* object,
const Symbol_value<32>* psymval)
{
typedef typename elfcpp::Swap<16, big_endian>::Valtype Valtype;
// R_ARM_ABS12: S + A
static inline typename This::Status
abs12(unsigned char* view,
- const Sized_relobj<32, big_endian>* object,
+ const Sized_relobj_file<32, big_endian>* object,
const Symbol_value<32>* psymval)
{
typedef typename elfcpp::Swap<32, big_endian>::Valtype Valtype;
// R_ARM_ABS16: S + A
static inline typename This::Status
abs16(unsigned char* view,
- const Sized_relobj<32, big_endian>* object,
+ const Sized_relobj_file<32, big_endian>* object,
const Symbol_value<32>* psymval)
{
typedef typename elfcpp::Swap<16, big_endian>::Valtype Valtype;
// R_ARM_ABS32: (S + A) | T
static inline typename This::Status
abs32(unsigned char* view,
- const Sized_relobj<32, big_endian>* object,
+ const Sized_relobj_file<32, big_endian>* object,
const Symbol_value<32>* psymval,
Arm_address thumb_bit)
{
// R_ARM_REL32: (S + A) | T - P
static inline typename This::Status
rel32(unsigned char* view,
- const Sized_relobj<32, big_endian>* object,
+ const Sized_relobj_file<32, big_endian>* object,
const Symbol_value<32>* psymval,
Arm_address address,
Arm_address thumb_bit)
// R_ARM_THM_JUMP6: S + A – P
static inline typename This::Status
thm_jump6(unsigned char* view,
- const Sized_relobj<32, big_endian>* object,
+ const Sized_relobj_file<32, big_endian>* object,
const Symbol_value<32>* psymval,
Arm_address address)
{
// R_ARM_THM_JUMP8: S + A – P
static inline typename This::Status
thm_jump8(unsigned char* view,
- const Sized_relobj<32, big_endian>* object,
+ const Sized_relobj_file<32, big_endian>* object,
const Symbol_value<32>* psymval,
Arm_address address)
{
// R_ARM_THM_JUMP11: S + A – P
static inline typename This::Status
thm_jump11(unsigned char* view,
- const Sized_relobj<32, big_endian>* object,
+ const Sized_relobj_file<32, big_endian>* object,
const Symbol_value<32>* psymval,
Arm_address address)
{
// R_ARM_PREL: (S + A) | T - P
static inline typename This::Status
prel31(unsigned char* view,
- const Sized_relobj<32, big_endian>* object,
+ const Sized_relobj_file<32, big_endian>* object,
const Symbol_value<32>* psymval,
Arm_address address,
Arm_address thumb_bit)
// R_ARM_MOVW_BREL: ((S + A) | T) - B(S)
static inline typename This::Status
movw(unsigned char* view,
- const Sized_relobj<32, big_endian>* object,
+ const Sized_relobj_file<32, big_endian>* object,
const Symbol_value<32>* psymval,
Arm_address relative_address_base,
Arm_address thumb_bit,
// R_ARM_MOVT_BREL: S + A - B(S)
static inline typename This::Status
movt(unsigned char* view,
- const Sized_relobj<32, big_endian>* object,
+ const Sized_relobj_file<32, big_endian>* object,
const Symbol_value<32>* psymval,
Arm_address relative_address_base)
{
// R_ARM_THM_MOVW_BREL: ((S + A) | T) - B(S)
static inline typename This::Status
thm_movw(unsigned char* view,
- const Sized_relobj<32, big_endian>* object,
+ const Sized_relobj_file<32, big_endian>* object,
const Symbol_value<32>* psymval,
Arm_address relative_address_base,
Arm_address thumb_bit,
// R_ARM_THM_MOVT_BREL: S + A - B(S)
static inline typename This::Status
thm_movt(unsigned char* view,
- const Sized_relobj<32, big_endian>* object,
+ const Sized_relobj_file<32, big_endian>* object,
const Symbol_value<32>* psymval,
Arm_address relative_address_base)
{
// R_ARM_THM_ALU_PREL_11_0: ((S + A) | T) - Pa (Thumb32)
static inline typename This::Status
thm_alu11(unsigned char* view,
- const Sized_relobj<32, big_endian>* object,
+ const Sized_relobj_file<32, big_endian>* object,
const Symbol_value<32>* psymval,
Arm_address address,
Arm_address thumb_bit)
// R_ARM_THM_PC8: S + A - Pa (Thumb)
static inline typename This::Status
thm_pc8(unsigned char* view,
- const Sized_relobj<32, big_endian>* object,
+ const Sized_relobj_file<32, big_endian>* object,
const Symbol_value<32>* psymval,
Arm_address address)
{
// R_ARM_THM_PC12: S + A - Pa (Thumb32)
static inline typename This::Status
thm_pc12(unsigned char* view,
- const Sized_relobj<32, big_endian>* object,
+ const Sized_relobj_file<32, big_endian>* object,
const Symbol_value<32>* psymval,
Arm_address address)
{
// R_ARM_ALU_SB_G2: ((S + A) | T) - B(S)
static inline typename This::Status
arm_grp_alu(unsigned char* view,
- const Sized_relobj<32, big_endian>* object,
+ const Sized_relobj_file<32, big_endian>* object,
const Symbol_value<32>* psymval,
const int group,
Arm_address address,
// R_ARM_LDR_SB_G2: S + A - B(S)
static inline typename This::Status
arm_grp_ldr(unsigned char* view,
- const Sized_relobj<32, big_endian>* object,
+ const Sized_relobj_file<32, big_endian>* object,
const Symbol_value<32>* psymval,
const int group,
Arm_address address)
// R_ARM_LDRS_SB_G2: S + A - B(S)
static inline typename This::Status
arm_grp_ldrs(unsigned char* view,
- const Sized_relobj<32, big_endian>* object,
+ const Sized_relobj_file<32, big_endian>* object,
const Symbol_value<32>* psymval,
const int group,
Arm_address address)
// R_ARM_LDC_SB_G2: S + A - B(S)
static inline typename This::Status
arm_grp_ldc(unsigned char* view,
- const Sized_relobj<32, big_endian>* object,
+ const Sized_relobj_file<32, big_endian>* object,
const Symbol_value<32>* psymval,
const int group,
Arm_address address)
// do_count_local_symbol in parent and scan local symbols to mark
// THUMB functions. This is not the most efficient way but I do not want to
// slow down other ports by calling a per symbol target hook inside
-// Sized_relobj<size, big_endian>::do_count_local_symbols.
+// Sized_relobj_file<size, big_endian>::do_count_local_symbols.
template<bool big_endian>
void
// STT_ARM_TFUNC.
// Ask parent to count the local symbols.
- Sized_relobj<32, big_endian>::do_count_local_symbols(pool, dynpool);
+ Sized_relobj_file<32, big_endian>::do_count_local_symbols(pool, dynpool);
const unsigned int loccount = this->local_symbol_count();
if (loccount == 0)
return;
// Skip the first dummy symbol.
psyms += sym_size;
- typename Sized_relobj<32, big_endian>::Local_values* plocal_values =
+ typename Sized_relobj_file<32, big_endian>::Local_values* plocal_values =
this->local_values();
for (unsigned int i = 1; i < loccount; ++i, psyms += sym_size)
{
const Layout* layout,
const unsigned char* pshdrs,
Output_file* of,
- typename Sized_relobj<32, big_endian>::Views* pviews)
+ typename Sized_relobj_file<32, big_endian>::Views* pviews)
{
// Call parent to relocate sections.
- Sized_relobj<32, big_endian>::do_relocate_sections(symtab, layout, pshdrs,
- of, pviews);
+ Sized_relobj_file<32, big_endian>::do_relocate_sections(symtab, layout,
+ pshdrs, of, pviews);
// We do not generate stubs if doing a relocatable link.
if (parameters->options().relocatable())
Arm_relobj<big_endian>::do_read_symbols(Read_symbols_data* sd)
{
// Call parent class to read symbol information.
- Sized_relobj<32, big_endian>::do_read_symbols(sd);
+ Sized_relobj_file<32, big_endian>::do_read_symbols(sd);
// If this input file is a binary file, it has no processor
// specific flags and attributes section.
Read_relocs_data* rd)
{
// First, call base class method to process relocations in this object.
- Sized_relobj<32, big_endian>::do_gc_process_relocs(symtab, layout, rd);
+ Sized_relobj_file<32, big_endian>::do_gc_process_relocs(symtab, layout, rd);
// If --gc-sections is not specified, there is nothing more to do.
// This happens when --icf is used but --gc-sections is not.
// Loop over the local symbols.
- typedef typename Sized_relobj<32, big_endian>::Output_sections
+ typedef typename Sized_relobj_file<32, big_endian>::Output_sections
Output_sections;
const Output_sections& out_sections(this->output_sections());
unsigned int shnum = this->shnum();
void
Arm_output_data_got<big_endian>::add_tls_gd32_with_static_reloc(
unsigned int got_type,
- Sized_relobj<32, big_endian>* object,
+ Sized_relobj_file<32, big_endian>* object,
unsigned int index)
{
if (object->local_has_got_offset(index, got_type))
Arm_address value;
if (!reloc.symbol_is_global())
{
- Sized_relobj<32, big_endian>* object = reloc.relobj();
+ Sized_relobj_file<32, big_endian>* object = reloc.relobj();
const Symbol_value<32>* psymval =
reloc.relobj()->local_symbol(reloc.index());
Target_arm<big_endian>::got_mod_index_entry(
Symbol_table* symtab,
Layout* layout,
- Sized_relobj<32, big_endian>* object)
+ Sized_relobj_file<32, big_endian>* object)
{
if (this->got_mod_index_offset_ == -1U)
{
template<bool big_endian>
void
Target_arm<big_endian>::Scan::unsupported_reloc_local(
- Sized_relobj<32, big_endian>* object,
+ Sized_relobj_file<32, big_endian>* object,
unsigned int r_type)
{
gold_error(_("%s: unsupported reloc %u against local symbol"),
Target_arm<big_endian>::Scan::local(Symbol_table* symtab,
Layout* layout,
Target_arm* target,
- Sized_relobj<32, big_endian>* object,
+ Sized_relobj_file<32, big_endian>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rel<32, big_endian>& reloc,
template<bool big_endian>
void
Target_arm<big_endian>::Scan::unsupported_reloc_global(
- Sized_relobj<32, big_endian>* object,
+ Sized_relobj_file<32, big_endian>* object,
unsigned int r_type,
Symbol* gsym)
{
Symbol_table*,
Layout*,
Target_arm<big_endian>* target,
- Sized_relobj<32, big_endian>*,
+ Sized_relobj_file<32, big_endian>*,
unsigned int,
Output_section*,
const elfcpp::Rel<32, big_endian>&,
Symbol_table*,
Layout*,
Target_arm<big_endian>* target,
- Sized_relobj<32, big_endian>*,
+ Sized_relobj_file<32, big_endian>*,
unsigned int,
Output_section*,
const elfcpp::Rel<32, big_endian>&,
Target_arm<big_endian>::Scan::global(Symbol_table* symtab,
Layout* layout,
Target_arm* target,
- Sized_relobj<32, big_endian>* object,
+ Sized_relobj_file<32, big_endian>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rel<32, big_endian>& reloc,
template<bool big_endian>
void
-Target_arm<big_endian>::gc_process_relocs(Symbol_table* symtab,
- Layout* layout,
- Sized_relobj<32, big_endian>* object,
- unsigned int data_shndx,
- unsigned int,
- const unsigned char* prelocs,
- size_t reloc_count,
- Output_section* output_section,
- bool needs_special_offset_handling,
- size_t local_symbol_count,
- const unsigned char* plocal_symbols)
+Target_arm<big_endian>::gc_process_relocs(
+ Symbol_table* symtab,
+ Layout* layout,
+ Sized_relobj_file<32, big_endian>* object,
+ unsigned int data_shndx,
+ unsigned int,
+ const unsigned char* prelocs,
+ size_t reloc_count,
+ Output_section* output_section,
+ bool needs_special_offset_handling,
+ size_t local_symbol_count,
+ const unsigned char* plocal_symbols)
{
typedef Target_arm<big_endian> Arm;
typedef typename Target_arm<big_endian>::Scan Scan;
void
Target_arm<big_endian>::scan_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<32, big_endian>* object,
+ Sized_relobj_file<32, big_endian>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
typedef Relocate_functions<32, big_endian> RelocFuncs;
Output_segment* tls_segment = relinfo->layout->tls_segment();
- const Sized_relobj<32, big_endian>* object = relinfo->object;
+ const Sized_relobj_file<32, big_endian>* object = relinfo->object;
elfcpp::Elf_types<32>::Elf_Addr value = psymval->value(object, 0);
Target_arm<big_endian>::scan_relocatable_relocs(
Symbol_table* symtab,
Layout* layout,
- Sized_relobj<32, big_endian>* object,
+ Sized_relobj_file<32, big_endian>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
}
// do_make_elf_object to override the same function in the base class.
-// We need to use a target-specific sub-class of Sized_relobj<32, big_endian>
-// to store ARM specific information. Hence we need to have our own
-// ELF object creation.
+// We need to use a target-specific sub-class of
+// Sized_relobj_file<32, big_endian> to store ARM specific information.
+// Hence we need to have our own ELF object creation.
template<bool big_endian>
Object*
// symbol.
if (!is_defined_in_discarded_section)
{
- typedef Sized_relobj<32, big_endian> ObjType;
+ typedef Sized_relobj_file<32, big_endian> ObjType;
typename ObjType::Compute_final_local_value_status status =
arm_object->compute_final_local_value(r_sym, psymval, &symval,
relinfo->symtab);
Symbol_table* symtab,
Layout* layout,
Sized_symbol<size>* sym,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int shndx,
Output_section* output_section,
const Reloc& rel,
bool
Copy_relocs<sh_type, size, big_endian>::need_copy_reloc(
Sized_symbol<size>* sym,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int shndx) const
{
if (!parameters->options().copyreloc())
void
Copy_relocs<sh_type, size, big_endian>::save(
Symbol* sym,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int shndx,
Output_section* output_section,
const Reloc& rel)
// section is where the dynamic relocs are put.
void
copy_reloc(Symbol_table*, Layout*, Sized_symbol<size>* sym,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int shndx, Output_section* output_section,
const Reloc& rel,
Output_data_reloc<sh_type, true, size, big_endian>*);
{
public:
Copy_reloc_entry(Symbol* sym, unsigned int reloc_type,
- Sized_relobj<size, big_endian>* relobj,
+ Sized_relobj_file<size, big_endian>* relobj,
unsigned int shndx,
Output_section* output_section,
Address address, Addend addend)
private:
Symbol* sym_;
unsigned int reloc_type_;
- Sized_relobj<size, big_endian>* relobj_;
+ Sized_relobj_file<size, big_endian>* relobj_;
unsigned int shndx_;
Output_section* output_section_;
Address address_;
// Return whether we need a COPY reloc.
bool
need_copy_reloc(Sized_symbol<size>* gsym,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int shndx) const;
// Emit a COPY reloc.
// Save a reloc against SYM for possible emission later.
void
- save(Symbol*, Sized_relobj<size, big_endian>*, unsigned int shndx,
+ save(Symbol*, Sized_relobj_file<size, big_endian>*, unsigned int shndx,
Output_section*, const Reloc& rel);
// The target specific relocation type of the COPY relocation.
class Sized_dynobj : public Dynobj
{
public:
- typedef typename Sized_relobj<size, big_endian>::Symbols Symbols;
+ typedef typename Sized_relobj_file<size, big_endian>::Symbols Symbols;
Sized_dynobj(const std::string& name, Input_file* input_file, off_t offset,
const typename elfcpp::Ehdr<size, big_endian>&);
template<int size, bool big_endian>
bool
Eh_frame::add_ehframe_input_section(
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
const unsigned char* symbols,
section_size_type symbols_size,
const unsigned char* symbol_names,
template<int size, bool big_endian>
bool
Eh_frame::do_add_ehframe_input_section(
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
const unsigned char* symbols,
section_size_type symbols_size,
const unsigned char* symbol_names,
template<int size, bool big_endian>
bool
-Eh_frame::read_cie(Sized_relobj<size, big_endian>* object,
+Eh_frame::read_cie(Sized_relobj_file<size, big_endian>* object,
unsigned int shndx,
const unsigned char* symbols,
section_size_type symbols_size,
template<int size, bool big_endian>
bool
-Eh_frame::read_fde(Sized_relobj<size, big_endian>* object,
+Eh_frame::read_fde(Sized_relobj_file<size, big_endian>* object,
unsigned int shndx,
const unsigned char* symbols,
section_size_type symbols_size,
template
bool
Eh_frame::add_ehframe_input_section<32, false>(
- Sized_relobj<32, false>* object,
+ Sized_relobj_file<32, false>* object,
const unsigned char* symbols,
section_size_type symbols_size,
const unsigned char* symbol_names,
template
bool
Eh_frame::add_ehframe_input_section<32, true>(
- Sized_relobj<32, true>* object,
+ Sized_relobj_file<32, true>* object,
const unsigned char* symbols,
section_size_type symbols_size,
const unsigned char* symbol_names,
template
bool
Eh_frame::add_ehframe_input_section<64, false>(
- Sized_relobj<64, false>* object,
+ Sized_relobj_file<64, false>* object,
const unsigned char* symbols,
section_size_type symbols_size,
const unsigned char* symbol_names,
template
bool
Eh_frame::add_ehframe_input_section<64, true>(
- Sized_relobj<64, true>* object,
+ Sized_relobj_file<64, true>* object,
const unsigned char* symbols,
section_size_type symbols_size,
const unsigned char* symbol_names,
// data.
template<int size, bool big_endian>
bool
- add_ehframe_input_section(Sized_relobj<size, big_endian>* object,
+ add_ehframe_input_section(Sized_relobj_file<size, big_endian>* object,
const unsigned char* symbols,
section_size_type symbols_size,
const unsigned char* symbol_names,
// The implementation of add_ehframe_input_section.
template<int size, bool big_endian>
bool
- do_add_ehframe_input_section(Sized_relobj<size, big_endian>* object,
+ do_add_ehframe_input_section(Sized_relobj_file<size, big_endian>* object,
const unsigned char* symbols,
section_size_type symbols_size,
const unsigned char* symbol_names,
// Read a CIE.
template<int size, bool big_endian>
bool
- read_cie(Sized_relobj<size, big_endian>* object,
+ read_cie(Sized_relobj_file<size, big_endian>* object,
unsigned int shndx,
const unsigned char* symbols,
section_size_type symbols_size,
// Read an FDE.
template<int size, bool big_endian>
bool
- read_fde(Sized_relobj<size, big_endian>* object,
+ read_fde(Sized_relobj_file<size, big_endian>* object,
unsigned int shndx,
const unsigned char* symbols,
section_size_type symbols_size,
class Object;
template<int size, bool big_endian>
-class Sized_relobj;
+class Sized_relobj_file;
template<int sh_type, int size, bool big_endian>
class Reloc_types;
Symbol_table* symtab,
Layout*,
Target_type* target,
- Sized_relobj<size, big_endian>* src_obj,
+ Sized_relobj_file<size, big_endian>* src_obj,
unsigned int src_indx,
const unsigned char* prelocs,
size_t reloc_count,
// Add an entry to the PLT for a local STT_GNU_IFUNC symbol.
unsigned int
- add_local_ifunc_entry(Sized_relobj<32, false>* relobj,
+ add_local_ifunc_entry(Sized_relobj_file<32, false>* relobj,
unsigned int local_sym_index);
// Return the .rel.plt section data.
// offset in the GOT.
struct Local_ifunc
{
- Sized_relobj<32, false>* object;
+ Sized_relobj_file<32, false>* object;
unsigned int local_sym_index;
unsigned int got_offset;
};
void
gc_process_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<32, false>* object,
+ Sized_relobj_file<32, false>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
void
scan_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<32, false>* object,
+ Sized_relobj_file<32, false>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
void
scan_relocatable_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<32, false>* object,
+ Sized_relobj_file<32, false>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
inline void
local(Symbol_table* symtab, Layout* layout, Target_i386* target,
- Sized_relobj<32, false>* object,
+ Sized_relobj_file<32, false>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rel<32, false>& reloc, unsigned int r_type,
inline void
global(Symbol_table* symtab, Layout* layout, Target_i386* target,
- Sized_relobj<32, false>* object,
+ Sized_relobj_file<32, false>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rel<32, false>& reloc, unsigned int r_type,
inline bool
local_reloc_may_be_function_pointer(Symbol_table* symtab, Layout* layout,
Target_i386* target,
- Sized_relobj<32, false>* object,
+ Sized_relobj_file<32, false>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rel<32, false>& reloc,
inline bool
global_reloc_may_be_function_pointer(Symbol_table* symtab, Layout* layout,
Target_i386* target,
- Sized_relobj<32, false>* object,
+ Sized_relobj_file<32, false>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rel<32, false>& reloc,
possible_function_pointer_reloc(unsigned int r_type);
bool
- reloc_needs_plt_for_ifunc(Sized_relobj<32, false>*, unsigned int r_type);
+ reloc_needs_plt_for_ifunc(Sized_relobj_file<32, false>*,
+ unsigned int r_type);
static void
- unsupported_reloc_local(Sized_relobj<32, false>*, unsigned int r_type);
+ unsupported_reloc_local(Sized_relobj_file<32, false>*, unsigned int r_type);
static void
- unsupported_reloc_global(Sized_relobj<32, false>*, unsigned int r_type,
+ unsupported_reloc_global(Sized_relobj_file<32, false>*, unsigned int r_type,
Symbol*);
};
// Create a PLT entry for a local STT_GNU_IFUNC symbol.
void
make_local_ifunc_plt_entry(Symbol_table*, Layout*,
- Sized_relobj<32, false>* relobj,
+ Sized_relobj_file<32, false>* relobj,
unsigned int local_sym_index);
// Define the _TLS_MODULE_BASE_ symbol in the TLS segment.
// Create a GOT entry for the TLS module index.
unsigned int
got_mod_index_entry(Symbol_table* symtab, Layout* layout,
- Sized_relobj<32, false>* object);
+ Sized_relobj_file<32, false>* object);
// Get the PLT section.
Output_data_plt_i386*
// Add a potential copy relocation.
void
copy_reloc(Symbol_table* symtab, Layout* layout,
- Sized_relobj<32, false>* object,
+ Sized_relobj_file<32, false>* object,
unsigned int shndx, Output_section* output_section,
Symbol* sym, const elfcpp::Rel<32, false>& reloc)
{
// the PLT offset.
unsigned int
-Output_data_plt_i386::add_local_ifunc_entry(Sized_relobj<32, false>* relobj,
- unsigned int local_sym_index)
+Output_data_plt_i386::add_local_ifunc_entry(
+ Sized_relobj_file<32, false>* relobj,
+ unsigned int local_sym_index)
{
unsigned int plt_offset = (this->count_ + 1) * plt_entry_size;
++this->count_;
void
Target_i386::make_local_ifunc_plt_entry(Symbol_table* symtab, Layout* layout,
- Sized_relobj<32, false>* relobj,
+ Sized_relobj_file<32, false>* relobj,
unsigned int local_sym_index)
{
if (relobj->local_has_plt_offset(local_sym_index))
unsigned int
Target_i386::got_mod_index_entry(Symbol_table* symtab, Layout* layout,
- Sized_relobj<32, false>* object)
+ Sized_relobj_file<32, false>* object)
{
if (this->got_mod_index_offset_ == -1U)
{
// Report an unsupported relocation against a local symbol.
void
-Target_i386::Scan::unsupported_reloc_local(Sized_relobj<32, false>* object,
+Target_i386::Scan::unsupported_reloc_local(Sized_relobj_file<32, false>* object,
unsigned int r_type)
{
gold_error(_("%s: unsupported reloc %u against local symbol"),
// given type against a STT_GNU_IFUNC symbol.
bool
-Target_i386::Scan::reloc_needs_plt_for_ifunc(Sized_relobj<32, false>* object,
- unsigned int r_type)
+Target_i386::Scan::reloc_needs_plt_for_ifunc(
+ Sized_relobj_file<32, false>* object,
+ unsigned int r_type)
{
int flags = Scan::get_reference_flags(r_type);
if (flags & Symbol::TLS_REF)
Target_i386::Scan::local(Symbol_table* symtab,
Layout* layout,
Target_i386* target,
- Sized_relobj<32, false>* object,
+ Sized_relobj_file<32, false>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rel<32, false>& reloc,
// Report an unsupported relocation against a global symbol.
void
-Target_i386::Scan::unsupported_reloc_global(Sized_relobj<32, false>* object,
- unsigned int r_type,
- Symbol* gsym)
+Target_i386::Scan::unsupported_reloc_global(
+ Sized_relobj_file<32, false>* object,
+ unsigned int r_type,
+ Symbol* gsym)
{
gold_error(_("%s: unsupported reloc %u against global symbol %s"),
object->name().c_str(), r_type, gsym->demangled_name().c_str());
Symbol_table* ,
Layout* ,
Target_i386* ,
- Sized_relobj<32, false>* ,
+ Sized_relobj_file<32, false>* ,
unsigned int ,
Output_section* ,
const elfcpp::Rel<32, false>& ,
Symbol_table* ,
Layout* ,
Target_i386* ,
- Sized_relobj<32, false>* ,
+ Sized_relobj_file<32, false>* ,
unsigned int ,
Output_section* ,
const elfcpp::Rel<32, false>& ,
Target_i386::Scan::global(Symbol_table* symtab,
Layout* layout,
Target_i386* target,
- Sized_relobj<32, false>* object,
+ Sized_relobj_file<32, false>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rel<32, false>& reloc,
void
Target_i386::gc_process_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<32, false>* object,
+ Sized_relobj_file<32, false>* object,
unsigned int data_shndx,
unsigned int,
const unsigned char* prelocs,
void
Target_i386::scan_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<32, false>* object,
+ Sized_relobj_file<32, false>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
}
}
- const Sized_relobj<32, false>* object = relinfo->object;
+ const Sized_relobj_file<32, false>* object = relinfo->object;
// Pick the value to use for symbols defined in shared objects.
Symbol_value<32> symval;
{
Output_segment* tls_segment = relinfo->layout->tls_segment();
- const Sized_relobj<32, false>* object = relinfo->object;
+ const Sized_relobj_file<32, false>* object = relinfo->object;
elfcpp::Elf_types<32>::Elf_Addr value = psymval->value(object, 0);
void
Target_i386::scan_relocatable_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<32, false>* object,
+ Sized_relobj_file<32, false>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
input_file.get_local_symbol_offset());
printf(" Local symbol count: %d\n",
input_file.get_local_symbol_count());
+ printf(" First dynamic reloc: %d\n",
+ input_file.get_first_dyn_reloc());
+ printf(" Dynamic reloc count: %d\n",
+ input_file.get_dyn_reloc_count());
break;
case INCREMENTAL_INPUT_ARCHIVE:
printf("Archive\n");
for (unsigned int i = 0; i < ngot; ++i)
{
unsigned int got_type = igot_plt.get_got_type(i);
- unsigned int got_desc = igot_plt.get_got_desc(i);
+ unsigned int got_symndx = igot_plt.get_got_symndx(i);
+ unsigned int got_input_index = igot_plt.get_got_input_index(i);
printf("[%d] type %02x, ", i, got_type & 0x7f);
if ((got_type & 0x7f) == 0x7f)
printf("reserved");
else if (got_type & 0x80)
{
- Entry_reader input_file = incremental_inputs.input_file(got_desc);
+ Entry_reader input_file =
+ incremental_inputs.input_file(got_input_index);
const char* objname = input_file.filename();
- printf("local: %s (%d)", objname, got_desc);
+ printf("local: %s (%d)", objname, got_symndx);
}
else
{
- sym_p = symtab_view.data() + got_desc * sym_size;
+ sym_p = symtab_view.data() + got_symndx * sym_size;
elfcpp::Sym<size, big_endian> sym(sym_p);
const char* symname;
if (!strtab.get_c_string(sym.get_st_name(), &symname))
symname = "<unknown>";
- printf("global %s (%d)", symname, got_desc);
+ printf("global %s (%d)", symname, got_symndx);
}
printf("\n");
}
// libraries and scripts.
Incremental_inputs_reader<size, big_endian>& inputs = this->inputs_reader_;
unsigned int count = inputs.input_file_count();
+ this->input_objects_.resize(count);
this->input_entry_readers_.reserve(count);
this->library_map_.resize(count);
this->script_map_.resize(count);
unsigned int nglobals = this->symtab_reader_.symbol_count();
this->symbol_map_.resize(nglobals);
- // Initialize the status of each input file.
- this->file_status_ = new unsigned char[(count + 7) / 8];
- memset(this->file_status_, 0, (count + 7) / 8);
-
this->has_incremental_info_ = true;
}
Input_entry_reader input_file =
this->inputs_reader_.input_file(input_file_index);
- this->set_file_is_unchanged(input_file_index);
-
if (input_file.type() == INCREMENTAL_INPUT_SHARED_LIBRARY)
return;
got->reserve_slot(i);
continue;
}
- unsigned int got_desc = got_plt_reader.get_got_desc(i);
+ unsigned int symndx = got_plt_reader.get_got_symndx(i);
if (got_type & 0x80)
{
- // This is an entry for a local symbol. GOT_DESC is the index
- // of the object file entry in the list of input files. Ignore
- // this entry if the object file was replaced.
+ // This is an entry for a local symbol. Ignore this entry if
+ // the object file was replaced.
+ unsigned int input_index = got_plt_reader.get_got_input_index(i);
gold_debug(DEBUG_INCREMENTAL,
"GOT entry %d, type %02x: (local symbol)",
i, got_type & 0x7f);
- if (this->file_is_unchanged(got_desc))
- got->reserve_slot(i);
+ Sized_relobj_incr<size, big_endian>* obj =
+ this->input_object(input_index);
+ if (obj != NULL)
+ target->reserve_local_got_entry(i, obj, symndx, got_type & 0x7f);
}
else
{
// This is an entry for a global symbol. GOT_DESC is the symbol
// table index.
// FIXME: This should really be a fatal error (corrupt input).
- gold_assert(got_desc >= first_global && got_desc < symtab_count);
- Symbol* sym = this->global_symbol(got_desc - first_global);
+ gold_assert(symndx >= first_global && symndx < symtab_count);
+ Symbol* sym = this->global_symbol(symndx - first_global);
gold_debug(DEBUG_INCREMENTAL,
"GOT entry %d, type %02x: %s",
i, got_type, sym->name());
- got->reserve_slot_for_global(i, sym, got_type);
+ target->reserve_global_got_entry(i, sym, got_type);
}
}
gold_assert(entry != NULL);
(*p)->set_info_offset(info_offset);
// Input section count, global symbol count, local symbol offset,
- // local symbol count.
- info_offset += 16;
+ // local symbol count, first dynamic reloc, dynamic reloc count.
+ info_offset += 24;
// Each input section.
info_offset += (entry->get_input_section_count()
* (8 + 2 * sizeof_addr));
unsigned int plt_count = target->plt_entry_count();
unsigned int got_plt_size = 8; // GOT entry count, PLT entry count.
got_plt_size = (got_plt_size + got_count + 3) & ~3; // GOT type array.
- got_plt_size += got_count * 4 + plt_count * 4; // GOT array, PLT array.
+ got_plt_size += got_count * 8 + plt_count * 4; // GOT array, PLT array.
inputs->got_plt_section()->set_current_data_size(got_plt_size);
}
unsigned int nsyms = syms->size();
off_t locals_offset = relobj->local_symbol_offset();
unsigned int nlocals = relobj->output_local_symbol_count();
+ unsigned int first_dynrel = relobj->first_dyn_reloc();
+ unsigned int ndynrel = relobj->dyn_reloc_count();
Swap32::writeval(pov, nsections);
Swap32::writeval(pov + 4, nsyms);
Swap32::writeval(pov + 8, static_cast<unsigned int>(locals_offset));
Swap32::writeval(pov + 12, nlocals);
- pov += 16;
+ Swap32::writeval(pov + 16, first_dynrel);
+ Swap32::writeval(pov + 20, ndynrel);
+ pov += 24;
// Build a temporary array to map input section indexes
// from the original object file index to the index in the
unsigned int first_plt_entry_offset;
// Size of a PLT entry (this is a target-dependent value).
unsigned int plt_entry_size;
- // Value to write in the GOT descriptor array. For global symbols,
- // this is the global symbol table index; for local symbols, it is
- // the offset of the input file entry in the .gnu_incremental_inputs
- // section.
- unsigned int got_descriptor;
+ // Symbol index to write in the GOT descriptor array. For global symbols,
+ // this is the global symbol table index; for local symbols, it is the
+ // local symbol table index.
+ unsigned int sym_index;
+ // Input file index to write in the GOT descriptor array. For global
+ // symbols, this is 0; for local symbols, it is the index of the input
+ // file entry in the .gnu_incremental_inputs section.
+ unsigned int input_index;
};
// Functor class for processing a GOT offset list for local symbols.
// high bit to flag a local symbol.
gold_assert(got_type < 0x7f);
this->info_.got_type_p[got_index] = got_type | 0x80;
- unsigned char* pov = this->info_.got_desc_p + got_index * 4;
- elfcpp::Swap<32, big_endian>::writeval(pov, this->info_.got_descriptor);
+ unsigned char* pov = this->info_.got_desc_p + got_index * 8;
+ elfcpp::Swap<32, big_endian>::writeval(pov, this->info_.sym_index);
+ elfcpp::Swap<32, big_endian>::writeval(pov + 4, this->info_.input_index);
}
private:
// high bit to flag a local symbol.
gold_assert(got_type < 0x7f);
this->info_.got_type_p[got_index] = got_type;
- unsigned char* pov = this->info_.got_desc_p + got_index * 4;
- elfcpp::Swap<32, big_endian>::writeval(pov, this->info_.got_descriptor);
+ unsigned char* pov = this->info_.got_desc_p + got_index * 8;
+ elfcpp::Swap<32, big_endian>::writeval(pov, this->info_.sym_index);
+ elfcpp::Swap<32, big_endian>::writeval(pov + 4, 0);
}
private:
const Got_offset_list* got_offsets = sym->got_offset_list();
if (got_offsets != NULL)
{
- this->info_.got_descriptor = sym->symtab_index();
+ this->info_.sym_index = sym->symtab_index();
+ this->info_.input_index = 0;
Got_visitor v(this->info_);
got_offsets->for_all_got_offsets(&v);
}
view_info.got_type_p = pov + 8;
view_info.got_desc_p = (view_info.got_type_p
+ ((view_info.got_count + 3) & ~3));
- view_info.plt_desc_p = view_info.got_desc_p + view_info.got_count * 4;
+ view_info.plt_desc_p = view_info.got_desc_p + view_info.got_count * 8;
gold_assert(pov + view_size ==
view_info.plt_desc_p + view_info.plt_count * 4);
gold_assert(entry != NULL);
const Object* obj = entry->object();
gold_assert(obj != NULL);
- view_info.got_descriptor = (*p)->get_file_index();
+ view_info.input_index = (*p)->get_file_index();
Got_visitor v(view_info);
obj->for_all_local_got_entries(&v);
}
symtab_->for_all_symbols<size, Symbol_visitor>(Symbol_visitor(view_info));
}
-// Class Sized_incr_relobj. Most of these methods are not used for
+// Class Sized_relobj_incr. Most of these methods are not used for
// Incremental objects, but are required to be implemented by the
// base class Object.
template<int size, bool big_endian>
-Sized_incr_relobj<size, big_endian>::Sized_incr_relobj(
+Sized_relobj_incr<size, big_endian>::Sized_relobj_incr(
const std::string& name,
Sized_incremental_binary<size, big_endian>* ibase,
unsigned int input_file_index)
- : Sized_relobj_base<size, big_endian>(name, NULL), ibase_(ibase),
+ : Sized_relobj<size, big_endian>(name, NULL), ibase_(ibase),
input_file_index_(input_file_index),
input_reader_(ibase->inputs_reader().input_file(input_file_index)),
local_symbol_count_(0), output_local_dynsym_count_(0),
local_symbol_index_(0), local_symbol_offset_(0), local_dynsym_offset_(0),
- symbols_(), section_offsets_(), incr_reloc_offset_(-1U),
- incr_reloc_count_(0), incr_reloc_output_index_(0), incr_relocs_(NULL),
- local_symbols_()
+ symbols_(), incr_reloc_offset_(-1U), incr_reloc_count_(0),
+ incr_reloc_output_index_(0), incr_relocs_(NULL), local_symbols_()
{
if (this->input_reader_.is_in_system_directory())
this->set_is_in_system_directory();
const unsigned int shnum = this->input_reader_.get_input_section_count() + 1;
this->set_shnum(shnum);
+ ibase->set_input_object(input_file_index, this);
}
// Read the symbols.
template<int size, bool big_endian>
void
-Sized_incr_relobj<size, big_endian>::do_read_symbols(Read_symbols_data*)
+Sized_relobj_incr<size, big_endian>::do_read_symbols(Read_symbols_data*)
{
gold_unreachable();
}
template<int size, bool big_endian>
void
-Sized_incr_relobj<size, big_endian>::do_layout(
+Sized_relobj_incr<size, big_endian>::do_layout(
Symbol_table*,
Layout* layout,
Read_symbols_data*)
gold_assert(incremental_inputs != NULL);
Output_sections& out_sections(this->output_sections());
out_sections.resize(shnum);
- this->section_offsets_.resize(shnum);
+ this->section_offsets().resize(shnum);
for (unsigned int i = 1; i < shnum; i++)
{
typename Input_entry_reader::Input_section_info sect =
Output_section* os = this->ibase_->output_section(sect.output_shndx);
gold_assert(os != NULL);
out_sections[i] = os;
- this->section_offsets_[i] = static_cast<Address>(sect.sh_offset);
+ this->section_offsets()[i] = static_cast<Address>(sect.sh_offset);
}
}
// input files from a plugin.
template<int size, bool big_endian>
void
-Sized_incr_relobj<size, big_endian>::do_layout_deferred_sections(Layout*)
+Sized_relobj_incr<size, big_endian>::do_layout_deferred_sections(Layout*)
{
}
template<int size, bool big_endian>
void
-Sized_incr_relobj<size, big_endian>::do_add_symbols(
+Sized_relobj_incr<size, big_endian>::do_add_symbols(
Symbol_table* symtab,
Read_symbols_data*,
Layout*)
template<int size, bool big_endian>
Archive::Should_include
-Sized_incr_relobj<size, big_endian>::do_should_include_member(
+Sized_relobj_incr<size, big_endian>::do_should_include_member(
Symbol_table*,
Layout*,
Read_symbols_data*,
template<int size, bool big_endian>
void
-Sized_incr_relobj<size, big_endian>::do_for_all_global_symbols(
+Sized_relobj_incr<size, big_endian>::do_for_all_global_symbols(
Read_symbols_data*,
Library_base::Symbol_visitor_base*)
{
// This routine is not used for incremental objects.
}
-// Iterate over local symbols, calling a visitor class V for each GOT offset
-// associated with a local symbol.
-
-template<int size, bool big_endian>
-void
-Sized_incr_relobj<size, big_endian>::do_for_all_local_got_entries(
- Got_offset_list::Visitor*) const
-{
- // FIXME: Implement Sized_incr_relobj::do_for_all_local_got_entries.
-}
-
// Get the size of a section.
template<int size, bool big_endian>
uint64_t
-Sized_incr_relobj<size, big_endian>::do_section_size(unsigned int)
+Sized_relobj_incr<size, big_endian>::do_section_size(unsigned int)
{
gold_unreachable();
}
template<int size, bool big_endian>
std::string
-Sized_incr_relobj<size, big_endian>::do_section_name(unsigned int)
+Sized_relobj_incr<size, big_endian>::do_section_name(unsigned int)
{
gold_unreachable();
}
template<int size, bool big_endian>
Object::Location
-Sized_incr_relobj<size, big_endian>::do_section_contents(unsigned int)
+Sized_relobj_incr<size, big_endian>::do_section_contents(unsigned int)
{
gold_unreachable();
}
template<int size, bool big_endian>
uint64_t
-Sized_incr_relobj<size, big_endian>::do_section_flags(unsigned int)
+Sized_relobj_incr<size, big_endian>::do_section_flags(unsigned int)
{
gold_unreachable();
}
template<int size, bool big_endian>
uint64_t
-Sized_incr_relobj<size, big_endian>::do_section_entsize(unsigned int)
+Sized_relobj_incr<size, big_endian>::do_section_entsize(unsigned int)
{
gold_unreachable();
}
template<int size, bool big_endian>
uint64_t
-Sized_incr_relobj<size, big_endian>::do_section_address(unsigned int)
+Sized_relobj_incr<size, big_endian>::do_section_address(unsigned int)
{
gold_unreachable();
}
template<int size, bool big_endian>
unsigned int
-Sized_incr_relobj<size, big_endian>::do_section_type(unsigned int)
+Sized_relobj_incr<size, big_endian>::do_section_type(unsigned int)
{
gold_unreachable();
}
template<int size, bool big_endian>
unsigned int
-Sized_incr_relobj<size, big_endian>::do_section_link(unsigned int)
+Sized_relobj_incr<size, big_endian>::do_section_link(unsigned int)
{
gold_unreachable();
}
template<int size, bool big_endian>
unsigned int
-Sized_incr_relobj<size, big_endian>::do_section_info(unsigned int)
+Sized_relobj_incr<size, big_endian>::do_section_info(unsigned int)
{
gold_unreachable();
}
template<int size, bool big_endian>
uint64_t
-Sized_incr_relobj<size, big_endian>::do_section_addralign(unsigned int)
+Sized_relobj_incr<size, big_endian>::do_section_addralign(unsigned int)
{
gold_unreachable();
}
template<int size, bool big_endian>
Xindex*
-Sized_incr_relobj<size, big_endian>::do_initialize_xindex()
+Sized_relobj_incr<size, big_endian>::do_initialize_xindex()
{
gold_unreachable();
}
template<int size, bool big_endian>
void
-Sized_incr_relobj<size, big_endian>::do_get_global_symbol_counts(
+Sized_relobj_incr<size, big_endian>::do_get_global_symbol_counts(
const Symbol_table*, size_t*, size_t*) const
{
gold_unreachable();
template<int size, bool big_endian>
void
-Sized_incr_relobj<size, big_endian>::do_read_relocs(Read_relocs_data*)
+Sized_relobj_incr<size, big_endian>::do_read_relocs(Read_relocs_data*)
{
}
template<int size, bool big_endian>
void
-Sized_incr_relobj<size, big_endian>::do_gc_process_relocs(Symbol_table*,
+Sized_relobj_incr<size, big_endian>::do_gc_process_relocs(Symbol_table*,
Layout*,
Read_relocs_data*)
{
template<int size, bool big_endian>
void
-Sized_incr_relobj<size, big_endian>::do_scan_relocs(Symbol_table*,
+Sized_relobj_incr<size, big_endian>::do_scan_relocs(Symbol_table*,
Layout* layout,
Read_relocs_data*)
{
template<int size, bool big_endian>
void
-Sized_incr_relobj<size, big_endian>::do_count_local_symbols(
+Sized_relobj_incr<size, big_endian>::do_count_local_symbols(
Stringpool_template<char>* pool,
Stringpool_template<char>*)
{
template<int size, bool big_endian>
unsigned int
-Sized_incr_relobj<size, big_endian>::do_finalize_local_symbols(
+Sized_relobj_incr<size, big_endian>::do_finalize_local_symbols(
unsigned int index,
off_t off,
Symbol_table*)
template<int size, bool big_endian>
unsigned int
-Sized_incr_relobj<size, big_endian>::do_set_local_dynsym_indexes(
+Sized_relobj_incr<size, big_endian>::do_set_local_dynsym_indexes(
unsigned int index)
{
// FIXME: set local dynsym indexes.
template<int size, bool big_endian>
unsigned int
-Sized_incr_relobj<size, big_endian>::do_set_local_dynsym_offset(off_t)
+Sized_relobj_incr<size, big_endian>::do_set_local_dynsym_offset(off_t)
{
return 0;
}
template<int size, bool big_endian>
void
-Sized_incr_relobj<size, big_endian>::do_relocate(const Symbol_table*,
+Sized_relobj_incr<size, big_endian>::do_relocate(const Symbol_table*,
const Layout* layout,
Output_file* of)
{
template<int size, bool big_endian>
void
-Sized_incr_relobj<size, big_endian>::do_set_section_offset(unsigned int,
+Sized_relobj_incr<size, big_endian>::do_set_section_offset(unsigned int,
uint64_t)
{
}
obj = new Sized_incr_dynobj<32, false>(name, sized_ibase,
input_file_index);
else
- obj = new Sized_incr_relobj<32, false>(name, sized_ibase,
+ obj = new Sized_relobj_incr<32, false>(name, sized_ibase,
input_file_index);
}
break;
obj = new Sized_incr_dynobj<32, true>(name, sized_ibase,
input_file_index);
else
- obj = new Sized_incr_relobj<32, true>(name, sized_ibase,
+ obj = new Sized_relobj_incr<32, true>(name, sized_ibase,
input_file_index);
}
break;
obj = new Sized_incr_dynobj<64, false>(name, sized_ibase,
input_file_index);
else
- obj = new Sized_incr_relobj<64, false>(name, sized_ibase,
+ obj = new Sized_relobj_incr<64, false>(name, sized_ibase,
input_file_index);
}
break;
obj = new Sized_incr_dynobj<64, true>(name, sized_ibase,
input_file_index);
else
- obj = new Sized_incr_relobj<64, true>(name, sized_ibase,
+ obj = new Sized_relobj_incr<64, true>(name, sized_ibase,
input_file_index);
}
break;
class Sized_incremental_binary<32, false>;
template
-class Sized_incr_relobj<32, false>;
+class Sized_relobj_incr<32, false>;
template
class Sized_incr_dynobj<32, false>;
class Sized_incremental_binary<32, true>;
template
-class Sized_incr_relobj<32, true>;
+class Sized_relobj_incr<32, true>;
template
class Sized_incr_dynobj<32, true>;
class Sized_incremental_binary<64, false>;
template
-class Sized_incr_relobj<64, false>;
+class Sized_relobj_incr<64, false>;
template
class Sized_incr_dynobj<64, false>;
class Sized_incremental_binary<64, true>;
template
-class Sized_incr_relobj<64, true>;
+class Sized_relobj_incr<64, true>;
template
class Sized_incr_dynobj<64, true>;
|| this->type() == INCREMENTAL_INPUT_ARCHIVE_MEMBER);
unsigned int section_count = this->get_input_section_count();
- return (this->info_offset_ + 16
+ return (this->info_offset_ + 24
+ section_count * input_section_entry_size
+ symndx * 20);
}
return Swap32::readval(this->inputs_->p_ + this->info_offset_ + 12);
}
+ // Return the index of the first dynamic relocation -- for objects only.
+ unsigned int
+ get_first_dyn_reloc() const
+ {
+ gold_assert(this->type() == INCREMENTAL_INPUT_OBJECT
+ || this->type() == INCREMENTAL_INPUT_ARCHIVE_MEMBER);
+
+ return Swap32::readval(this->inputs_->p_ + this->info_offset_ + 16);
+ }
+
+ // Return the dynamic relocation count -- for objects only.
+ unsigned int
+ get_dyn_reloc_count() const
+ {
+ gold_assert(this->type() == INCREMENTAL_INPUT_OBJECT
+ || this->type() == INCREMENTAL_INPUT_ARCHIVE_MEMBER);
+
+ return Swap32::readval(this->inputs_->p_ + this->info_offset_ + 20);
+ }
+
// Return the object count -- for scripts only.
unsigned int
get_object_count() const
{
Input_section_info info;
const unsigned char* p = (this->inputs_->p_
- + this->info_offset_ + 16
+ + this->info_offset_ + 24
+ n * input_section_entry_size);
unsigned int name_offset = Swap32::readval(p);
info.name = this->inputs_->get_string(name_offset);
|| this->type() == INCREMENTAL_INPUT_ARCHIVE_MEMBER);
unsigned int section_count = this->get_input_section_count();
const unsigned char* p = (this->inputs_->p_
- + this->info_offset_ + 16
+ + this->info_offset_ + 24
+ section_count * input_section_entry_size
+ n * 20);
return Incremental_global_symbol_reader<big_endian>(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;
+ this->plt_desc_p_ = this->got_desc_p_ + this->got_count_ * 8;
}
// Return the GOT entry count.
return this->p_[8 + n];
}
- // Return the GOT descriptor for GOT entry N.
+ // Return the symbol index for GOT entry N.
+ unsigned int
+ get_got_symndx(unsigned int n)
+ {
+ return elfcpp::Swap<32, big_endian>::readval(this->got_desc_p_ + n * 8);
+ }
+
+ // Return the input file index for GOT entry N.
unsigned int
- get_got_desc(unsigned int n)
+ get_got_input_index(unsigned int n)
{
- return elfcpp::Swap<32, big_endian>::readval(this->got_desc_p_ + n * 4);
+ return elfcpp::Swap<32, big_endian>::readval(this->got_desc_p_ + n * 8 + 4);
}
// Return the PLT descriptor for PLT entry N.
Target* target_;
};
+template<int size, bool big_endian>
+class Sized_relobj_incr;
+
template<int size, bool big_endian>
class Sized_incremental_binary : public Incremental_binary
{
const elfcpp::Ehdr<size, big_endian>& ehdr,
Target* target)
: Incremental_binary(output, target), elf_file_(this, ehdr),
- file_status_(NULL), section_map_(), symbol_map_(), main_symtab_loc_(),
+ input_objects_(), section_map_(), symbol_map_(), main_symtab_loc_(),
main_strtab_loc_(), has_incremental_info_(false), inputs_reader_(),
symtab_reader_(), relocs_reader_(), got_plt_reader_(),
input_entry_readers_()
{ this->setup_readers(); }
- virtual
- ~Sized_incremental_binary()
- {
- if (this->file_status_ != NULL)
- delete[] this->file_status_;
- }
-
// Returns TRUE if the file contains incremental info.
bool
has_incremental_info() const
{ return this->has_incremental_info_; }
- // Set the flag for input file N to indicate that the file is unchanged.
+ // Record a pointer to the object for input file N.
void
- set_file_is_unchanged(unsigned int n)
- {
- gold_assert(this->file_status_ != NULL);
- this->file_status_[n / 8] |= 1U << (n % 8);
- }
+ set_input_object(unsigned int n,
+ Sized_relobj_incr<size, big_endian>* obj)
+ { this->input_objects_[n] = obj; }
- // Returns TRUE if input file N is unchanged.
- bool
- file_is_unchanged(unsigned int n) const
+ // Return a pointer to the object for input file N.
+ Sized_relobj_incr<size, big_endian>*
+ input_object(unsigned int n) const
{
- gold_assert(this->file_status_ != NULL);
- return (this->file_status_[n / 8] & (1U << (n % 8))) != 0;
+ gold_assert(n < this->input_objects_.size());
+ return this->input_objects_[n];
}
// Return the Output_section for section index SHNDX.
// Output as an ELF file.
elfcpp::Elf_file<size, big_endian, Incremental_binary> elf_file_;
- // Status flags for each input file. Each bit represents one input file;
- // 0 indicates that the file was replaced; 1 indicates that the file was
- // unchanged.
- unsigned char* file_status_;
+ // Vector of pointers to the input objects for the unchanged files.
+ // For replaced files, the corresponding pointer is NULL.
+ std::vector<Sized_relobj_incr<size, big_endian>*> input_objects_;
// Map section index to an Output_section in the updated layout.
std::vector<Output_section*> section_map_;
// can be used directly from the base file.
template<int size, bool big_endian>
-class Sized_incr_relobj : public Sized_relobj_base<size, big_endian>
+class Sized_relobj_incr : public Sized_relobj<size, big_endian>
{
public:
typedef typename elfcpp::Elf_types<size>::Elf_Addr Address;
- typedef typename Sized_relobj_base<size, big_endian>::Symbols Symbols;
+ typedef typename Sized_relobj<size, big_endian>::Symbols Symbols;
- static const Address invalid_address = static_cast<Address>(0) - 1;
-
- Sized_incr_relobj(const std::string& name,
+ Sized_relobj_incr(const std::string& name,
Sized_incremental_binary<size, big_endian>* ibase,
unsigned int input_file_index);
- // Checks if the offset of input section SHNDX within its output
- // section is invalid.
- bool
- is_output_section_offset_invalid(unsigned int shndx) const
- { return this->section_offsets_[shndx] == invalid_address; }
-
- // Get the offset of input section SHNDX within its output section.
- // This is -1 if the input section requires a special mapping, such
- // as a merge section. The output section can be found in the
- // output_sections_ field of the parent class Incrobj.
- uint64_t
- do_output_section_offset(unsigned int shndx) const
- {
- gold_assert(shndx < this->section_offsets_.size());
- Address off = this->section_offsets_[shndx];
- if (off == invalid_address)
- return -1ULL;
- return off;
- }
-
private:
// For convenience.
- typedef Sized_incr_relobj<size, big_endian> This;
+ typedef Sized_relobj_incr<size, big_endian> This;
static const int sym_size = elfcpp::Elf_sizes<size>::sym_size;
- typedef typename Sized_relobj_base<size, big_endian>::Output_sections
+ typedef typename Sized_relobj<size, big_endian>::Output_sections
Output_sections;
typedef Incremental_inputs_reader<size, big_endian> Inputs_reader;
typedef typename Inputs_reader::Incremental_input_entry_reader
do_for_all_global_symbols(Read_symbols_data* sd,
Library_base::Symbol_visitor_base* v);
- // Iterate over local symbols, calling a visitor class V for each GOT offset
- // associated with a local symbol.
- void
- do_for_all_local_got_entries(Got_offset_list::Visitor* v) const;
-
// Get the size of a section.
uint64_t
do_section_size(unsigned int shndx);
unsigned int local_dynsym_offset_;
// The entries in the symbol table for the external symbols.
Symbols symbols_;
- // For each input section, the offset of the input section in its
- // output section. This is INVALID_ADDRESS if the input section requires a
- // special mapping.
- std::vector<Address> section_offsets_;
// The offset of the first incremental relocation for this object.
unsigned int incr_reloc_offset_;
// The number of incremental relocations for this object.
template<int size, bool big_endian>
bool
-Layout::include_section(Sized_relobj<size, big_endian>*, const char* name,
+Layout::include_section(Sized_relobj_file<size, big_endian>*, const char* name,
const elfcpp::Shdr<size, big_endian>& shdr)
{
if (shdr.get_sh_flags() & elfcpp::SHF_EXCLUDE)
template<int size, bool big_endian>
Output_section*
-Layout::layout(Sized_relobj<size, big_endian>* object, unsigned int shndx,
+Layout::layout(Sized_relobj_file<size, big_endian>* object, unsigned int shndx,
const char* name, const elfcpp::Shdr<size, big_endian>& shdr,
unsigned int reloc_shndx, unsigned int, off_t* off)
{
template<int size, bool big_endian>
Output_section*
-Layout::layout_reloc(Sized_relobj<size, big_endian>* object,
+Layout::layout_reloc(Sized_relobj_file<size, big_endian>* object,
unsigned int,
const elfcpp::Shdr<size, big_endian>& shdr,
Output_section* data_section,
template<int size, bool big_endian>
void
Layout::layout_group(Symbol_table* symtab,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int,
const char* group_section_name,
const char* signature,
template<int size, bool big_endian>
Output_section*
-Layout::layout_eh_frame(Sized_relobj<size, big_endian>* object,
+Layout::layout_eh_frame(Sized_relobj_file<size, big_endian>* object,
const unsigned char* symbols,
off_t symbols_size,
const unsigned char* symbol_names,
#ifdef HAVE_TARGET_32_LITTLE
template
Output_section*
-Layout::layout<32, false>(Sized_relobj<32, false>* object, unsigned int shndx,
+Layout::layout<32, false>(Sized_relobj_file<32, false>* object,
+ unsigned int shndx,
const char* name,
const elfcpp::Shdr<32, false>& shdr,
unsigned int, unsigned int, off_t*);
#ifdef HAVE_TARGET_32_BIG
template
Output_section*
-Layout::layout<32, true>(Sized_relobj<32, true>* object, unsigned int shndx,
+Layout::layout<32, true>(Sized_relobj_file<32, true>* object,
+ unsigned int shndx,
const char* name,
const elfcpp::Shdr<32, true>& shdr,
unsigned int, unsigned int, off_t*);
#ifdef HAVE_TARGET_64_LITTLE
template
Output_section*
-Layout::layout<64, false>(Sized_relobj<64, false>* object, unsigned int shndx,
+Layout::layout<64, false>(Sized_relobj_file<64, false>* object,
+ unsigned int shndx,
const char* name,
const elfcpp::Shdr<64, false>& shdr,
unsigned int, unsigned int, off_t*);
#ifdef HAVE_TARGET_64_BIG
template
Output_section*
-Layout::layout<64, true>(Sized_relobj<64, true>* object, unsigned int shndx,
+Layout::layout<64, true>(Sized_relobj_file<64, true>* object,
+ unsigned int shndx,
const char* name,
const elfcpp::Shdr<64, true>& shdr,
unsigned int, unsigned int, off_t*);
#ifdef HAVE_TARGET_32_LITTLE
template
Output_section*
-Layout::layout_reloc<32, false>(Sized_relobj<32, false>* object,
+Layout::layout_reloc<32, false>(Sized_relobj_file<32, false>* object,
unsigned int reloc_shndx,
const elfcpp::Shdr<32, false>& shdr,
Output_section* data_section,
#ifdef HAVE_TARGET_32_BIG
template
Output_section*
-Layout::layout_reloc<32, true>(Sized_relobj<32, true>* object,
+Layout::layout_reloc<32, true>(Sized_relobj_file<32, true>* object,
unsigned int reloc_shndx,
const elfcpp::Shdr<32, true>& shdr,
Output_section* data_section,
#ifdef HAVE_TARGET_64_LITTLE
template
Output_section*
-Layout::layout_reloc<64, false>(Sized_relobj<64, false>* object,
+Layout::layout_reloc<64, false>(Sized_relobj_file<64, false>* object,
unsigned int reloc_shndx,
const elfcpp::Shdr<64, false>& shdr,
Output_section* data_section,
#ifdef HAVE_TARGET_64_BIG
template
Output_section*
-Layout::layout_reloc<64, true>(Sized_relobj<64, true>* object,
+Layout::layout_reloc<64, true>(Sized_relobj_file<64, true>* object,
unsigned int reloc_shndx,
const elfcpp::Shdr<64, true>& shdr,
Output_section* data_section,
template
void
Layout::layout_group<32, false>(Symbol_table* symtab,
- Sized_relobj<32, false>* object,
+ Sized_relobj_file<32, false>* object,
unsigned int,
const char* group_section_name,
const char* signature,
template
void
Layout::layout_group<32, true>(Symbol_table* symtab,
- Sized_relobj<32, true>* object,
+ Sized_relobj_file<32, true>* object,
unsigned int,
const char* group_section_name,
const char* signature,
template
void
Layout::layout_group<64, false>(Symbol_table* symtab,
- Sized_relobj<64, false>* object,
+ Sized_relobj_file<64, false>* object,
unsigned int,
const char* group_section_name,
const char* signature,
template
void
Layout::layout_group<64, true>(Symbol_table* symtab,
- Sized_relobj<64, true>* object,
+ Sized_relobj_file<64, true>* object,
unsigned int,
const char* group_section_name,
const char* signature,
#ifdef HAVE_TARGET_32_LITTLE
template
Output_section*
-Layout::layout_eh_frame<32, false>(Sized_relobj<32, false>* object,
+Layout::layout_eh_frame<32, false>(Sized_relobj_file<32, false>* object,
const unsigned char* symbols,
off_t symbols_size,
const unsigned char* symbol_names,
#ifdef HAVE_TARGET_32_BIG
template
Output_section*
-Layout::layout_eh_frame<32, true>(Sized_relobj<32, true>* object,
- const unsigned char* symbols,
- off_t symbols_size,
+Layout::layout_eh_frame<32, true>(Sized_relobj_file<32, true>* object,
+ const unsigned char* symbols,
+ off_t symbols_size,
const unsigned char* symbol_names,
off_t symbol_names_size,
unsigned int shndx,
#ifdef HAVE_TARGET_64_LITTLE
template
Output_section*
-Layout::layout_eh_frame<64, false>(Sized_relobj<64, false>* object,
+Layout::layout_eh_frame<64, false>(Sized_relobj_file<64, false>* object,
const unsigned char* symbols,
off_t symbols_size,
const unsigned char* symbol_names,
#ifdef HAVE_TARGET_64_BIG
template
Output_section*
-Layout::layout_eh_frame<64, true>(Sized_relobj<64, true>* object,
- const unsigned char* symbols,
- off_t symbols_size,
+Layout::layout_eh_frame<64, true>(Sized_relobj_file<64, true>* object,
+ const unsigned char* symbols,
+ off_t symbols_size,
const unsigned char* symbol_names,
off_t symbol_names_size,
unsigned int shndx,
// within the output section.
template<int size, bool big_endian>
Output_section*
- layout(Sized_relobj<size, big_endian> *object, unsigned int shndx,
+ layout(Sized_relobj_file<size, big_endian> *object, unsigned int shndx,
const char* name, const elfcpp::Shdr<size, big_endian>& shdr,
unsigned int reloc_shndx, unsigned int reloc_type, off_t* offset);
// relocatable information.
template<int size, bool big_endian>
Output_section*
- layout_reloc(Sized_relobj<size, big_endian>* object,
+ layout_reloc(Sized_relobj_file<size, big_endian>* object,
unsigned int reloc_shndx,
const elfcpp::Shdr<size, big_endian>& shdr,
Output_section* data_section,
template<int size, bool big_endian>
void
layout_group(Symbol_table* symtab,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int group_shndx,
const char* group_section_name,
const char* signature,
// returns the output section, and sets *OFFSET to the offset.
template<int size, bool big_endian>
Output_section*
- layout_eh_frame(Sized_relobj<size, big_endian>* object,
+ layout_eh_frame(Sized_relobj_file<size, big_endian>* object,
const unsigned char* symbols,
off_t symbols_size,
const unsigned char* symbol_names,
// Return whether to include this section in the link.
template<int size, bool big_endian>
bool
- include_section(Sized_relobj<size, big_endian>* object, const char* name,
+ include_section(Sized_relobj_file<size, big_endian>* object, const char* name,
const elfcpp::Shdr<size, big_endian>&);
// Return the output section name to use given an input section
template<int size, bool big_endian>
void
Mapfile::print_input_section_symbols(
- const Sized_relobj<size, big_endian>* relobj,
+ const Sized_relobj_file<size, big_endian>* relobj,
unsigned int shndx)
{
unsigned int symcount = relobj->symbol_count();
#ifdef HAVE_TARGET_32_LITTLE
case Parameters::TARGET_32_LITTLE:
{
- const Sized_relobj<32, false>* sized_relobj =
- static_cast<Sized_relobj<32, false>*>(relobj);
+ const Sized_relobj_file<32, false>* sized_relobj =
+ static_cast<Sized_relobj_file<32, false>*>(relobj);
this->print_input_section_symbols(sized_relobj, shndx);
}
break;
#ifdef HAVE_TARGET_32_BIG
case Parameters::TARGET_32_BIG:
{
- const Sized_relobj<32, true>* sized_relobj =
- static_cast<Sized_relobj<32, true>*>(relobj);
+ const Sized_relobj_file<32, true>* sized_relobj =
+ static_cast<Sized_relobj_file<32, true>*>(relobj);
this->print_input_section_symbols(sized_relobj, shndx);
}
break;
#ifdef HAVE_TARGET_64_LITTLE
case Parameters::TARGET_64_LITTLE:
{
- const Sized_relobj<64, false>* sized_relobj =
- static_cast<Sized_relobj<64, false>*>(relobj);
+ const Sized_relobj_file<64, false>* sized_relobj =
+ static_cast<Sized_relobj_file<64, false>*>(relobj);
this->print_input_section_symbols(sized_relobj, shndx);
}
break;
#ifdef HAVE_TARGET_64_BIG
case Parameters::TARGET_64_BIG:
{
- const Sized_relobj<64, true>* sized_relobj =
- static_cast<Sized_relobj<64, true>*>(relobj);
+ const Sized_relobj_file<64, true>* sized_relobj =
+ static_cast<Sized_relobj_file<64, true>*>(relobj);
this->print_input_section_symbols(sized_relobj, shndx);
}
break;
class Symbol;
class Relobj;
template<int size, bool big_endian>
-class Sized_relobj;
+class Sized_relobj_file;
class Output_section;
class Output_data;
// Print symbols for an input section.
template<int size, bool big_endian>
void
- print_input_section_symbols(const Sized_relobj<size, big_endian>*,
+ print_input_section_symbols(const Sized_relobj_file<size, big_endian>*,
unsigned int shndx);
// Map file to write to.
return this->get_view(loc.file_offset, *plen, true, cache);
}
-// Read the section data into SD. This is code common to Sized_relobj
+// Read the section data into SD. This is code common to Sized_relobj_file
// and Sized_dynobj, so we put it into Object.
template<int size, bool big_endian>
// Class Sized_relobj.
+// Iterate over local symbols, calling a visitor class V for each GOT offset
+// associated with a local symbol.
+
template<int size, bool big_endian>
-Sized_relobj<size, big_endian>::Sized_relobj(
+void
+Sized_relobj<size, big_endian>::do_for_all_local_got_entries(
+ Got_offset_list::Visitor* v) const
+{
+ unsigned int nsyms = this->local_symbol_count();
+ for (unsigned int i = 0; i < nsyms; i++)
+ {
+ Local_got_offsets::const_iterator p = this->local_got_offsets_.find(i);
+ if (p != this->local_got_offsets_.end())
+ {
+ const Got_offset_list* got_offsets = p->second;
+ got_offsets->for_all_got_offsets(v);
+ }
+ }
+}
+
+// Class Sized_relobj_file.
+
+template<int size, bool big_endian>
+Sized_relobj_file<size, big_endian>::Sized_relobj_file(
const std::string& name,
Input_file* input_file,
off_t offset,
const elfcpp::Ehdr<size, big_endian>& ehdr)
- : Sized_relobj_base<size, big_endian>(name, input_file, offset),
+ : Sized_relobj<size, big_endian>(name, input_file, offset),
elf_file_(this, ehdr),
symtab_shndx_(-1U),
local_symbol_count_(0),
local_symbol_offset_(0),
local_dynsym_offset_(0),
local_values_(),
- local_got_offsets_(),
local_plt_offsets_(),
kept_comdat_sections_(),
has_eh_frame_(false),
}
template<int size, bool big_endian>
-Sized_relobj<size, big_endian>::~Sized_relobj()
+Sized_relobj_file<size, big_endian>::~Sized_relobj_file()
{
}
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::do_setup()
+Sized_relobj_file<size, big_endian>::do_setup()
{
const unsigned int shnum = this->elf_file_.shnum();
this->set_shnum(shnum);
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::find_symtab(const unsigned char* pshdrs)
+Sized_relobj_file<size, big_endian>::find_symtab(const unsigned char* pshdrs)
{
const unsigned int shnum = this->shnum();
this->symtab_shndx_ = 0;
template<int size, bool big_endian>
Xindex*
-Sized_relobj<size, big_endian>::do_initialize_xindex()
+Sized_relobj_file<size, big_endian>::do_initialize_xindex()
{
gold_assert(this->symtab_shndx_ != -1U);
Xindex* xindex = new Xindex(this->elf_file_.large_shndx_offset());
template<int size, bool big_endian>
bool
-Sized_relobj<size, big_endian>::check_eh_frame_flags(
+Sized_relobj_file<size, big_endian>::check_eh_frame_flags(
const elfcpp::Shdr<size, big_endian>* shdr) const
{
return (shdr->get_sh_type() == elfcpp::SHT_PROGBITS
template<int size, bool big_endian>
bool
-Sized_relobj<size, big_endian>::find_eh_frame(
+Sized_relobj_file<size, big_endian>::find_eh_frame(
const unsigned char* pshdrs,
const char* names,
section_size_type names_size) const
unsigned int shnum,
const char* names,
section_size_type names_size,
- Sized_relobj<size, big_endian>* obj)
+ Sized_relobj_file<size, big_endian>* obj)
{
Compressed_section_map* uncompressed_sizes = new Compressed_section_map();
const unsigned int shdr_size = elfcpp::Elf_sizes<size>::shdr_size;
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::do_read_symbols(Read_symbols_data* sd)
+Sized_relobj_file<size, big_endian>::do_read_symbols(Read_symbols_data* sd)
{
this->read_section_data(&this->elf_file_, sd);
template<int size, bool big_endian>
unsigned int
-Sized_relobj<size, big_endian>::symbol_section_and_value(unsigned int sym,
- Address* value,
- bool* is_ordinary)
+Sized_relobj_file<size, big_endian>::symbol_section_and_value(unsigned int sym,
+ Address* value,
+ bool* is_ordinary)
{
section_size_type symbols_size;
const unsigned char* symbols = this->section_contents(this->symtab_shndx_,
template<int size, bool big_endian>
bool
-Sized_relobj<size, big_endian>::include_section_group(
+Sized_relobj_file<size, big_endian>::include_section_group(
Symbol_table* symtab,
Layout* layout,
unsigned int index,
template<int size, bool big_endian>
bool
-Sized_relobj<size, big_endian>::include_linkonce_section(
+Sized_relobj_file<size, big_endian>::include_linkonce_section(
Layout* layout,
unsigned int index,
const char* name,
template<int size, bool big_endian>
inline void
-Sized_relobj<size, big_endian>::layout_section(Layout* layout,
- unsigned int shndx,
- const char* name,
- typename This::Shdr& shdr,
- unsigned int reloc_shndx,
- unsigned int reloc_type)
+Sized_relobj_file<size, big_endian>::layout_section(Layout* layout,
+ unsigned int shndx,
+ const char* name,
+ typename This::Shdr& shdr,
+ unsigned int reloc_shndx,
+ unsigned int reloc_type)
{
off_t offset;
Output_section* os = layout->layout(this, shndx, name, shdr,
this->output_sections()[shndx] = os;
if (offset == -1)
- this->section_offsets_[shndx] = invalid_address;
+ this->section_offsets()[shndx] = invalid_address;
else
- this->section_offsets_[shndx] = convert_types<Address, off_t>(offset);
+ this->section_offsets()[shndx] = convert_types<Address, off_t>(offset);
// If this section requires special handling, and if there are
// relocs that apply to it, then we must do the special handling
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::do_layout(Symbol_table* symtab,
- Layout* layout,
- Read_symbols_data* sd)
+Sized_relobj_file<size, big_endian>::do_layout(Symbol_table* symtab,
+ Layout* layout,
+ Read_symbols_data* sd)
{
const unsigned int shnum = this->shnum();
bool is_gc_pass_one = ((parameters->options().gc_sections()
}
Output_sections& out_sections(this->output_sections());
- std::vector<Address>& out_section_offsets(this->section_offsets_);
+ std::vector<Address>& out_section_offsets(this->section_offsets());
if (!is_gc_pass_two)
{
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::do_layout_deferred_sections(Layout* layout)
+Sized_relobj_file<size, big_endian>::do_layout_deferred_sections(Layout* layout)
{
typename std::vector<Deferred_layout>::iterator deferred;
// Now handle the deferred relocation sections.
Output_sections& out_sections(this->output_sections());
- std::vector<Address>& out_section_offsets(this->section_offsets_);
+ std::vector<Address>& out_section_offsets(this->section_offsets());
for (deferred = this->deferred_layout_relocs_.begin();
deferred != this->deferred_layout_relocs_.end();
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::do_add_symbols(Symbol_table* symtab,
- Read_symbols_data* sd,
- Layout*)
+Sized_relobj_file<size, big_endian>::do_add_symbols(Symbol_table* symtab,
+ Read_symbols_data* sd,
+ Layout*)
{
if (sd->symbols == NULL)
{
template<int size, bool big_endian>
Archive::Should_include
-Sized_relobj<size, big_endian>::do_should_include_member(Symbol_table* symtab,
- Layout* layout,
- Read_symbols_data* sd,
- std::string* why)
+Sized_relobj_file<size, big_endian>::do_should_include_member(
+ Symbol_table* symtab,
+ Layout* layout,
+ Read_symbols_data* sd,
+ std::string* why)
{
char* tmpbuf = NULL;
size_t tmpbuflen = 0;
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::do_for_all_global_symbols(
+Sized_relobj_file<size, big_endian>::do_for_all_global_symbols(
Read_symbols_data* sd,
Library_base::Symbol_visitor_base* v)
{
}
}
-// Iterate over local symbols, calling a visitor class V for each GOT offset
-// associated with a local symbol.
-
-template<int size, bool big_endian>
-void
-Sized_relobj<size, big_endian>::do_for_all_local_got_entries(
- Got_offset_list::Visitor* v) const
-{
- unsigned int nsyms = this->local_symbol_count();
- for (unsigned int i = 0; i < nsyms; i++)
- {
- Local_got_offsets::const_iterator p = this->local_got_offsets_.find(i);
- if (p != this->local_got_offsets_.end())
- {
- const Got_offset_list* got_offsets = p->second;
- got_offsets->for_all_got_offsets(v);
- }
- }
-}
-
// Return whether the local symbol SYMNDX has a PLT offset.
template<int size, bool big_endian>
bool
-Sized_relobj<size, big_endian>::local_has_plt_offset(unsigned int symndx) const
+Sized_relobj_file<size, big_endian>::local_has_plt_offset(
+ unsigned int symndx) const
{
typename Local_plt_offsets::const_iterator p =
this->local_plt_offsets_.find(symndx);
template<int size, bool big_endian>
unsigned int
-Sized_relobj<size, big_endian>::local_plt_offset(unsigned int symndx) const
+Sized_relobj_file<size, big_endian>::local_plt_offset(unsigned int symndx) const
{
typename Local_plt_offsets::const_iterator p =
this->local_plt_offsets_.find(symndx);
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::set_local_plt_offset(unsigned int symndx,
- unsigned int plt_offset)
+Sized_relobj_file<size, big_endian>::set_local_plt_offset(
+ unsigned int symndx, unsigned int plt_offset)
{
std::pair<typename Local_plt_offsets::iterator, bool> ins =
this->local_plt_offsets_.insert(std::make_pair(symndx, plt_offset));
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::do_count_local_symbols(Stringpool* pool,
- Stringpool* dynpool)
+Sized_relobj_file<size, big_endian>::do_count_local_symbols(Stringpool* pool,
+ Stringpool* dynpool)
{
gold_assert(this->symtab_shndx_ != -1U);
if (this->symtab_shndx_ == 0)
// Compute the final value of a local symbol.
template<int size, bool big_endian>
-typename Sized_relobj<size, big_endian>::Compute_final_local_value_status
-Sized_relobj<size, big_endian>::compute_final_local_value_internal(
+typename Sized_relobj_file<size, big_endian>::Compute_final_local_value_status
+Sized_relobj_file<size, big_endian>::compute_final_local_value_internal(
unsigned int r_sym,
const Symbol_value<size>* lv_in,
Symbol_value<size>* lv_out,
Section_id folded = symtab->icf()->get_folded_section(this,
shndx);
gold_assert(folded.first != NULL);
- Sized_relobj<size, big_endian>* folded_obj = reinterpret_cast
- <Sized_relobj<size, big_endian>*>(folded.first);
+ Sized_relobj_file<size, big_endian>* folded_obj = reinterpret_cast
+ <Sized_relobj_file<size, big_endian>*>(folded.first);
os = folded_obj->output_section(folded.second);
gold_assert(os != NULL);
secoffset = folded_obj->get_output_section_offset(folded.second);
// everything is finalized. The caller should also free up any allocated
// memory in the return value in *LV.
template<int size, bool big_endian>
-typename Sized_relobj<size, big_endian>::Compute_final_local_value_status
-Sized_relobj<size, big_endian>::compute_final_local_value(
+typename Sized_relobj_file<size, big_endian>::Compute_final_local_value_status
+Sized_relobj_file<size, big_endian>::compute_final_local_value(
unsigned int r_sym,
const Symbol_value<size>* lv_in,
Symbol_value<size>* lv_out,
// This is just a wrapper of compute_final_local_value_internal.
const bool relocatable = parameters->options().relocatable();
const Output_sections& out_sections(this->output_sections());
- const std::vector<Address>& out_offsets(this->section_offsets_);
+ const std::vector<Address>& out_offsets(this->section_offsets());
return this->compute_final_local_value_internal(r_sym, lv_in, lv_out,
relocatable, out_sections,
out_offsets, symtab);
template<int size, bool big_endian>
unsigned int
-Sized_relobj<size, big_endian>::do_finalize_local_symbols(unsigned int index,
- off_t off,
- Symbol_table* symtab)
+Sized_relobj_file<size, big_endian>::do_finalize_local_symbols(
+ unsigned int index,
+ off_t off,
+ Symbol_table* symtab)
{
gold_assert(off == static_cast<off_t>(align_address(off, size >> 3)));
const bool relocatable = parameters->options().relocatable();
const Output_sections& out_sections(this->output_sections());
- const std::vector<Address>& out_offsets(this->section_offsets_);
+ const std::vector<Address>& out_offsets(this->section_offsets());
for (unsigned int i = 1; i < loccount; ++i)
{
template<int size, bool big_endian>
unsigned int
-Sized_relobj<size, big_endian>::do_set_local_dynsym_indexes(unsigned int index)
+Sized_relobj_file<size, big_endian>::do_set_local_dynsym_indexes(
+ unsigned int index)
{
const unsigned int loccount = this->local_symbol_count_;
for (unsigned int i = 1; i < loccount; ++i)
template<int size, bool big_endian>
unsigned int
-Sized_relobj<size, big_endian>::do_set_local_dynsym_offset(off_t off)
+Sized_relobj_file<size, big_endian>::do_set_local_dynsym_offset(off_t off)
{
gold_assert(off == static_cast<off_t>(align_address(off, size >> 3)));
this->local_dynsym_offset_ = off;
template<int size, bool big_endian>
uint64_t
-Sized_relobj<size, big_endian>::do_section_flags(unsigned int shndx)
+Sized_relobj_file<size, big_endian>::do_section_flags(unsigned int shndx)
{
Symbols_data* sd = this->get_symbols_data();
if (sd != NULL)
template<int size, bool big_endian>
uint64_t
-Sized_relobj<size, big_endian>::do_section_entsize(unsigned int shndx)
+Sized_relobj_file<size, big_endian>::do_section_entsize(unsigned int shndx)
{
Symbols_data* sd = this->get_symbols_data();
gold_assert(sd != NULL);
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::write_local_symbols(
+Sized_relobj_file<size, big_endian>::write_local_symbols(
Output_file* of,
const Stringpool* sympool,
const Stringpool* dynpool,
template<int size, bool big_endian>
bool
-Sized_relobj<size, big_endian>::get_symbol_location_info(
+Sized_relobj_file<size, big_endian>::get_symbol_location_info(
unsigned int shndx,
off_t offset,
Symbol_location_info* info)
// debugging sections. If we can't find the kept section, return 0.
template<int size, bool big_endian>
-typename Sized_relobj<size, big_endian>::Address
-Sized_relobj<size, big_endian>::map_to_kept_section(
+typename Sized_relobj_file<size, big_endian>::Address
+Sized_relobj_file<size, big_endian>::map_to_kept_section(
unsigned int shndx,
bool* found) const
{
unsigned int kept_shndx;
if (this->get_kept_comdat_section(shndx, &kept_object, &kept_shndx))
{
- Sized_relobj<size, big_endian>* kept_relobj =
- static_cast<Sized_relobj<size, big_endian>*>(kept_object);
+ Sized_relobj_file<size, big_endian>* kept_relobj =
+ static_cast<Sized_relobj_file<size, big_endian>*>(kept_object);
Output_section* os = kept_relobj->output_section(kept_shndx);
Address offset = kept_relobj->get_output_section_offset(kept_shndx);
if (os != NULL && offset != invalid_address)
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::do_get_global_symbol_counts(
+Sized_relobj_file<size, big_endian>::do_get_global_symbol_counts(
const Symbol_table*,
size_t* defined,
size_t* used) const
#ifdef HAVE_TARGET_32_LITTLE
template
-class Sized_relobj<32, false>;
+class Sized_relobj_file<32, false>;
#endif
#ifdef HAVE_TARGET_32_BIG
template
-class Sized_relobj<32, true>;
+class Sized_relobj_file<32, true>;
#endif
#ifdef HAVE_TARGET_64_LITTLE
template
-class Sized_relobj<64, false>;
+class Sized_relobj_file<64, false>;
#endif
#ifdef HAVE_TARGET_64_BIG
template
-class Sized_relobj<64, true>;
+class Sized_relobj_file<64, true>;
#endif
#ifdef HAVE_TARGET_32_LITTLE
set_shnum(int shnum)
{ this->shnum_ = shnum; }
- // Functions used by both Sized_relobj and Sized_dynobj.
+ // Functions used by both Sized_relobj_file and Sized_dynobj.
// Read the section data into a Read_symbols_data object.
template<int size, bool big_endian>
};
// A regular object (ET_REL). This is an abstract base class itself.
-// The implementation is the template class Sized_relobj.
+// The implementation is the template class Sized_relobj_file.
class Relobj : public Object
{
relocs_must_follow_section_writes_(false),
sd_(NULL),
reloc_counts_(NULL),
- reloc_bases_(NULL)
+ reloc_bases_(NULL),
+ first_dyn_reloc_(0),
+ dyn_reloc_count_(0)
{ }
// During garbage collection, the Read_symbols_data pass for
set_local_dynsym_offset(off_t off)
{ return this->do_set_local_dynsym_offset(off); }
+ // Record a dynamic relocation against an input section from this object.
+ void
+ add_dyn_reloc(unsigned int index)
+ {
+ if (this->dyn_reloc_count_ == 0)
+ this->first_dyn_reloc_ = index;
+ ++this->dyn_reloc_count_;
+ }
+
+ // Return the index of the first dynamic relocation.
+ unsigned int
+ first_dyn_reloc() const
+ { return this->first_dyn_reloc_; }
+
+ // Return the count of dynamic relocations.
+ unsigned int
+ dyn_reloc_count() const
+ { return this->dyn_reloc_count_; }
+
// Relocate the input sections and write out the local symbols.
void
relocate(const Symbol_table* symtab, const Layout* layout, Output_file* of)
unsigned int* reloc_counts_;
// Per-symbol base indexes of relocations, for incremental links.
unsigned int* reloc_bases_;
+ // Index of the first dynamic relocation for this object.
+ unsigned int first_dyn_reloc_;
+ // Count of dynamic relocations for this object.
+ unsigned int dyn_reloc_count_;
};
// This class is used to handle relocations against a section symbol
// symbol is defined, and ADDEND is an addend to add to the value.
template<bool big_endian>
Value
- value(const Sized_relobj<size, big_endian>* object, Value addend) const
+ value(const Sized_relobj_file<size, big_endian>* object, Value addend) const
{
if (this->has_output_value_)
return this->u_.value + addend;
// or an incremental (unchanged) object. This is size and endian specific.
template<int size, bool big_endian>
-class Sized_relobj_base : public Relobj
+class Sized_relobj : public Relobj
{
public:
+ typedef typename elfcpp::Elf_types<size>::Elf_Addr Address;
typedef Relobj::Symbols Symbols;
- Sized_relobj_base(const std::string& name, Input_file* input_file)
- : Relobj(name, input_file)
+ static const Address invalid_address = static_cast<Address>(0) - 1;
+
+ Sized_relobj(const std::string& name, Input_file* input_file)
+ : Relobj(name, input_file), local_got_offsets_(), section_offsets_()
{ }
- Sized_relobj_base(const std::string& name, Input_file* input_file,
+ Sized_relobj(const std::string& name, Input_file* input_file,
off_t offset)
- : Relobj(name, input_file, offset)
+ : Relobj(name, input_file, offset), local_got_offsets_(), section_offsets_()
{ }
- ~Sized_relobj_base()
+ ~Sized_relobj()
{ }
+ // If this is a regular object, return a pointer to the Sized_relobj_file
+ // object. Otherwise, return NULL.
+ virtual Sized_relobj_file<size, big_endian>*
+ sized_relobj()
+ { return NULL; }
+
+ const virtual Sized_relobj_file<size, big_endian>*
+ sized_relobj() const
+ { return NULL; }
+
+ // Checks if the offset of input section SHNDX within its output
+ // section is invalid.
+ bool
+ is_output_section_offset_invalid(unsigned int shndx) const
+ { return this->get_output_section_offset(shndx) == invalid_address; }
+
+ // Get the offset of input section SHNDX within its output section.
+ // This is -1 if the input section requires a special mapping, such
+ // as a merge section. The output section can be found in the
+ // output_sections_ field of the parent class Relobj.
+ Address
+ get_output_section_offset(unsigned int shndx) const
+ {
+ gold_assert(shndx < this->section_offsets_.size());
+ return this->section_offsets_[shndx];
+ }
+
+ // Return whether the local symbol SYMNDX has a GOT offset.
+ // For TLS symbols, the GOT entry will hold its tp-relative offset.
+ bool
+ local_has_got_offset(unsigned int symndx, unsigned int got_type) const
+ {
+ Local_got_offsets::const_iterator p =
+ this->local_got_offsets_.find(symndx);
+ return (p != this->local_got_offsets_.end()
+ && p->second->get_offset(got_type) != -1U);
+ }
+
+ // Return the GOT offset of the local symbol SYMNDX.
+ unsigned int
+ local_got_offset(unsigned int symndx, unsigned int got_type) const
+ {
+ Local_got_offsets::const_iterator p =
+ this->local_got_offsets_.find(symndx);
+ gold_assert(p != this->local_got_offsets_.end());
+ unsigned int off = p->second->get_offset(got_type);
+ gold_assert(off != -1U);
+ return off;
+ }
+
+ // Set the GOT offset of the local symbol SYMNDX to GOT_OFFSET.
+ void
+ set_local_got_offset(unsigned int symndx, unsigned int got_type,
+ unsigned int got_offset)
+ {
+ Local_got_offsets::const_iterator p =
+ this->local_got_offsets_.find(symndx);
+ if (p != this->local_got_offsets_.end())
+ p->second->set_offset(got_type, got_offset);
+ else
+ {
+ Got_offset_list* g = new Got_offset_list(got_type, got_offset);
+ std::pair<Local_got_offsets::iterator, bool> ins =
+ this->local_got_offsets_.insert(std::make_pair(symndx, g));
+ gold_assert(ins.second);
+ }
+ }
+
+ // Iterate over local symbols, calling a visitor class V for each GOT offset
+ // associated with a local symbol.
+ void
+ do_for_all_local_got_entries(Got_offset_list::Visitor* v) const;
+
protected:
typedef Relobj::Output_sections Output_sections;
+ // Clear the local symbol information.
+ void
+ clear_got_offsets()
+ { this->local_got_offsets_.clear(); }
+
+ // Return the vector of section offsets.
+ std::vector<Address>&
+ section_offsets()
+ { return this->section_offsets_; }
+
+ // Get the offset of a section.
+ uint64_t
+ do_output_section_offset(unsigned int shndx) const
+ {
+ Address off = this->get_output_section_offset(shndx);
+ if (off == invalid_address)
+ return -1ULL;
+ return off;
+ }
+
+ // Set the offset of a section.
+ void
+ do_set_section_offset(unsigned int shndx, uint64_t off)
+ {
+ gold_assert(shndx < this->section_offsets_.size());
+ this->section_offsets_[shndx] =
+ (off == static_cast<uint64_t>(-1)
+ ? invalid_address
+ : convert_types<Address, uint64_t>(off));
+ }
+
private:
+ // The GOT offsets of local symbols. This map also stores GOT offsets
+ // for tp-relative offsets for TLS symbols.
+ typedef Unordered_map<unsigned int, Got_offset_list*> Local_got_offsets;
+
+ // GOT offsets for local non-TLS symbols, and tp-relative offsets
+ // for TLS symbols, indexed by symbol number.
+ Local_got_offsets local_got_offsets_;
+ // For each input section, the offset of the input section in its
+ // output section. This is INVALID_ADDRESS if the input section requires a
+ // special mapping.
+ std::vector<Address> section_offsets_;
};
// A regular object file. This is size and endian specific.
template<int size, bool big_endian>
-class Sized_relobj : public Sized_relobj_base<size, big_endian>
+class Sized_relobj_file : public Sized_relobj<size, big_endian>
{
public:
typedef typename elfcpp::Elf_types<size>::Elf_Addr Address;
- typedef typename Sized_relobj_base<size, big_endian>::Symbols Symbols;
+ typedef typename Sized_relobj<size, big_endian>::Symbols Symbols;
typedef std::vector<Symbol_value<size> > Local_values;
static const Address invalid_address = static_cast<Address>(0) - 1;
CFLV_DISCARDED
};
- Sized_relobj(const std::string& name, Input_file* input_file, off_t offset,
- const typename elfcpp::Ehdr<size, big_endian>&);
-
- ~Sized_relobj();
+ Sized_relobj_file(const std::string& name,
+ Input_file* input_file,
+ off_t offset,
+ const typename elfcpp::Ehdr<size, big_endian>&);
- // Checks if the offset of input section SHNDX within its output
- // section is invalid.
- bool
- is_output_section_offset_invalid(unsigned int shndx) const
- { return this->get_output_section_offset(shndx) == invalid_address; }
+ ~Sized_relobj_file();
// Set up the object file based on TARGET.
void
setup()
{ this->do_setup(); }
+ // Return a pointer to the Sized_relobj_file object.
+ Sized_relobj_file<size, big_endian>*
+ sized_relobj()
+ { return this; }
+
+ const Sized_relobj_file<size, big_endian>*
+ sized_relobj() const
+ { return this; }
+
// Return the number of symbols. This is only valid after
// Object::add_symbols has been called.
unsigned int
this->local_values_[sym].set_needs_output_dynsym_entry();
}
- // Return whether the local symbol SYMNDX has a GOT offset.
- // For TLS symbols, the GOT entry will hold its tp-relative offset.
- bool
- local_has_got_offset(unsigned int symndx, unsigned int got_type) const
- {
- Local_got_offsets::const_iterator p =
- this->local_got_offsets_.find(symndx);
- return (p != this->local_got_offsets_.end()
- && p->second->get_offset(got_type) != -1U);
- }
-
- // Return the GOT offset of the local symbol SYMNDX.
- unsigned int
- local_got_offset(unsigned int symndx, unsigned int got_type) const
- {
- Local_got_offsets::const_iterator p =
- this->local_got_offsets_.find(symndx);
- gold_assert(p != this->local_got_offsets_.end());
- unsigned int off = p->second->get_offset(got_type);
- gold_assert(off != -1U);
- return off;
- }
-
- // Set the GOT offset of the local symbol SYMNDX to GOT_OFFSET.
- void
- set_local_got_offset(unsigned int symndx, unsigned int got_type,
- unsigned int got_offset)
- {
- Local_got_offsets::const_iterator p =
- this->local_got_offsets_.find(symndx);
- if (p != this->local_got_offsets_.end())
- p->second->set_offset(got_type, got_offset);
- else
- {
- Got_offset_list* g = new Got_offset_list(got_type, got_offset);
- std::pair<Local_got_offsets::iterator, bool> ins =
- this->local_got_offsets_.insert(std::make_pair(symndx, g));
- gold_assert(ins.second);
- }
- }
-
// Return whether the local symbol SYMNDX has a PLT offset.
bool
local_has_plt_offset(unsigned int symndx) const;
void
set_local_plt_offset(unsigned int symndx, unsigned int plt_offset);
- // Get the offset of input section SHNDX within its output section.
- // This is -1 if the input section requires a special mapping, such
- // as a merge section. The output section can be found in the
- // output_sections_ field of the parent class Relobj.
- Address
- get_output_section_offset(unsigned int shndx) const
- {
- gold_assert(shndx < this->section_offsets_.size());
- return this->section_offsets_[shndx];
- }
-
// Return the name of the symbol that spans the given offset in the
// specified section in this object. This is used only for error
// messages and is not particularly efficient.
const Symbol_table* symtab);
protected:
- typedef typename Sized_relobj_base<size, big_endian>::Output_sections
+ typedef typename Sized_relobj<size, big_endian>::Output_sections
Output_sections;
// Set up.
do_for_all_global_symbols(Read_symbols_data* sd,
Library_base::Symbol_visitor_base* v);
- // Iterate over local symbols, calling a visitor class V for each GOT offset
- // associated with a local symbol.
- void
- do_for_all_local_got_entries(Got_offset_list::Visitor* v) const;
-
// Read the relocs.
void
do_read_relocs(Read_relocs_data*);
do_get_global_symbols() const
{ return &this->symbols_; }
- // Get the offset of a section.
- uint64_t
- do_output_section_offset(unsigned int shndx) const
- {
- Address off = this->get_output_section_offset(shndx);
- if (off == invalid_address)
- return -1ULL;
- return off;
- }
-
- // Set the offset of a section.
- void
- do_set_section_offset(unsigned int shndx, uint64_t off)
- {
- gold_assert(shndx < this->section_offsets_.size());
- this->section_offsets_[shndx] =
- (off == static_cast<uint64_t>(-1)
- ? invalid_address
- : convert_types<Address, uint64_t>(off));
- }
-
// Adjust a section index if necessary.
unsigned int
adjust_shndx(unsigned int shndx)
private:
// For convenience.
- typedef Sized_relobj<size, big_endian> This;
+ typedef Sized_relobj_file<size, big_endian> This;
static const int ehdr_size = elfcpp::Elf_sizes<size>::ehdr_size;
static const int shdr_size = elfcpp::Elf_sizes<size>::shdr_size;
static const int sym_size = elfcpp::Elf_sizes<size>::sym_size;
const std::vector<Address>& out_offsets,
const Symbol_table* symtab);
- // The GOT offsets of local symbols. This map also stores GOT offsets
- // for tp-relative offsets for TLS symbols.
- typedef Unordered_map<unsigned int, Got_offset_list*> Local_got_offsets;
-
// The PLT offsets of local symbols.
typedef Unordered_map<unsigned int, unsigned int> Local_plt_offsets;
off_t local_dynsym_offset_;
// Values of local symbols.
Local_values local_values_;
- // GOT offsets for local non-TLS symbols, and tp-relative offsets
- // for TLS symbols, indexed by symbol number.
- Local_got_offsets local_got_offsets_;
// PLT offsets for local symbols.
Local_plt_offsets local_plt_offsets_;
- // For each input section, the offset of the input section in its
- // output section. This is INVALID_ADDRESS if the input section requires a
- // special mapping.
- std::vector<Address> section_offsets_;
// Table mapping discarded comdat sections to corresponding kept sections.
Kept_comdat_section_table kept_comdat_sections_;
// Whether this object has a GNU style .eh_frame section.
// Layout.
const Layout* layout;
// Object being relocated.
- Sized_relobj<size, big_endian>* object;
+ Sized_relobj_file<size, big_endian>* object;
// Section index of relocation section.
unsigned int reloc_shndx;
// Section header of relocation section.
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;
}
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();
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;
}
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);
}
}
&& 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
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)
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_)
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)
{
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)
{
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,
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,
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,
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,
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));
}
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,
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,
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,
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,
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,
class Sized_target;
template<int size, bool big_endian>
class Sized_relobj;
+template<int size, bool big_endian>
+class Sized_relobj_file;
// An abtract class for data which has to go into the output file.
Address
symbol_value(Addend addend) const;
+ // If this relocation is against an input section, return the
+ // relocatable object containing the input section.
+ Sized_relobj<size, big_endian>*
+ get_relobj() const
+ {
+ if (this->shndx_ == INVALID_CODE)
+ return NULL;
+ return this->u2_.relobj;
+ }
+
// Write the reloc entry to an output view.
void
write(unsigned char* pov) const;
is_symbolless() const
{ return this->rel_.is_symbolless(); }
+ // If this relocation is against an input section, return the
+ // relocatable object containing the input section.
+ Sized_relobj<size, big_endian>*
+ get_relobj() const
+ { return this->rel_.get_relobj(); }
+
// Write the reloc entry to an output view.
void
write(unsigned char* pov) const;
od->add_dynamic_reloc();
if (reloc.is_relative())
this->bump_relative_reloc_count();
+ Sized_relobj<size, big_endian>* relobj = reloc.get_relobj();
+ if (relobj != NULL)
+ relobj->add_dyn_reloc(this->relocs_.size() - 1);
}
private:
void
add_local_section(Sized_relobj<size, big_endian>* relobj,
- unsigned int input_shndx, unsigned int type,
- Output_data* od, unsigned int shndx, Address address,
- Addend addend)
+ unsigned int input_shndx, unsigned int type,
+ Output_data* od, unsigned int shndx, Address address,
+ Addend addend)
{
this->add(od, Output_reloc_type(relobj, input_shndx, type, shndx,
address, addend, false, false, true));
{
public:
// The constructor clears *INPUT_SHNDXES.
- Output_data_group(Sized_relobj<size, big_endian>* relobj,
+ Output_data_group(Sized_relobj_file<size, big_endian>* relobj,
section_size_type entry_count,
elfcpp::Elf_Word flags,
std::vector<unsigned int>* input_shndxes);
private:
// The input object.
- Sized_relobj<size, big_endian>* relobj_;
+ Sized_relobj_file<size, big_endian>* relobj_;
// The group flag word.
elfcpp::Elf_Word flags_;
// The section indexes of the input sections in this group.
// this is a new GOT entry, false if the symbol already has a GOT
// entry.
bool
- add_local(Sized_relobj<size, big_endian>* object, unsigned int sym_index,
+ add_local(Sized_relobj_file<size, big_endian>* object, unsigned int sym_index,
unsigned int got_type);
// Like add_local, but use the PLT offset of the local symbol if it
// has one.
bool
- add_local_plt(Sized_relobj<size, big_endian>* object, unsigned int sym_index,
+ add_local_plt(Sized_relobj_file<size, big_endian>* object,
+ unsigned int sym_index,
unsigned int got_type);
// Add an entry for a local symbol to the GOT, and add a dynamic
// relocation of type R_TYPE for the GOT entry.
void
- add_local_with_rel(Sized_relobj<size, big_endian>* object,
+ add_local_with_rel(Sized_relobj_file<size, big_endian>* object,
unsigned int sym_index, unsigned int got_type,
Rel_dyn* rel_dyn, unsigned int r_type);
void
- add_local_with_rela(Sized_relobj<size, big_endian>* object,
+ add_local_with_rela(Sized_relobj_file<size, big_endian>* object,
unsigned int sym_index, unsigned int got_type,
Rela_dyn* rela_dyn, unsigned int r_type);
// Add a pair of entries for a local symbol to the GOT, and add
// dynamic relocations of type R_TYPE_1 and R_TYPE_2, respectively.
void
- add_local_pair_with_rel(Sized_relobj<size, big_endian>* object,
+ add_local_pair_with_rel(Sized_relobj_file<size, big_endian>* object,
unsigned int sym_index, unsigned int shndx,
unsigned int got_type, Rel_dyn* rel_dyn,
unsigned int r_type_1, unsigned int r_type_2);
void
- add_local_pair_with_rela(Sized_relobj<size, big_endian>* object,
+ add_local_pair_with_rela(Sized_relobj_file<size, big_endian>* object,
unsigned int sym_index, unsigned int shndx,
unsigned int got_type, Rela_dyn* rela_dyn,
unsigned int r_type_1, unsigned int r_type_2);
return got_offset;
}
- // Reserve a slot in the GOT for a local symbol or the second slot of a pair.
+ // Reserve a slot in the GOT.
+ void
+ reserve_slot(unsigned int i)
+ { this->free_list_.remove(i * size / 8, (i + 1) * size / 8); }
+
+ // Reserve a slot in the GOT for a local symbol.
void
- reserve_slot(unsigned int i);
+ reserve_local(unsigned int i, Sized_relobj<size, big_endian>* object,
+ unsigned int sym_index, unsigned int got_type);
// Reserve a slot in the GOT for a global symbol.
void
- reserve_slot_for_global(unsigned int i, Symbol* gsym, unsigned int got_type);
+ reserve_global(unsigned int i, Symbol* gsym, unsigned int got_type);
protected:
// Write out the GOT table.
{ this->u_.gsym = gsym; }
// Create a local symbol entry.
- Got_entry(Sized_relobj<size, big_endian>* object,
+ Got_entry(Sized_relobj_file<size, big_endian>* object,
unsigned int local_sym_index, bool use_plt_offset)
: local_sym_index_(local_sym_index), use_plt_offset_(use_plt_offset)
{
union
{
// For a local symbol, the object.
- Sized_relobj<size, big_endian>* object;
+ Sized_relobj_file<size, big_endian>* object;
// For a global symbol, the symbol.
Symbol* gsym;
// For a constant, the constant.
// within the output section.
template<int size, bool big_endian>
off_t
- add_input_section(Layout* layout, Sized_relobj<size, big_endian>* object,
+ add_input_section(Layout* layout, Sized_relobj_file<size, big_endian>* object,
unsigned int shndx, const char* name,
const elfcpp::Shdr<size, big_endian>& shdr,
unsigned int reloc_shndx, bool have_sections_script);
void
gc_process_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
void
scan_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
void
scan_relocatable_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
inline void
local(Symbol_table* symtab, Layout* layout, Target_powerpc* target,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rela<size, big_endian>& reloc, unsigned int r_type,
inline void
global(Symbol_table* symtab, Layout* layout, Target_powerpc* target,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rela<size, big_endian>& reloc, unsigned int r_type,
inline bool
local_reloc_may_be_function_pointer(Symbol_table* , Layout* ,
Target_powerpc* ,
- Sized_relobj<size, big_endian>* ,
+ Sized_relobj_file<size, big_endian>* ,
unsigned int ,
Output_section* ,
const elfcpp::Rela<size, big_endian>& ,
inline bool
global_reloc_may_be_function_pointer(Symbol_table* , Layout* ,
Target_powerpc* ,
- Sized_relobj<size, big_endian>* ,
+ Sized_relobj_file<size, big_endian>* ,
unsigned int ,
Output_section* ,
const elfcpp::Rela<size,
private:
static void
- unsupported_reloc_local(Sized_relobj<size, big_endian>*,
+ unsupported_reloc_local(Sized_relobj_file<size, big_endian>*,
unsigned int r_type);
static void
- unsupported_reloc_global(Sized_relobj<size, big_endian>*,
+ unsupported_reloc_global(Sized_relobj_file<size, big_endian>*,
unsigned int r_type, Symbol*);
static void
// Create a GOT entry for the TLS module index.
unsigned int
got_mod_index_entry(Symbol_table* symtab, Layout* layout,
- Sized_relobj<size, big_endian>* object);
+ Sized_relobj_file<size, big_endian>* object);
// Get the PLT section.
const Output_data_plt_powerpc<size, big_endian>*
// Copy a relocation against a global symbol.
void
copy_reloc(Symbol_table* symtab, Layout* layout,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int shndx, Output_section* output_section,
Symbol* sym, const elfcpp::Rela<size, big_endian>& reloc)
{
rela(unsigned char* view,
unsigned int right_shift,
elfcpp::Elf_Xword dst_mask,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Swap<valsize, big_endian>::Valtype addend)
{
static inline void
rela_ua(unsigned char* view, unsigned int right_shift,
elfcpp::Elf_Xword dst_mask,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Swap<size, big_endian>::Valtype addend)
{
static inline void
pcrela(unsigned char* view, unsigned int right_shift,
elfcpp::Elf_Xword dst_mask,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Swap<size, big_endian>::Valtype addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
template<int valsize>
static inline void
pcrela_unaligned(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Swap<size, big_endian>::Valtype addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
// R_POWERPC_REL32: (Symbol + Addend - Address)
static inline void
rel32(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
// R_POWERPC_REL24: (Symbol + Addend - Address) & 0x3fffffc
static inline void
rel24(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
// R_POWERPC_REL14: (Symbol + Addend - Address) & 0xfffc
static inline void
rel14(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
static inline void
addr16(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{ This_reloc::rela16(view, object, psymval, addend); }
static inline void
addr16_lo(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{ This_reloc::rela16(view, object, psymval, addend); }
static inline void
addr16_hi(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
static inline void
addr16_ha(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
// R_PPC_REL16: (Symbol + Addend - Address) & 0xffff
static inline void
rel16(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
// R_PPC_REL16_LO: (Symbol + Addend - Address) & 0xffff
static inline void
rel16_lo(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
// R_PPC_REL16_HI: ((Symbol + Addend - Address) >> 16) & 0xffff
static inline void
rel16_hi(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
// relocation is negative, add one.
static inline void
rel16_ha(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
template<int size, bool big_endian>
unsigned int
-Target_powerpc<size, big_endian>::got_mod_index_entry(Symbol_table* symtab,
- Layout* layout,
- Sized_relobj<size, big_endian>* object)
+Target_powerpc<size, big_endian>::got_mod_index_entry(
+ Symbol_table* symtab,
+ Layout* layout,
+ Sized_relobj_file<size, big_endian>* object)
{
if (this->got_mod_index_offset_ == -1U)
{
template<int size, bool big_endian>
void
Target_powerpc<size, big_endian>::Scan::unsupported_reloc_local(
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int r_type)
{
gold_error(_("%s: unsupported reloc %u against local symbol"),
Symbol_table* symtab,
Layout* layout,
Target_powerpc<size, big_endian>* target,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rela<size, big_endian>& reloc,
template<int size, bool big_endian>
void
Target_powerpc<size, big_endian>::Scan::unsupported_reloc_global(
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int r_type,
Symbol* gsym)
{
Symbol_table* symtab,
Layout* layout,
Target_powerpc<size, big_endian>* target,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rela<size, big_endian>& reloc,
Target_powerpc<size, big_endian>::gc_process_relocs(
Symbol_table* symtab,
Layout* layout,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
unsigned int,
const unsigned char* prelocs,
Target_powerpc<size, big_endian>::scan_relocs(
Symbol_table* symtab,
Layout* layout,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
psymval = &symval;
}
- const Sized_relobj<size, big_endian>* object = relinfo->object;
+ const Sized_relobj_file<size, big_endian>* object = relinfo->object;
elfcpp::Elf_Xword addend = rela.get_r_addend();
// Get the GOT offset if needed. Unlike i386 and x86_64, our GOT
{
Output_segment* tls_segment = relinfo->layout->tls_segment();
typedef Powerpc_relocate_functions<size, big_endian> Reloc;
- const Sized_relobj<size, big_endian>* object = relinfo->object;
+ const Sized_relobj_file<size, big_endian>* object = relinfo->object;
const elfcpp::Elf_Xword addend = rela.get_r_addend();
typename elfcpp::Elf_types<size>::Elf_Addr value = psymval->value(object, 0);
Target_powerpc<size, big_endian>::scan_relocatable_relocs(
Symbol_table* symtab,
Layout* layout,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::do_read_relocs(Read_relocs_data* rd)
+Sized_relobj_file<size, big_endian>::do_read_relocs(Read_relocs_data* rd)
{
rd->relocs.clear();
rd->relocs.reserve(shnum / 2);
const Output_sections& out_sections(this->output_sections());
- const std::vector<Address>& out_offsets(this->section_offsets_);
+ const std::vector<Address>& out_offsets(this->section_offsets());
const unsigned char* pshdrs = this->get_view(this->elf_file_.shoff(),
shnum * This::shdr_size,
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::do_gc_process_relocs(Symbol_table* symtab,
- Layout* layout,
- Read_relocs_data* rd)
+Sized_relobj_file<size, big_endian>::do_gc_process_relocs(Symbol_table* symtab,
+ Layout* layout,
+ Read_relocs_data* rd)
{
Sized_target<size, big_endian>* target =
parameters->sized_target<size, big_endian>();
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::do_scan_relocs(Symbol_table* symtab,
+Sized_relobj_file<size, big_endian>::do_scan_relocs(Symbol_table* symtab,
Layout* layout,
Read_relocs_data* rd)
{
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::emit_relocs_scan(
+Sized_relobj_file<size, big_endian>::emit_relocs_scan(
Symbol_table* symtab,
Layout* layout,
const unsigned char* plocal_syms,
template<int size, bool big_endian>
template<int sh_type>
void
-Sized_relobj<size, big_endian>::emit_relocs_scan_reltype(
+Sized_relobj_file<size, big_endian>::emit_relocs_scan_reltype(
Symbol_table* symtab,
Layout* layout,
const unsigned char* plocal_syms,
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::incremental_relocs_scan(
+Sized_relobj_file<size, big_endian>::incremental_relocs_scan(
const Read_relocs_data::Relocs_list::iterator& p)
{
if (p->sh_type == elfcpp::SHT_REL)
template<int size, bool big_endian>
template<int sh_type>
void
-Sized_relobj<size, big_endian>::incremental_relocs_scan_reltype(
+Sized_relobj_file<size, big_endian>::incremental_relocs_scan_reltype(
const Read_relocs_data::Relocs_list::iterator& p)
{
typedef typename Reloc_types<sh_type, size, big_endian>::Reloc Reltype;
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::do_relocate(const Symbol_table* symtab,
- const Layout* layout,
- Output_file* of)
+Sized_relobj_file<size, big_endian>::do_relocate(const Symbol_table* symtab,
+ const Layout* layout,
+ Output_file* of)
{
unsigned int shnum = this->shnum();
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::write_sections(const unsigned char* pshdrs,
- Output_file* of,
- Views* pviews)
+Sized_relobj_file<size, big_endian>::write_sections(const unsigned char* pshdrs,
+ Output_file* of,
+ Views* pviews)
{
unsigned int shnum = this->shnum();
const Output_sections& out_sections(this->output_sections());
- const std::vector<Address>& out_offsets(this->section_offsets_);
+ const std::vector<Address>& out_offsets(this->section_offsets());
File_read::Read_multiple rm;
bool is_sorted = true;
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::do_relocate_sections(
+Sized_relobj_file<size, big_endian>::do_relocate_sections(
const Symbol_table* symtab,
const Layout* layout,
const unsigned char* pshdrs,
parameters->sized_target<size, big_endian>();
const Output_sections& out_sections(this->output_sections());
- const std::vector<Address>& out_offsets(this->section_offsets_);
+ const std::vector<Address>& out_offsets(this->section_offsets());
Relocate_info<size, big_endian> relinfo;
relinfo.symtab = symtab;
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::emit_relocs(
+Sized_relobj_file<size, big_endian>::emit_relocs(
const Relocate_info<size, big_endian>* relinfo,
unsigned int i,
unsigned int sh_type,
template<int size, bool big_endian>
template<int sh_type>
void
-Sized_relobj<size, big_endian>::emit_relocs_reltype(
+Sized_relobj_file<size, big_endian>::emit_relocs_reltype(
const Relocate_info<size, big_endian>* relinfo,
unsigned int i,
const unsigned char* prelocs,
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::incremental_relocs_write(
+Sized_relobj_file<size, big_endian>::incremental_relocs_write(
const Relocate_info<size, big_endian>* relinfo,
unsigned int sh_type,
const unsigned char* prelocs,
template<int size, bool big_endian>
template<int sh_type>
void
-Sized_relobj<size, big_endian>::incremental_relocs_write_reltype(
+Sized_relobj_file<size, big_endian>::incremental_relocs_write_reltype(
const Relocate_info<size, big_endian>* relinfo,
const unsigned char* prelocs,
size_t reloc_count,
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::initialize_input_to_output_maps()
+Sized_relobj_file<size, big_endian>::initialize_input_to_output_maps()
{
const unsigned int loccount = this->local_symbol_count_;
for (unsigned int i = 1; i < loccount; ++i)
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::free_input_to_output_maps()
+Sized_relobj_file<size, big_endian>::free_input_to_output_maps()
{
const unsigned int loccount = this->local_symbol_count_;
for (unsigned int i = 1; i < loccount; ++i)
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::split_stack_adjust(
+Sized_relobj_file<size, big_endian>::split_stack_adjust(
const Symbol_table* symtab,
const unsigned char* pshdrs,
unsigned int sh_type,
template<int size, bool big_endian>
template<int sh_type>
void
-Sized_relobj<size, big_endian>::split_stack_adjust_reltype(
+Sized_relobj_file<size, big_endian>::split_stack_adjust_reltype(
const Symbol_table* symtab,
const unsigned char* pshdrs,
unsigned int shndx,
template<int size, bool big_endian>
void
-Sized_relobj<size, big_endian>::find_functions(
+Sized_relobj_file<size, big_endian>::find_functions(
const unsigned char* pshdrs,
unsigned int shndx,
- Sized_relobj<size, big_endian>::Function_offsets* function_offsets)
+ Sized_relobj_file<size, big_endian>::Function_offsets* function_offsets)
{
// We need to read the symbols to find the functions. If we wanted
// to, we could cache reading the symbols across all sections in the
#ifdef HAVE_TARGET_32_LITTLE
template
void
-Sized_relobj<32, false>::do_read_relocs(Read_relocs_data* rd);
+Sized_relobj_file<32, false>::do_read_relocs(Read_relocs_data* rd);
#endif
#ifdef HAVE_TARGET_32_BIG
template
void
-Sized_relobj<32, true>::do_read_relocs(Read_relocs_data* rd);
+Sized_relobj_file<32, true>::do_read_relocs(Read_relocs_data* rd);
#endif
#ifdef HAVE_TARGET_64_LITTLE
template
void
-Sized_relobj<64, false>::do_read_relocs(Read_relocs_data* rd);
+Sized_relobj_file<64, false>::do_read_relocs(Read_relocs_data* rd);
#endif
#ifdef HAVE_TARGET_64_BIG
template
void
-Sized_relobj<64, true>::do_read_relocs(Read_relocs_data* rd);
+Sized_relobj_file<64, true>::do_read_relocs(Read_relocs_data* rd);
#endif
#ifdef HAVE_TARGET_32_LITTLE
template
void
-Sized_relobj<32, false>::do_gc_process_relocs(Symbol_table* symtab,
- Layout* layout,
- Read_relocs_data* rd);
+Sized_relobj_file<32, false>::do_gc_process_relocs(Symbol_table* symtab,
+ Layout* layout,
+ Read_relocs_data* rd);
#endif
#ifdef HAVE_TARGET_32_BIG
template
void
-Sized_relobj<32, true>::do_gc_process_relocs(Symbol_table* symtab,
- Layout* layout,
- Read_relocs_data* rd);
+Sized_relobj_file<32, true>::do_gc_process_relocs(Symbol_table* symtab,
+ Layout* layout,
+ Read_relocs_data* rd);
#endif
#ifdef HAVE_TARGET_64_LITTLE
template
void
-Sized_relobj<64, false>::do_gc_process_relocs(Symbol_table* symtab,
- Layout* layout,
- Read_relocs_data* rd);
+Sized_relobj_file<64, false>::do_gc_process_relocs(Symbol_table* symtab,
+ Layout* layout,
+ Read_relocs_data* rd);
#endif
#ifdef HAVE_TARGET_64_BIG
template
void
-Sized_relobj<64, true>::do_gc_process_relocs(Symbol_table* symtab,
- Layout* layout,
- Read_relocs_data* rd);
+Sized_relobj_file<64, true>::do_gc_process_relocs(Symbol_table* symtab,
+ Layout* layout,
+ Read_relocs_data* rd);
#endif
#ifdef HAVE_TARGET_32_LITTLE
template
void
-Sized_relobj<32, false>::do_scan_relocs(Symbol_table* symtab,
- Layout* layout,
- Read_relocs_data* rd);
+Sized_relobj_file<32, false>::do_scan_relocs(Symbol_table* symtab,
+ Layout* layout,
+ Read_relocs_data* rd);
#endif
#ifdef HAVE_TARGET_32_BIG
template
void
-Sized_relobj<32, true>::do_scan_relocs(Symbol_table* symtab,
- Layout* layout,
- Read_relocs_data* rd);
+Sized_relobj_file<32, true>::do_scan_relocs(Symbol_table* symtab,
+ Layout* layout,
+ Read_relocs_data* rd);
#endif
#ifdef HAVE_TARGET_64_LITTLE
template
void
-Sized_relobj<64, false>::do_scan_relocs(Symbol_table* symtab,
- Layout* layout,
- Read_relocs_data* rd);
+Sized_relobj_file<64, false>::do_scan_relocs(Symbol_table* symtab,
+ Layout* layout,
+ Read_relocs_data* rd);
#endif
#ifdef HAVE_TARGET_64_BIG
template
void
-Sized_relobj<64, true>::do_scan_relocs(Symbol_table* symtab,
- Layout* layout,
- Read_relocs_data* rd);
+Sized_relobj_file<64, true>::do_scan_relocs(Symbol_table* symtab,
+ Layout* layout,
+ Read_relocs_data* rd);
#endif
#ifdef HAVE_TARGET_32_LITTLE
template
void
-Sized_relobj<32, false>::do_relocate(const Symbol_table* symtab,
- const Layout* layout,
- Output_file* of);
+Sized_relobj_file<32, false>::do_relocate(const Symbol_table* symtab,
+ const Layout* layout,
+ Output_file* of);
#endif
#ifdef HAVE_TARGET_32_BIG
template
void
-Sized_relobj<32, true>::do_relocate(const Symbol_table* symtab,
- const Layout* layout,
- Output_file* of);
+Sized_relobj_file<32, true>::do_relocate(const Symbol_table* symtab,
+ const Layout* layout,
+ Output_file* of);
#endif
#ifdef HAVE_TARGET_64_LITTLE
template
void
-Sized_relobj<64, false>::do_relocate(const Symbol_table* symtab,
- const Layout* layout,
- Output_file* of);
+Sized_relobj_file<64, false>::do_relocate(const Symbol_table* symtab,
+ const Layout* layout,
+ Output_file* of);
#endif
#ifdef HAVE_TARGET_64_BIG
template
void
-Sized_relobj<64, true>::do_relocate(const Symbol_table* symtab,
- const Layout* layout,
- Output_file* of);
+Sized_relobj_file<64, true>::do_relocate(const Symbol_table* symtab,
+ const Layout* layout,
+ Output_file* of);
#endif
#ifdef HAVE_TARGET_32_LITTLE
template
void
-Sized_relobj<32, false>::do_relocate_sections(
+Sized_relobj_file<32, false>::do_relocate_sections(
const Symbol_table* symtab,
const Layout* layout,
const unsigned char* pshdrs,
#ifdef HAVE_TARGET_32_BIG
template
void
-Sized_relobj<32, true>::do_relocate_sections(
+Sized_relobj_file<32, true>::do_relocate_sections(
const Symbol_table* symtab,
const Layout* layout,
const unsigned char* pshdrs,
#ifdef HAVE_TARGET_64_LITTLE
template
void
-Sized_relobj<64, false>::do_relocate_sections(
+Sized_relobj_file<64, false>::do_relocate_sections(
const Symbol_table* symtab,
const Layout* layout,
const unsigned char* pshdrs,
#ifdef HAVE_TARGET_64_BIG
template
void
-Sized_relobj<64, true>::do_relocate_sections(
+Sized_relobj_file<64, true>::do_relocate_sections(
const Symbol_table* symtab,
const Layout* layout,
const unsigned char* pshdrs,
#ifdef HAVE_TARGET_32_LITTLE
template
void
-Sized_relobj<32, false>::initialize_input_to_output_maps();
+Sized_relobj_file<32, false>::initialize_input_to_output_maps();
template
void
-Sized_relobj<32, false>::free_input_to_output_maps();
+Sized_relobj_file<32, false>::free_input_to_output_maps();
#endif
#ifdef HAVE_TARGET_32_BIG
template
void
-Sized_relobj<32, true>::initialize_input_to_output_maps();
+Sized_relobj_file<32, true>::initialize_input_to_output_maps();
template
void
-Sized_relobj<32, true>::free_input_to_output_maps();
+Sized_relobj_file<32, true>::free_input_to_output_maps();
#endif
#ifdef HAVE_TARGET_64_LITTLE
template
void
-Sized_relobj<64, false>::initialize_input_to_output_maps();
+Sized_relobj_file<64, false>::initialize_input_to_output_maps();
template
void
-Sized_relobj<64, false>::free_input_to_output_maps();
+Sized_relobj_file<64, false>::free_input_to_output_maps();
#endif
#ifdef HAVE_TARGET_64_BIG
template
void
-Sized_relobj<64, true>::initialize_input_to_output_maps();
+Sized_relobj_file<64, true>::initialize_input_to_output_maps();
template
void
-Sized_relobj<64, true>::free_input_to_output_maps();
+Sized_relobj_file<64, true>::free_input_to_output_maps();
#endif
#if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)
class Sized_symbol;
template<int size, bool big_endian>
-class Sized_relobj;
+class Sized_relobj_file;
template<int size>
class Symbol_value;
template<int valsize>
static inline void
rel(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval)
{
typedef typename elfcpp::Swap<valsize, big_endian>::Valtype Valtype;
template<int valsize>
static inline void
rela(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Swap<valsize, big_endian>::Valtype addend)
{
template<int valsize>
static inline void
pcrel(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr address)
{
template<int valsize>
static inline void
pcrela(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Swap<valsize, big_endian>::Valtype addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
static inline void
rel8(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval)
{ This::template rel<8>(view, object, psymval); }
static inline void
rela8(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
unsigned char addend)
{ This::template rela<8>(view, object, psymval, addend); }
static inline void
pcrel8(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr address)
{ This::template pcrel<8>(view, object, psymval, address); }
static inline void
pcrela8(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
unsigned char addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
static inline void
rel16(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval)
{ This::template rel<16>(view, object, psymval); }
static inline void
rela16(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
elfcpp::Elf_Half addend)
{ This::template rela<16>(view, object, psymval, addend); }
static inline void
pcrel16(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr address)
{ This::template pcrel<16>(view, object, psymval, address); }
static inline void
pcrela16(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
elfcpp::Elf_Half addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
static inline void
rel32(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval)
{ This::template rel<32>(view, object, psymval); }
static inline void
rela32(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
elfcpp::Elf_Word addend)
{ This::template rela<32>(view, object, psymval, addend); }
static inline void
pcrel32(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr address)
{ This::template pcrel<32>(view, object, psymval, address); }
static inline void
pcrela32(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
elfcpp::Elf_Word addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
static inline void
rel64(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval)
{ This::template rel<64>(view, object, psymval); }
static inline void
rela64(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
elfcpp::Elf_Xword addend)
{ This::template rela<64>(view, object, psymval, addend); }
static inline void
pcrel64(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr address)
{ This::template pcrel<64>(view, object, psymval, address); }
static inline void
pcrela64(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
elfcpp::Elf_Xword addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
void
gc_process_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
void
scan_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
void
scan_relocatable_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
inline void
local(Symbol_table* symtab, Layout* layout, Target_sparc* target,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rela<size, big_endian>& reloc, unsigned int r_type,
inline void
global(Symbol_table* symtab, Layout* layout, Target_sparc* target,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rela<size, big_endian>& reloc, unsigned int r_type,
inline bool
local_reloc_may_be_function_pointer(Symbol_table* , Layout* ,
Target_sparc* ,
- Sized_relobj<size, big_endian>* ,
+ Sized_relobj_file<size, big_endian>* ,
unsigned int ,
Output_section* ,
const elfcpp::Rela<size, big_endian>& ,
inline bool
global_reloc_may_be_function_pointer(Symbol_table* , Layout* ,
Target_sparc* ,
- Sized_relobj<size, big_endian>* ,
+ Sized_relobj_file<size, big_endian>* ,
unsigned int ,
Output_section* ,
const elfcpp::Rela<size,
private:
static void
- unsupported_reloc_local(Sized_relobj<size, big_endian>*,
+ unsupported_reloc_local(Sized_relobj_file<size, big_endian>*,
unsigned int r_type);
static void
- unsupported_reloc_global(Sized_relobj<size, big_endian>*,
+ unsupported_reloc_global(Sized_relobj_file<size, big_endian>*,
unsigned int r_type, Symbol*);
static void
// Create a GOT entry for the TLS module index.
unsigned int
got_mod_index_entry(Symbol_table* symtab, Layout* layout,
- Sized_relobj<size, big_endian>* object);
+ Sized_relobj_file<size, big_endian>* object);
// Return the gsym for "__tls_get_addr". Cache if not already
// cached.
// Copy a relocation against a global symbol.
void
copy_reloc(Symbol_table* symtab, Layout* layout,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int shndx, Output_section* output_section,
Symbol* sym, const elfcpp::Rela<size, big_endian>& reloc)
{
rela(unsigned char* view,
unsigned int right_shift,
typename elfcpp::Elf_types<valsize>::Elf_Addr dst_mask,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Swap<valsize, big_endian>::Valtype addend)
{
static inline void
rela_ua(unsigned char* view,
unsigned int right_shift, elfcpp::Elf_Xword dst_mask,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Swap<size, big_endian>::Valtype addend)
{
pcrela(unsigned char* view,
unsigned int right_shift,
typename elfcpp::Elf_types<valsize>::Elf_Addr dst_mask,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Swap<size, big_endian>::Valtype addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
template<int valsize>
static inline void
pcrela_unaligned(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Swap<size, big_endian>::Valtype addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
// R_SPARC_WDISP30: (Symbol + Addend - Address) >> 2
static inline void
wdisp30(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
// R_SPARC_WDISP22: (Symbol + Addend - Address) >> 2
static inline void
wdisp22(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
// R_SPARC_WDISP19: (Symbol + Addend - Address) >> 2
static inline void
wdisp19(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
// R_SPARC_WDISP16: (Symbol + Addend - Address) >> 2
static inline void
wdisp16(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
// R_SPARC_PC22: (Symbol + Addend - Address) >> 10
static inline void
pc22(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
// R_SPARC_PC10: (Symbol + Addend - Address) & 0x3ff
static inline void
pc10(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
// R_SPARC_HI22: (Symbol + Addend) >> 10
static inline void
hi22(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
// R_SPARC_PCPLT22: (Symbol + Addend - Address) >> 10
static inline void
pcplt22(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
// R_SPARC_LO10: (Symbol + Addend) & 0x3ff
static inline void
lo10(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
// R_SPARC_LO10: (Symbol + Addend) & 0x3ff
static inline void
lo10(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
// R_SPARC_OLO10: ((Symbol + Addend) & 0x3ff) + Addend2
static inline void
olo10(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr addend2)
// R_SPARC_22: (Symbol + Addend)
static inline void
rela32_22(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
// R_SPARC_13: (Symbol + Addend)
static inline void
rela32_13(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
// R_SPARC_UA16: (Symbol + Addend)
static inline void
ua16(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
// R_SPARC_UA32: (Symbol + Addend)
static inline void
ua32(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
// R_SPARC_UA64: (Symbol + Addend)
static inline void
ua64(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
// R_SPARC_DISP8: (Symbol + Addend - Address)
static inline void
disp8(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
// R_SPARC_DISP16: (Symbol + Addend - Address)
static inline void
disp16(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
// R_SPARC_DISP32: (Symbol + Addend - Address)
static inline void
disp32(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
// R_SPARC_DISP64: (Symbol + Addend - Address)
static inline void
disp64(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
elfcpp::Elf_Xword addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
// R_SPARC_H44: (Symbol + Addend) >> 22
static inline void
h44(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
// R_SPARC_M44: ((Symbol + Addend) >> 12) & 0x3ff
static inline void
m44(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
// R_SPARC_L44: (Symbol + Addend) & 0xfff
static inline void
l44(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
// R_SPARC_HH22: (Symbol + Addend) >> 42
static inline void
hh22(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
// R_SPARC_PC_HH22: (Symbol + Addend - Address) >> 42
static inline void
pc_hh22(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
// R_SPARC_HM10: ((Symbol + Addend) >> 32) & 0x3ff
static inline void
hm10(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
// R_SPARC_PC_HM10: ((Symbol + Addend - Address) >> 32) & 0x3ff
static inline void
pc_hm10(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend,
typename elfcpp::Elf_types<size>::Elf_Addr address)
// R_SPARC_11: (Symbol + Addend)
static inline void
rela32_11(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
// R_SPARC_10: (Symbol + Addend)
static inline void
rela32_10(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
// R_SPARC_7: (Symbol + Addend)
static inline void
rela32_7(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
// R_SPARC_6: (Symbol + Addend)
static inline void
rela32_6(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
// R_SPARC_5: (Symbol + Addend)
static inline void
rela32_5(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
// R_SPARC_HIX22: ((Symbol + Addend) ^ 0xffffffffffffffff) >> 10
static inline void
hix22(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
// R_SPARC_LOX10: ((Symbol + Addend) & 0x3ff) | 0x1c00
static inline void
lox10(unsigned char* view,
- const Sized_relobj<size, big_endian>* object,
+ const Sized_relobj_file<size, big_endian>* object,
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
template<int size, bool big_endian>
unsigned int
-Target_sparc<size, big_endian>::got_mod_index_entry(Symbol_table* symtab,
- Layout* layout,
- Sized_relobj<size, big_endian>* object)
+Target_sparc<size, big_endian>::got_mod_index_entry(
+ Symbol_table* symtab,
+ Layout* layout,
+ Sized_relobj_file<size, big_endian>* object)
{
if (this->got_mod_index_offset_ == -1U)
{
template<int size, bool big_endian>
void
Target_sparc<size, big_endian>::Scan::unsupported_reloc_local(
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int r_type)
{
gold_error(_("%s: unsupported reloc %u against local symbol"),
Symbol_table* symtab,
Layout* layout,
Target_sparc<size, big_endian>* target,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rela<size, big_endian>& reloc,
template<int size, bool big_endian>
void
Target_sparc<size, big_endian>::Scan::unsupported_reloc_global(
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int r_type,
Symbol* gsym)
{
Symbol_table* symtab,
Layout* layout,
Target_sparc<size, big_endian>* target,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rela<size, big_endian>& reloc,
Target_sparc<size, big_endian>::gc_process_relocs(
Symbol_table* symtab,
Layout* layout,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
unsigned int,
const unsigned char* prelocs,
Target_sparc<size, big_endian>::scan_relocs(
Symbol_table* symtab,
Layout* layout,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
psymval = &symval;
}
- const Sized_relobj<size, big_endian>* object = relinfo->object;
+ const Sized_relobj_file<size, big_endian>* object = relinfo->object;
const elfcpp::Elf_Xword addend = rela.get_r_addend();
// Get the GOT offset if needed. Unlike i386 and x86_64, our GOT
{
Output_segment* tls_segment = relinfo->layout->tls_segment();
typedef Sparc_relocate_functions<size, big_endian> Reloc;
- const Sized_relobj<size, big_endian>* object = relinfo->object;
+ const Sized_relobj_file<size, big_endian>* object = relinfo->object;
typedef typename elfcpp::Swap<32, true>::Valtype Insntype;
const elfcpp::Elf_Xword addend = rela.get_r_addend();
Target_sparc<size, big_endian>::scan_relocatable_relocs(
Symbol_table* symtab,
Layout* layout,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
template<int size, bool big_endian>
void
Symbol_table::add_from_relobj(
- Sized_relobj<size, big_endian>* relobj,
+ Sized_relobj_file<size, big_endian>* relobj,
const unsigned char* syms,
size_t count,
size_t symndx_offset,
const char* sym_names,
size_t sym_name_size,
- typename Sized_relobj<size, big_endian>::Symbols* sympointers,
+ typename Sized_relobj_file<size, big_endian>::Symbols* sympointers,
size_t* defined)
{
*defined = 0;
const unsigned char* versym,
size_t versym_size,
const std::vector<const char*>* version_map,
- typename Sized_relobj<size, big_endian>::Symbols* sympointers,
+ typename Sized_relobj_file<size, big_endian>::Symbols* sympointers,
size_t* defined)
{
*defined = 0;
template
void
Symbol_table::add_from_relobj<32, false>(
- Sized_relobj<32, false>* relobj,
+ Sized_relobj_file<32, false>* relobj,
const unsigned char* syms,
size_t count,
size_t symndx_offset,
const char* sym_names,
size_t sym_name_size,
- Sized_relobj<32, false>::Symbols* sympointers,
+ Sized_relobj_file<32, false>::Symbols* sympointers,
size_t* defined);
#endif
template
void
Symbol_table::add_from_relobj<32, true>(
- Sized_relobj<32, true>* relobj,
+ Sized_relobj_file<32, true>* relobj,
const unsigned char* syms,
size_t count,
size_t symndx_offset,
const char* sym_names,
size_t sym_name_size,
- Sized_relobj<32, true>::Symbols* sympointers,
+ Sized_relobj_file<32, true>::Symbols* sympointers,
size_t* defined);
#endif
template
void
Symbol_table::add_from_relobj<64, false>(
- Sized_relobj<64, false>* relobj,
+ Sized_relobj_file<64, false>* relobj,
const unsigned char* syms,
size_t count,
size_t symndx_offset,
const char* sym_names,
size_t sym_name_size,
- Sized_relobj<64, false>::Symbols* sympointers,
+ Sized_relobj_file<64, false>::Symbols* sympointers,
size_t* defined);
#endif
template
void
Symbol_table::add_from_relobj<64, true>(
- Sized_relobj<64, true>* relobj,
+ Sized_relobj_file<64, true>* relobj,
const unsigned char* syms,
size_t count,
size_t symndx_offset,
const char* sym_names,
size_t sym_name_size,
- Sized_relobj<64, true>::Symbols* sympointers,
+ Sized_relobj_file<64, true>::Symbols* sympointers,
size_t* defined);
#endif
const unsigned char* versym,
size_t versym_size,
const std::vector<const char*>* version_map,
- Sized_relobj<32, false>::Symbols* sympointers,
+ Sized_relobj_file<32, false>::Symbols* sympointers,
size_t* defined);
#endif
const unsigned char* versym,
size_t versym_size,
const std::vector<const char*>* version_map,
- Sized_relobj<32, true>::Symbols* sympointers,
+ Sized_relobj_file<32, true>::Symbols* sympointers,
size_t* defined);
#endif
const unsigned char* versym,
size_t versym_size,
const std::vector<const char*>* version_map,
- Sized_relobj<64, false>::Symbols* sympointers,
+ Sized_relobj_file<64, false>::Symbols* sympointers,
size_t* defined);
#endif
const unsigned char* versym,
size_t versym_size,
const std::vector<const char*>* version_map,
- Sized_relobj<64, true>::Symbols* sympointers,
+ Sized_relobj_file<64, true>::Symbols* sympointers,
size_t* defined);
#endif
class Object;
class Relobj;
template<int size, bool big_endian>
-class Sized_relobj;
+class Sized_relobj_file;
template<int size, bool big_endian>
class Sized_pluginobj;
class Dynobj;
// *DEFINED to the number of defined symbols.
template<int size, bool big_endian>
void
- add_from_relobj(Sized_relobj<size, big_endian>* relobj,
+ add_from_relobj(Sized_relobj_file<size, big_endian>* relobj,
const unsigned char* syms, size_t count,
size_t symndx_offset, const char* sym_names,
size_t sym_name_size,
- typename Sized_relobj<size, big_endian>::Symbols*,
+ typename Sized_relobj_file<size, big_endian>::Symbols*,
size_t* defined);
// Add one external symbol from the plugin object OBJ to the symbol table.
const char* sym_names, size_t sym_name_size,
const unsigned char* versym, size_t versym_size,
const std::vector<const char*>*,
- typename Sized_relobj<size, big_endian>::Symbols*,
+ typename Sized_relobj_file<size, big_endian>::Symbols*,
size_t* defined);
// Add one external symbol from the incremental object OBJ to the symbol
Symbol_table* symtab,
Layout* layout,
Target_type* target,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
const unsigned char* prelocs,
size_t reloc_count,
const int reloc_size = Reloc_types<sh_type, size, big_endian>::reloc_size;
Relocate relocate;
- Sized_relobj<size, big_endian>* object = relinfo->object;
+ Sized_relobj_file<size, big_endian>* object = relinfo->object;
unsigned int local_count = object->local_symbol_count();
Comdat_behavior comdat_behavior = CB_UNDETERMINED;
scan_relocatable_relocs(
Symbol_table*,
Layout*,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
const unsigned char* prelocs,
size_t reloc_count,
const int reloc_size = Reloc_types<sh_type, size, big_endian>::reloc_size;
const Address invalid_address = static_cast<Address>(0) - 1;
- Sized_relobj<size, big_endian>* const object = relinfo->object;
+ Sized_relobj_file<size, big_endian>* const object = relinfo->object;
const unsigned int local_count = object->local_symbol_count();
unsigned char* pwrite = reloc_view;
int et = ehdr.get_e_type();
if (et == elfcpp::ET_REL)
{
- Sized_relobj<size, big_endian>* obj =
- new Sized_relobj<size, big_endian>(name, input_file, offset, ehdr);
+ Sized_relobj_file<size, big_endian>* obj =
+ new Sized_relobj_file<size, big_endian>(name, input_file, offset, ehdr);
obj->setup();
return obj;
}
class Relobj;
template<int size, bool big_endian>
class Sized_relobj;
+template<int size, bool big_endian>
+class Sized_relobj_file;
class Relocatable_relocs;
template<int size, bool big_endian>
class Relocate_info;
virtual void
gc_process_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
virtual void
scan_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
virtual void
scan_relocatable_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
unsigned int /* plt_count */)
{ gold_unreachable(); }
+ // Reserve a GOT entry for a local symbol, and regenerate any
+ // necessary dynamic relocations.
+ virtual void
+ reserve_local_got_entry(unsigned int /* got_index */,
+ Sized_relobj<size, big_endian>* /* obj */,
+ unsigned int /* r_sym */,
+ unsigned int /* got_type */)
+ { gold_unreachable(); }
+
+ // Reserve a GOT entry for a global symbol, and regenerate any
+ // necessary dynamic relocations.
+ virtual void
+ reserve_global_got_entry(unsigned int /* got_index */, Symbol* /* gsym */,
+ unsigned int /* got_type */)
+ { gold_unreachable(); }
+
// Register an existing PLT entry for a global symbol.
// A target needs to implement this to support incremental linking.
delete sd.symbol_names;
sd.symbol_names = NULL;
- Sized_relobj<size, big_endian>* relobj =
- static_cast<Sized_relobj<size, big_endian>*>(object);
- typename Sized_relobj<size, big_endian>::Address value;
+ Sized_relobj_file<size, big_endian>* relobj =
+ static_cast<Sized_relobj_file<size, big_endian>*>(object);
+ typename Sized_relobj_file<size, big_endian>::Address value;
bool is_ordinary;
CHECK(relobj->symbol_section_and_value(0, &value, &is_ordinary) == 0);
CHECK(is_ordinary);
{ }
void
- gc_process_relocs(Symbol_table*, Layout*, Sized_relobj<size, big_endian>*,
+ gc_process_relocs(Symbol_table*, Layout*,
+ Sized_relobj_file<size, big_endian>*,
unsigned int, unsigned int, const unsigned char*, size_t,
Output_section*, bool, size_t, const unsigned char*)
{ ERROR("call to Target_test::gc_process_relocs"); }
void
- scan_relocs(Symbol_table*, Layout*, Sized_relobj<size, big_endian>*,
+ scan_relocs(Symbol_table*, Layout*, Sized_relobj_file<size, big_endian>*,
unsigned int, unsigned int, const unsigned char*, size_t,
Output_section*, bool, size_t, const unsigned char*)
{ ERROR("call to Target_test::scan_relocs"); }
void
scan_relocatable_relocs(Symbol_table*, Layout*,
- Sized_relobj<size, big_endian>*, unsigned int,
+ Sized_relobj_file<size, big_endian>*, unsigned int,
unsigned int, const unsigned char*,
size_t, Output_section*, bool, size_t,
const unsigned char*, Relocatable_relocs*)
// Add an entry to the PLT for a local STT_GNU_IFUNC symbol.
unsigned int
- add_local_ifunc_entry(Sized_relobj<64, false>* relobj,
+ add_local_ifunc_entry(Sized_relobj_file<64, false>* relobj,
unsigned int local_sym_index);
// Add the relocation for a PLT entry.
void
gc_process_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<64, false>* object,
+ Sized_relobj_file<64, false>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
void
scan_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<64, false>* object,
+ Sized_relobj_file<64, false>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
void
scan_relocatable_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<64, false>* object,
+ Sized_relobj_file<64, false>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
unsigned int got_count,
unsigned int plt_count);
+ // Reserve a GOT entry for a local symbol, and regenerate any
+ // necessary dynamic relocations.
+ void
+ reserve_local_got_entry(unsigned int got_index,
+ Sized_relobj<64, false>* obj,
+ unsigned int r_sym,
+ unsigned int got_type);
+
+ // Reserve a GOT entry for a global symbol, and regenerate any
+ // necessary dynamic relocations.
+ void
+ reserve_global_got_entry(unsigned int got_index, Symbol* gsym,
+ unsigned int got_type);
+
// Register an existing PLT entry for a global symbol.
// A target needs to implement this to support incremental linking.
void
// Add a new reloc argument, returning the index in the vector.
size_t
- add_tlsdesc_info(Sized_relobj<64, false>* object, unsigned int r_sym)
+ add_tlsdesc_info(Sized_relobj_file<64, false>* object, unsigned int r_sym)
{
this->tlsdesc_reloc_info_.push_back(Tlsdesc_info(object, r_sym));
return this->tlsdesc_reloc_info_.size() - 1;
inline void
local(Symbol_table* symtab, Layout* layout, Target_x86_64* target,
- Sized_relobj<64, false>* object,
+ Sized_relobj_file<64, false>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rela<64, false>& reloc, unsigned int r_type,
inline void
global(Symbol_table* symtab, Layout* layout, Target_x86_64* target,
- Sized_relobj<64, false>* object,
+ Sized_relobj_file<64, false>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rela<64, false>& reloc, unsigned int r_type,
inline bool
local_reloc_may_be_function_pointer(Symbol_table* symtab, Layout* layout,
Target_x86_64* target,
- Sized_relobj<64, false>* object,
+ Sized_relobj_file<64, false>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rela<64, false>& reloc,
inline bool
global_reloc_may_be_function_pointer(Symbol_table* symtab, Layout* layout,
Target_x86_64* target,
- Sized_relobj<64, false>* object,
+ Sized_relobj_file<64, false>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rela<64, false>& reloc,
private:
static void
- unsupported_reloc_local(Sized_relobj<64, false>*, unsigned int r_type);
+ unsupported_reloc_local(Sized_relobj_file<64, false>*, unsigned int r_type);
static void
- unsupported_reloc_global(Sized_relobj<64, false>*, unsigned int r_type,
+ unsupported_reloc_global(Sized_relobj_file<64, false>*, unsigned int r_type,
Symbol*);
void
possible_function_pointer_reloc(unsigned int r_type);
bool
- reloc_needs_plt_for_ifunc(Sized_relobj<64, false>*, unsigned int r_type);
+ reloc_needs_plt_for_ifunc(Sized_relobj_file<64, false>*,
+ unsigned int r_type);
// Whether we have issued an error about a non-PIC compilation.
bool issued_non_pic_error_;
// Create a PLT entry for a local STT_GNU_IFUNC symbol.
void
make_local_ifunc_plt_entry(Symbol_table*, Layout*,
- Sized_relobj<64, false>* relobj,
+ Sized_relobj_file<64, false>* relobj,
unsigned int local_sym_index);
// Define the _TLS_MODULE_BASE_ symbol in the TLS segment.
// Create a GOT entry for the TLS module index.
unsigned int
got_mod_index_entry(Symbol_table* symtab, Layout* layout,
- Sized_relobj<64, false>* object);
+ Sized_relobj_file<64, false>* object);
// Get the PLT section.
Output_data_plt_x86_64*
// Add a potential copy relocation.
void
copy_reloc(Symbol_table* symtab, Layout* layout,
- Sized_relobj<64, false>* object,
+ Sized_relobj_file<64, false>* object,
unsigned int shndx, Output_section* output_section,
Symbol* sym, const elfcpp::Rela<64, false>& reloc)
{
// R_X86_64_TLSDESC against a local symbol.
struct Tlsdesc_info
{
- Tlsdesc_info(Sized_relobj<64, false>* a_object, unsigned int a_r_sym)
+ Tlsdesc_info(Sized_relobj_file<64, false>* a_object, unsigned int a_r_sym)
: object(a_object), r_sym(a_r_sym)
{ }
// The object in which the local symbol is defined.
- Sized_relobj<64, false>* object;
+ Sized_relobj_file<64, false>* object;
// The local symbol index in the object.
unsigned int r_sym;
};
// the PLT offset.
unsigned int
-Output_data_plt_x86_64::add_local_ifunc_entry(Sized_relobj<64, false>* relobj,
- unsigned int local_sym_index)
+Output_data_plt_x86_64::add_local_ifunc_entry(
+ Sized_relobj_file<64, false>* relobj,
+ unsigned int local_sym_index)
{
unsigned int plt_offset = (this->count_ + 1) * plt_entry_size;
++this->count_;
void
Target_x86_64::make_local_ifunc_plt_entry(Symbol_table* symtab, Layout* layout,
- Sized_relobj<64, false>* relobj,
+ Sized_relobj_file<64, false>* relobj,
unsigned int local_sym_index)
{
if (relobj->local_has_plt_offset(local_sym_index))
Output_section* rela_plt_os = this->plt_->rela_plt()->output_section();
rela_plt_os->set_info_section(this->plt_->output_section());
+ // Create the rela_dyn section.
+ this->rela_dyn_section(layout);
+
return this->got_;
}
+// Reserve a GOT entry for a local symbol, and regenerate any
+// necessary dynamic relocations.
+
+void
+Target_x86_64::reserve_local_got_entry(
+ unsigned int got_index,
+ Sized_relobj<64, false>* obj,
+ unsigned int r_sym,
+ unsigned int got_type)
+{
+ unsigned int got_offset = got_index * 8;
+ Reloc_section* rela_dyn = this->rela_dyn_section(NULL);
+
+ this->got_->reserve_local(got_index, obj, r_sym, got_type);
+ switch (got_type)
+ {
+ case GOT_TYPE_STANDARD:
+ if (parameters->options().output_is_position_independent())
+ rela_dyn->add_local_relative(obj, r_sym, elfcpp::R_X86_64_RELATIVE,
+ this->got_, got_offset, 0);
+ break;
+ case GOT_TYPE_TLS_OFFSET:
+ rela_dyn->add_local(obj, r_sym, elfcpp::R_X86_64_TPOFF64,
+ this->got_, got_offset, 0);
+ break;
+ case GOT_TYPE_TLS_PAIR:
+ this->got_->reserve_slot(got_index + 1);
+ rela_dyn->add_local(obj, r_sym, elfcpp::R_X86_64_DTPMOD64,
+ this->got_, got_offset, 0);
+ break;
+ case GOT_TYPE_TLS_DESC:
+ gold_fatal(_("TLS_DESC not yet supported for incremental linking"));
+ // this->got_->reserve_slot(got_index + 1);
+ // rela_dyn->add_target_specific(elfcpp::R_X86_64_TLSDESC, arg,
+ // this->got_, got_offset, 0);
+ break;
+ default:
+ gold_unreachable();
+ }
+}
+
+// Reserve a GOT entry for a global symbol, and regenerate any
+// necessary dynamic relocations.
+
+void
+Target_x86_64::reserve_global_got_entry(unsigned int got_index, Symbol* gsym,
+ unsigned int got_type)
+{
+ unsigned int got_offset = got_index * 8;
+ Reloc_section* rela_dyn = this->rela_dyn_section(NULL);
+
+ this->got_->reserve_global(got_index, gsym, got_type);
+ switch (got_type)
+ {
+ case GOT_TYPE_STANDARD:
+ if (!gsym->final_value_is_known())
+ {
+ if (gsym->is_from_dynobj()
+ || gsym->is_undefined()
+ || gsym->is_preemptible()
+ || gsym->type() == elfcpp::STT_GNU_IFUNC)
+ rela_dyn->add_global(gsym, elfcpp::R_X86_64_GLOB_DAT,
+ this->got_, got_offset, 0);
+ else
+ rela_dyn->add_global_relative(gsym, elfcpp::R_X86_64_RELATIVE,
+ this->got_, got_offset, 0);
+ }
+ break;
+ case GOT_TYPE_TLS_OFFSET:
+ rela_dyn->add_global_relative(gsym, elfcpp::R_X86_64_TPOFF64,
+ this->got_, got_offset, 0);
+ break;
+ case GOT_TYPE_TLS_PAIR:
+ this->got_->reserve_slot(got_index + 1);
+ rela_dyn->add_global_relative(gsym, elfcpp::R_X86_64_DTPMOD64,
+ this->got_, got_offset, 0);
+ rela_dyn->add_global_relative(gsym, elfcpp::R_X86_64_DTPOFF64,
+ this->got_, got_offset + 8, 0);
+ break;
+ case GOT_TYPE_TLS_DESC:
+ this->got_->reserve_slot(got_index + 1);
+ rela_dyn->add_global_relative(gsym, elfcpp::R_X86_64_TLSDESC,
+ this->got_, got_offset, 0);
+ break;
+ default:
+ gold_unreachable();
+ }
+}
+
// Register an existing PLT entry for a global symbol.
void
unsigned int
Target_x86_64::got_mod_index_entry(Symbol_table* symtab, Layout* layout,
- Sized_relobj<64, false>* object)
+ Sized_relobj_file<64, false>* object)
{
if (this->got_mod_index_offset_ == -1U)
{
// Report an unsupported relocation against a local symbol.
void
-Target_x86_64::Scan::unsupported_reloc_local(Sized_relobj<64, false>* object,
- unsigned int r_type)
+Target_x86_64::Scan::unsupported_reloc_local(
+ Sized_relobj_file<64, false>* object,
+ unsigned int r_type)
{
gold_error(_("%s: unsupported reloc %u against local symbol"),
object->name().c_str(), r_type);
// given type against a STT_GNU_IFUNC symbol.
bool
-Target_x86_64::Scan::reloc_needs_plt_for_ifunc(Sized_relobj<64, false>* object,
- unsigned int r_type)
+Target_x86_64::Scan::reloc_needs_plt_for_ifunc(
+ Sized_relobj_file<64, false>* object,
+ unsigned int r_type)
{
int flags = Scan::get_reference_flags(r_type);
if (flags & Symbol::TLS_REF)
Target_x86_64::Scan::local(Symbol_table* symtab,
Layout* layout,
Target_x86_64* target,
- Sized_relobj<64, false>* object,
+ Sized_relobj_file<64, false>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rela<64, false>& reloc,
// Report an unsupported relocation against a global symbol.
void
-Target_x86_64::Scan::unsupported_reloc_global(Sized_relobj<64, false>* object,
- unsigned int r_type,
- Symbol* gsym)
+Target_x86_64::Scan::unsupported_reloc_global(
+ Sized_relobj_file<64, false>* object,
+ unsigned int r_type,
+ Symbol* gsym)
{
gold_error(_("%s: unsupported reloc %u against global symbol %s"),
object->name().c_str(), r_type, gsym->demangled_name().c_str());
Symbol_table* ,
Layout* ,
Target_x86_64* ,
- Sized_relobj<64, false>* ,
+ Sized_relobj_file<64, false>* ,
unsigned int ,
Output_section* ,
const elfcpp::Rela<64, false>& ,
Symbol_table*,
Layout* ,
Target_x86_64* ,
- Sized_relobj<64, false>* ,
+ Sized_relobj_file<64, false>* ,
unsigned int ,
Output_section* ,
const elfcpp::Rela<64, false>& ,
Target_x86_64::Scan::global(Symbol_table* symtab,
Layout* layout,
Target_x86_64* target,
- Sized_relobj<64, false>* object,
+ Sized_relobj_file<64, false>* object,
unsigned int data_shndx,
Output_section* output_section,
const elfcpp::Rela<64, false>& reloc,
void
Target_x86_64::gc_process_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<64, false>* object,
+ Sized_relobj_file<64, false>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
void
Target_x86_64::scan_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<64, false>* object,
+ Sized_relobj_file<64, false>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,
}
}
- const Sized_relobj<64, false>* object = relinfo->object;
+ const Sized_relobj_file<64, false>* object = relinfo->object;
// Pick the value to use for symbols defined in the PLT.
Symbol_value<64> symval;
{
Output_segment* tls_segment = relinfo->layout->tls_segment();
- const Sized_relobj<64, false>* object = relinfo->object;
+ const Sized_relobj_file<64, false>* object = relinfo->object;
const elfcpp::Elf_Xword addend = rela.get_r_addend();
elfcpp::Shdr<64, false> data_shdr(relinfo->data_shdr);
bool is_executable = (data_shdr.get_sh_flags() & elfcpp::SHF_EXECINSTR) != 0;
void
Target_x86_64::scan_relocatable_relocs(Symbol_table* symtab,
Layout* layout,
- Sized_relobj<64, false>* object,
+ Sized_relobj_file<64, false>* object,
unsigned int data_shndx,
unsigned int sh_type,
const unsigned char* prelocs,