diff options
Diffstat (limited to 'gold/output.cc')
-rw-r--r-- | gold/output.cc | 118 |
1 files changed, 22 insertions, 96 deletions
diff --git a/gold/output.cc b/gold/output.cc index 7633c73..6e46fd5 100644 --- a/gold/output.cc +++ b/gold/output.cc @@ -1387,11 +1387,13 @@ Output_data_got<size, big_endian>::Got_entry::write(unsigned char* pov) const default: { - const Sized_relobj_file<size, big_endian>* object = this->u_.object; + const Relobj* 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_) - val = symval->value(this->u_.object, 0); + { + uint64_t lval = object->local_symbol_value(lsi, 0); + val = convert_types<Valtype, uint64_t>(lval); + } else { uint64_t plt_address = @@ -1448,23 +1450,7 @@ void Output_data_got<size, big_endian>::add_global_with_rel( Symbol* gsym, unsigned int got_type, - Rel_dyn* rel_dyn, - unsigned int r_type) -{ - if (gsym->has_got_offset(got_type)) - return; - - unsigned int got_offset = this->add_got_entry(Got_entry()); - gsym->set_got_offset(got_type, got_offset); - rel_dyn->add_global(gsym, r_type, this, got_offset); -} - -template<int size, bool big_endian> -void -Output_data_got<size, big_endian>::add_global_with_rela( - Symbol* gsym, - unsigned int got_type, - Rela_dyn* rela_dyn, + Output_data_reloc_generic* rel_dyn, unsigned int r_type) { if (gsym->has_got_offset(got_type)) @@ -1472,7 +1458,7 @@ Output_data_got<size, big_endian>::add_global_with_rela( unsigned int got_offset = this->add_got_entry(Got_entry()); gsym->set_got_offset(got_type, got_offset); - rela_dyn->add_global(gsym, r_type, this, got_offset, 0); + rel_dyn->add_global_generic(gsym, r_type, this, got_offset, 0); } // Add a pair of entries for a global symbol to the GOT, and add @@ -1483,27 +1469,7 @@ void Output_data_got<size, big_endian>::add_global_pair_with_rel( Symbol* gsym, unsigned int got_type, - Rel_dyn* rel_dyn, - unsigned int r_type_1, - unsigned int r_type_2) -{ - if (gsym->has_got_offset(got_type)) - return; - - unsigned int got_offset = this->add_got_entry_pair(Got_entry(), Got_entry()); - gsym->set_got_offset(got_type, got_offset); - rel_dyn->add_global(gsym, r_type_1, this, got_offset); - - if (r_type_2 != 0) - rel_dyn->add_global(gsym, r_type_2, this, got_offset + size / 8); -} - -template<int size, bool big_endian> -void -Output_data_got<size, big_endian>::add_global_pair_with_rela( - Symbol* gsym, - unsigned int got_type, - Rela_dyn* rela_dyn, + Output_data_reloc_generic* rel_dyn, unsigned int r_type_1, unsigned int r_type_2) { @@ -1512,10 +1478,11 @@ Output_data_got<size, big_endian>::add_global_pair_with_rela( unsigned int got_offset = this->add_got_entry_pair(Got_entry(), Got_entry()); gsym->set_got_offset(got_type, got_offset); - rela_dyn->add_global(gsym, r_type_1, this, got_offset, 0); + rel_dyn->add_global_generic(gsym, r_type_1, this, got_offset, 0); if (r_type_2 != 0) - rela_dyn->add_global(gsym, r_type_2, this, got_offset + size / 8, 0); + rel_dyn->add_global_generic(gsym, r_type_2, this, + got_offset + size / 8, 0); } // Add an entry for a local symbol to the GOT. This returns true if @@ -1525,7 +1492,7 @@ Output_data_got<size, big_endian>::add_global_pair_with_rela( template<int size, bool big_endian> bool Output_data_got<size, big_endian>::add_local( - Sized_relobj_file<size, big_endian>* object, + Relobj* object, unsigned int symndx, unsigned int got_type) { @@ -1543,7 +1510,7 @@ Output_data_got<size, big_endian>::add_local( template<int size, bool big_endian> bool Output_data_got<size, big_endian>::add_local_plt( - Sized_relobj_file<size, big_endian>* object, + Relobj* object, unsigned int symndx, unsigned int got_type) { @@ -1562,27 +1529,10 @@ Output_data_got<size, big_endian>::add_local_plt( template<int size, bool big_endian> void Output_data_got<size, big_endian>::add_local_with_rel( - Sized_relobj_file<size, big_endian>* object, - unsigned int symndx, - unsigned int got_type, - Rel_dyn* rel_dyn, - unsigned int r_type) -{ - if (object->local_has_got_offset(symndx, got_type)) - return; - - unsigned int got_offset = this->add_got_entry(Got_entry()); - object->set_local_got_offset(symndx, got_type, got_offset); - rel_dyn->add_local(object, symndx, r_type, this, got_offset); -} - -template<int size, bool big_endian> -void -Output_data_got<size, big_endian>::add_local_with_rela( - Sized_relobj_file<size, big_endian>* object, + Relobj* object, unsigned int symndx, unsigned int got_type, - Rela_dyn* rela_dyn, + Output_data_reloc_generic* rel_dyn, unsigned int r_type) { if (object->local_has_got_offset(symndx, got_type)) @@ -1590,7 +1540,7 @@ Output_data_got<size, big_endian>::add_local_with_rela( unsigned int got_offset = this->add_got_entry(Got_entry()); object->set_local_got_offset(symndx, got_type, got_offset); - rela_dyn->add_local(object, symndx, r_type, this, got_offset, 0); + rel_dyn->add_local_generic(object, symndx, r_type, this, got_offset, 0); } // Add a pair of entries for a local symbol to the GOT, and add @@ -1599,36 +1549,11 @@ Output_data_got<size, big_endian>::add_local_with_rela( template<int size, bool big_endian> void Output_data_got<size, big_endian>::add_local_pair_with_rel( - Sized_relobj_file<size, big_endian>* object, - unsigned int symndx, - unsigned int shndx, - unsigned int got_type, - Rel_dyn* rel_dyn, - unsigned int r_type_1, - unsigned int r_type_2) -{ - if (object->local_has_got_offset(symndx, got_type)) - return; - - unsigned int got_offset = - this->add_got_entry_pair(Got_entry(), - Got_entry(object, symndx, false)); - object->set_local_got_offset(symndx, got_type, got_offset); - Output_section* os = object->output_section(shndx); - rel_dyn->add_output_section(os, r_type_1, this, got_offset); - - if (r_type_2 != 0) - rel_dyn->add_output_section(os, r_type_2, this, got_offset + size / 8); -} - -template<int size, bool big_endian> -void -Output_data_got<size, big_endian>::add_local_pair_with_rela( - Sized_relobj_file<size, big_endian>* object, + Relobj* object, unsigned int symndx, unsigned int shndx, unsigned int got_type, - Rela_dyn* rela_dyn, + Output_data_reloc_generic* rel_dyn, unsigned int r_type_1, unsigned int r_type_2) { @@ -1640,10 +1565,11 @@ Output_data_got<size, big_endian>::add_local_pair_with_rela( Got_entry(object, symndx, false)); object->set_local_got_offset(symndx, got_type, got_offset); Output_section* os = object->output_section(shndx); - rela_dyn->add_output_section(os, r_type_1, this, got_offset, 0); + rel_dyn->add_output_section_generic(os, r_type_1, this, got_offset, 0); if (r_type_2 != 0) - rela_dyn->add_output_section(os, r_type_2, this, got_offset + size / 8, 0); + rel_dyn->add_output_section_generic(os, r_type_2, this, + got_offset + size / 8, 0); } // Reserve a slot in the GOT for a local symbol or the second slot of a pair. @@ -1652,7 +1578,7 @@ template<int size, bool big_endian> void Output_data_got<size, big_endian>::reserve_local( unsigned int i, - Sized_relobj<size, big_endian>* object, + Relobj* object, unsigned int sym_index, unsigned int got_type) { |