aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog146
-rw-r--r--gold/arm.cc161
-rw-r--r--gold/copy-relocs.cc6
-rw-r--r--gold/copy-relocs.h10
-rw-r--r--gold/dynobj.h2
-rw-r--r--gold/ehframe.cc16
-rw-r--r--gold/ehframe.h8
-rw-r--r--gold/gc.h4
-rw-r--r--gold/i386.cc72
-rw-r--r--gold/incremental-dump.cc16
-rw-r--r--gold/incremental.cc166
-rw-r--r--gold/incremental.h121
-rw-r--r--gold/layout.cc54
-rw-r--r--gold/layout.h10
-rw-r--r--gold/mapfile.cc18
-rw-r--r--gold/mapfile.h4
-rw-r--r--gold/object.cc187
-rw-r--r--gold/object.h285
-rw-r--r--gold/output.cc73
-rw-r--r--gold/output.h62
-rw-r--r--gold/powerpc.cc77
-rw-r--r--gold/reloc.cc162
-rw-r--r--gold/reloc.h42
-rw-r--r--gold/sparc.cc123
-rw-r--r--gold/symtab.cc30
-rw-r--r--gold/symtab.h8
-rw-r--r--gold/target-reloc.h8
-rw-r--r--gold/target.cc4
-rw-r--r--gold/target.h24
-rw-r--r--gold/testsuite/binary_unittest.cc6
-rw-r--r--gold/testsuite/testfile.cc7
-rw-r--r--gold/x86_64.cc185
32 files changed, 1244 insertions, 853 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 315b670..2cdc273 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,149 @@
+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.
diff --git a/gold/arm.cc b/gold/arm.cc
index 541ff59..9af0e21 100644
--- a/gold/arm.cc
+++ b/gold/arm.cc
@@ -1479,14 +1479,14 @@ class Arm_exidx_input_section
// 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_(),
@@ -1657,7 +1657,7 @@ class Arm_relobj : public Sized_relobj<32, big_endian>
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);
@@ -1670,9 +1670,10 @@ class Arm_relobj : public Sized_relobj<32, big_endian>
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
@@ -1912,7 +1913,8 @@ class Arm_output_data_got : public Output_data_got<32, big_endian>
// 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));
@@ -1929,7 +1931,7 @@ class Arm_output_data_got : public Output_data_got<32, big_endian>
// 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:
@@ -1948,7 +1950,7 @@ class Arm_output_data_got : public Output_data_got<32, big_endian>
{ 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;
@@ -1979,7 +1981,7 @@ class Arm_output_data_got : public Output_data_got<32, big_endian>
}
// 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_);
@@ -2012,7 +2014,7 @@ class Arm_output_data_got : public Output_data_got<32, big_endian>
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;
@@ -2274,7 +2276,7 @@ class Target_arm : public Sized_target<32, big_endian>
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,
@@ -2288,7 +2290,7 @@ class Target_arm : public Sized_target<32, big_endian>
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,
@@ -2324,7 +2326,7 @@ class Target_arm : public Sized_target<32, big_endian>
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,
@@ -2565,7 +2567,7 @@ class Target_arm : public Sized_target<32, big_endian>
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,
@@ -2573,7 +2575,7 @@ class Target_arm : public Sized_target<32, big_endian>
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,
@@ -2581,7 +2583,7 @@ class Target_arm : public Sized_target<32, big_endian>
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>& ,
@@ -2590,7 +2592,7 @@ class Target_arm : public Sized_target<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>& ,
@@ -2598,11 +2600,11 @@ class Target_arm : public Sized_target<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
@@ -2744,7 +2746,7 @@ class Target_arm : public Sized_target<32, big_endian>
// 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>*
@@ -2775,7 +2777,7 @@ class Target_arm : public Sized_target<32, 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)
{
@@ -3208,7 +3210,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
// 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;
@@ -3230,7 +3232,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
// 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;
@@ -3252,7 +3254,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
// 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;
@@ -3271,7 +3273,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
// 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;
@@ -3290,7 +3292,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
// 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)
{
@@ -3305,7 +3307,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
// 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)
@@ -3327,7 +3329,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
// 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)
{
@@ -3349,7 +3351,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
// 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)
{
@@ -3368,7 +3370,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
// 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)
{
@@ -3425,7 +3427,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
// 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)
@@ -3447,7 +3449,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
// 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,
@@ -3471,7 +3473,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
// 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)
{
@@ -3492,7 +3494,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
// 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,
@@ -3519,7 +3521,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
// 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)
{
@@ -3539,7 +3541,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
// 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)
@@ -3593,7 +3595,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
// 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)
{
@@ -3615,7 +3617,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
// 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)
{
@@ -3700,7 +3702,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
// 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,
@@ -3757,7 +3759,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
// 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)
@@ -3795,7 +3797,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
// 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)
@@ -3833,7 +3835,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
// 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)
@@ -6340,7 +6342,7 @@ Arm_relobj<big_endian>::scan_sections_for_stubs(
// 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
@@ -6352,7 +6354,7 @@ Arm_relobj<big_endian>::do_count_local_symbols(
// 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;
@@ -6400,7 +6402,7 @@ Arm_relobj<big_endian>::do_count_local_symbols(
// 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)
{
@@ -6443,11 +6445,11 @@ Arm_relobj<big_endian>::do_relocate_sections(
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())
@@ -6683,7 +6685,7 @@ void
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.
@@ -6843,7 +6845,7 @@ Arm_relobj<big_endian>::do_gc_process_relocs(Symbol_table* symtab,
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.
@@ -6908,7 +6910,7 @@ Arm_relobj<big_endian>::update_output_local_symbol_count()
// 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();
@@ -7089,7 +7091,7 @@ template<bool big_endian>
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))
@@ -7138,7 +7140,7 @@ Arm_output_data_got<big_endian>::do_write(Output_file* of)
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());
@@ -7536,7 +7538,7 @@ unsigned int
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)
{
@@ -7702,7 +7704,7 @@ Target_arm<big_endian>::Scan::get_reference_flags(unsigned int r_type)
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"),
@@ -7770,7 +7772,7 @@ inline void
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,
@@ -8074,7 +8076,7 @@ Target_arm<big_endian>::Scan::local(Symbol_table* symtab,
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)
{
@@ -8116,7 +8118,7 @@ Target_arm<big_endian>::Scan::local_reloc_may_be_function_pointer(
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>&,
@@ -8133,7 +8135,7 @@ Target_arm<big_endian>::Scan::global_reloc_may_be_function_pointer(
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>&,
@@ -8155,7 +8157,7 @@ inline void
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,
@@ -8484,17 +8486,18 @@ Target_arm<big_endian>::Scan::global(Symbol_table* symtab,
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;
@@ -8520,7 +8523,7 @@ template<bool big_endian>
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,
@@ -9295,7 +9298,7 @@ Target_arm<big_endian>::Relocate::relocate_tls(
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);
@@ -9501,7 +9504,7 @@ void
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,
@@ -9977,9 +9980,9 @@ Target_arm<big_endian>::do_adjust_elf_header(
}
// 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*
@@ -11189,7 +11192,7 @@ Target_arm<big_endian>::scan_reloc_section_for_stubs(
// 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);
diff --git a/gold/copy-relocs.cc b/gold/copy-relocs.cc
index 4931aa0..bfdbb90 100644
--- a/gold/copy-relocs.cc
+++ b/gold/copy-relocs.cc
@@ -58,7 +58,7 @@ Copy_relocs<sh_type, size, big_endian>::copy_reloc(
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,
@@ -81,7 +81,7 @@ template<int sh_type, int size, bool big_endian>
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())
@@ -190,7 +190,7 @@ template<int sh_type, int size, bool big_endian>
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)
diff --git a/gold/copy-relocs.h b/gold/copy-relocs.h
index 2fe6a24..3fa2a61 100644
--- a/gold/copy-relocs.h
+++ b/gold/copy-relocs.h
@@ -66,7 +66,7 @@ class Copy_relocs
// 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>*);
@@ -92,7 +92,7 @@ class Copy_relocs
{
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)
@@ -110,7 +110,7 @@ class Copy_relocs
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_;
@@ -123,7 +123,7 @@ class Copy_relocs
// 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.
@@ -138,7 +138,7 @@ class Copy_relocs
// 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.
diff --git a/gold/dynobj.h b/gold/dynobj.h
index 7a626c0..c96ee2c 100644
--- a/gold/dynobj.h
+++ b/gold/dynobj.h
@@ -156,7 +156,7 @@ template<int size, bool big_endian>
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>&);
diff --git a/gold/ehframe.cc b/gold/ehframe.cc
index 2c470b0..fbeb8a3 100644
--- a/gold/ehframe.cc
+++ b/gold/ehframe.cc
@@ -525,7 +525,7 @@ Eh_frame::skip_leb128(const unsigned char** pp, const unsigned char* pend)
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,
@@ -588,7 +588,7 @@ Eh_frame::add_ehframe_input_section(
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,
@@ -675,7 +675,7 @@ Eh_frame::do_add_ehframe_input_section(
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,
@@ -929,7 +929,7 @@ Eh_frame::read_cie(Sized_relobj<size, big_endian>* object,
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,
@@ -1132,7 +1132,7 @@ Eh_frame::do_sized_write(unsigned char* oview)
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,
@@ -1146,7 +1146,7 @@ Eh_frame::add_ehframe_input_section<32, false>(
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,
@@ -1160,7 +1160,7 @@ Eh_frame::add_ehframe_input_section<32, true>(
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,
@@ -1174,7 +1174,7 @@ Eh_frame::add_ehframe_input_section<64, false>(
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,
diff --git a/gold/ehframe.h b/gold/ehframe.h
index 1690245..f626b1f 100644
--- a/gold/ehframe.h
+++ b/gold/ehframe.h
@@ -316,7 +316,7 @@ class Eh_frame : public Output_section_data
// 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,
@@ -382,7 +382,7 @@ class Eh_frame : public Output_section_data
// 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,
@@ -397,7 +397,7 @@ class Eh_frame : public Output_section_data
// 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,
@@ -413,7 +413,7 @@ class Eh_frame : public Output_section_data
// 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,
diff --git a/gold/gc.h b/gold/gc.h
index 10cdd5f..4688781 100644
--- a/gold/gc.h
+++ b/gold/gc.h
@@ -37,7 +37,7 @@ namespace gold
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;
@@ -178,7 +178,7 @@ gc_process_relocs(
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,
diff --git a/gold/i386.cc b/gold/i386.cc
index a137b2e..d60ac22 100644
--- a/gold/i386.cc
+++ b/gold/i386.cc
@@ -60,7 +60,7 @@ class Output_data_plt_i386 : public Output_section_data
// 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.
@@ -133,7 +133,7 @@ class Output_data_plt_i386 : public Output_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;
};
@@ -184,7 +184,7 @@ class Target_i386 : public Target_freebsd<32, false>
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,
@@ -198,7 +198,7 @@ class Target_i386 : public Target_freebsd<32, false>
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,
@@ -234,7 +234,7 @@ class Target_i386 : public Target_freebsd<32, false>
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,
@@ -341,7 +341,7 @@ class Target_i386 : public Target_freebsd<32, false>
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,
@@ -349,7 +349,7 @@ class Target_i386 : public Target_freebsd<32, false>
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,
@@ -358,7 +358,7 @@ class Target_i386 : public Target_freebsd<32, false>
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,
@@ -368,7 +368,7 @@ class Target_i386 : public Target_freebsd<32, false>
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,
@@ -379,13 +379,14 @@ class Target_i386 : public Target_freebsd<32, false>
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*);
};
@@ -552,7 +553,7 @@ class Target_i386 : public Target_freebsd<32, false>
// 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.
@@ -562,7 +563,7 @@ class Target_i386 : public Target_freebsd<32, false>
// 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*
@@ -583,7 +584,7 @@ class Target_i386 : public Target_freebsd<32, false>
// 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)
{
@@ -811,8 +812,9 @@ Output_data_plt_i386::add_entry(Symbol* gsym)
// 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_;
@@ -1046,7 +1048,7 @@ Target_i386::make_plt_entry(Symbol_table* symtab, Layout* layout, Symbol* gsym)
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))
@@ -1122,7 +1124,7 @@ Target_i386::define_tls_base_symbol(Symbol_table* symtab, Layout* layout)
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)
{
@@ -1268,7 +1270,7 @@ Target_i386::Scan::get_reference_flags(unsigned int r_type)
// 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"),
@@ -1279,8 +1281,9 @@ Target_i386::Scan::unsupported_reloc_local(Sized_relobj<32, false>* object,
// 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)
@@ -1295,7 +1298,7 @@ inline void
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,
@@ -1597,9 +1600,10 @@ Target_i386::Scan::local(Symbol_table* symtab,
// 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());
@@ -1629,7 +1633,7 @@ Target_i386::Scan::local_reloc_may_be_function_pointer(
Symbol_table* ,
Layout* ,
Target_i386* ,
- Sized_relobj<32, false>* ,
+ Sized_relobj_file<32, false>* ,
unsigned int ,
Output_section* ,
const elfcpp::Rel<32, false>& ,
@@ -1644,7 +1648,7 @@ Target_i386::Scan::global_reloc_may_be_function_pointer(
Symbol_table* ,
Layout* ,
Target_i386* ,
- Sized_relobj<32, false>* ,
+ Sized_relobj_file<32, false>* ,
unsigned int ,
Output_section* ,
const elfcpp::Rel<32, false>& ,
@@ -1660,7 +1664,7 @@ inline void
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,
@@ -2025,7 +2029,7 @@ Target_i386::Scan::global(Symbol_table* symtab,
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,
@@ -2056,7 +2060,7 @@ Target_i386::gc_process_relocs(Symbol_table* symtab,
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,
@@ -2187,7 +2191,7 @@ Target_i386::Relocate::relocate(const Relocate_info<32, false>* relinfo,
}
}
- 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;
@@ -2388,7 +2392,7 @@ Target_i386::Relocate::relocate_tls(const Relocate_info<32, false>* relinfo,
{
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);
@@ -3066,7 +3070,7 @@ Target_i386::Relocatable_size_for_reloc::get_size_for_reloc(
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,
diff --git a/gold/incremental-dump.cc b/gold/incremental-dump.cc
index eecf8a8..c1e2530 100644
--- a/gold/incremental-dump.cc
+++ b/gold/incremental-dump.cc
@@ -149,6 +149,10 @@ dump_incremental_inputs(const char* argv0, const char* filename,
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");
@@ -368,24 +372,26 @@ dump_incremental_inputs(const char* argv0, const char* filename,
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");
}
diff --git a/gold/incremental.cc b/gold/incremental.cc
index b831b97..d49c8a5 100644
--- a/gold/incremental.cc
+++ b/gold/incremental.cc
@@ -276,6 +276,7 @@ Sized_incremental_binary<size, big_endian>::setup_readers()
// 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);
@@ -327,10 +328,6 @@ Sized_incremental_binary<size, big_endian>::setup_readers()
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;
}
@@ -524,8 +521,6 @@ Sized_incremental_binary<size, big_endian>::do_reserve_layout(
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;
@@ -579,29 +574,31 @@ Sized_incremental_binary<size, big_endian>::do_process_got_plt(
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);
}
}
@@ -1146,8 +1143,8 @@ Output_section_incremental_inputs<size, big_endian>::set_final_data_size()
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));
@@ -1216,7 +1213,7 @@ Output_section_incremental_inputs<size, big_endian>::set_final_data_size()
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);
}
@@ -1393,11 +1390,15 @@ Output_section_incremental_inputs<size, big_endian>::write_info_blocks(
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
@@ -1592,11 +1593,14 @@ struct Got_plt_view_info
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.
@@ -1621,8 +1625,9 @@ class Local_got_offset_visitor : public Got_offset_list::Visitor
// 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:
@@ -1652,8 +1657,9 @@ class Global_got_offset_visitor : public Got_offset_list::Visitor
// 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:
@@ -1680,7 +1686,8 @@ class Global_symbol_visitor_got_plt
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);
}
@@ -1719,7 +1726,7 @@ Output_section_incremental_inputs<size, big_endian>::write_got_plt(
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);
@@ -1745,7 +1752,7 @@ Output_section_incremental_inputs<size, big_endian>::write_got_plt(
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);
}
@@ -1755,35 +1762,35 @@ Output_section_incremental_inputs<size, big_endian>::write_got_plt(
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();
}
@@ -1792,7 +1799,7 @@ Sized_incr_relobj<size, big_endian>::do_read_symbols(Read_symbols_data*)
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*)
@@ -1802,7 +1809,7 @@ Sized_incr_relobj<size, big_endian>::do_layout(
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 =
@@ -1815,7 +1822,7 @@ Sized_incr_relobj<size, big_endian>::do_layout(
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);
}
}
@@ -1823,7 +1830,7 @@ Sized_incr_relobj<size, big_endian>::do_layout(
// 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*)
{
}
@@ -1831,7 +1838,7 @@ Sized_incr_relobj<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*)
@@ -1916,7 +1923,7 @@ Sized_incr_relobj<size, big_endian>::do_add_symbols(
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*,
@@ -1929,29 +1936,18 @@ Sized_incr_relobj<size, big_endian>::do_should_include_member(
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();
}
@@ -1960,7 +1956,7 @@ Sized_incr_relobj<size, big_endian>::do_section_size(unsigned int)
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();
}
@@ -1969,7 +1965,7 @@ Sized_incr_relobj<size, big_endian>::do_section_name(unsigned int)
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();
}
@@ -1978,7 +1974,7 @@ Sized_incr_relobj<size, big_endian>::do_section_contents(unsigned int)
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();
}
@@ -1987,7 +1983,7 @@ Sized_incr_relobj<size, big_endian>::do_section_flags(unsigned int)
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();
}
@@ -1996,7 +1992,7 @@ Sized_incr_relobj<size, big_endian>::do_section_entsize(unsigned int)
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();
}
@@ -2005,7 +2001,7 @@ Sized_incr_relobj<size, big_endian>::do_section_address(unsigned int)
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();
}
@@ -2014,7 +2010,7 @@ Sized_incr_relobj<size, big_endian>::do_section_type(unsigned int)
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();
}
@@ -2023,7 +2019,7 @@ Sized_incr_relobj<size, big_endian>::do_section_link(unsigned int)
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();
}
@@ -2032,7 +2028,7 @@ Sized_incr_relobj<size, big_endian>::do_section_info(unsigned int)
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();
}
@@ -2041,7 +2037,7 @@ Sized_incr_relobj<size, big_endian>::do_section_addralign(unsigned int)
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();
}
@@ -2050,7 +2046,7 @@ Sized_incr_relobj<size, big_endian>::do_initialize_xindex()
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();
@@ -2060,7 +2056,7 @@ Sized_incr_relobj<size, big_endian>::do_get_global_symbol_counts(
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*)
{
}
@@ -2069,7 +2065,7 @@ Sized_incr_relobj<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*)
{
@@ -2080,7 +2076,7 @@ Sized_incr_relobj<size, big_endian>::do_gc_process_relocs(Symbol_table*,
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*)
{
@@ -2125,7 +2121,7 @@ Sized_incr_relobj<size, big_endian>::do_scan_relocs(Symbol_table*,
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>*)
{
@@ -2166,7 +2162,7 @@ Sized_incr_relobj<size, big_endian>::do_count_local_symbols(
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*)
@@ -2180,7 +2176,7 @@ Sized_incr_relobj<size, big_endian>::do_finalize_local_symbols(
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.
@@ -2191,7 +2187,7 @@ Sized_incr_relobj<size, big_endian>::do_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;
}
@@ -2204,7 +2200,7 @@ Sized_incr_relobj<size, big_endian>::do_set_local_dynsym_offset(off_t)
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)
{
@@ -2330,7 +2326,7 @@ Sized_incr_relobj<size, big_endian>::do_relocate(const Symbol_table*,
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)
{
}
@@ -2617,7 +2613,7 @@ make_sized_incremental_object(
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;
@@ -2631,7 +2627,7 @@ make_sized_incremental_object(
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;
@@ -2645,7 +2641,7 @@ make_sized_incremental_object(
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;
@@ -2659,7 +2655,7 @@ make_sized_incremental_object(
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;
@@ -2705,7 +2701,7 @@ template
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>;
@@ -2716,7 +2712,7 @@ template
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>;
@@ -2727,7 +2723,7 @@ template
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>;
@@ -2738,7 +2734,7 @@ template
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>;
diff --git a/gold/incremental.h b/gold/incremental.h
index 5c0f937..3935186 100644
--- a/gold/incremental.h
+++ b/gold/incremental.h
@@ -736,7 +736,7 @@ class Incremental_inputs_reader
|| 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);
}
@@ -777,6 +777,26 @@ class Incremental_inputs_reader
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
@@ -847,7 +867,7 @@ class Incremental_inputs_reader
{
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);
@@ -865,7 +885,7 @@ class Incremental_inputs_reader
|| 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);
@@ -1064,7 +1084,7 @@ class Incremental_got_plt_reader
{
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.
@@ -1088,11 +1108,18 @@ class Incremental_got_plt_reader
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.
@@ -1358,6 +1385,9 @@ class Incremental_binary
};
template<int size, bool big_endian>
+class Sized_relobj_incr;
+
+template<int size, bool big_endian>
class Sized_incremental_binary : public Incremental_binary
{
public:
@@ -1365,38 +1395,29 @@ 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.
@@ -1537,10 +1558,9 @@ class Sized_incremental_binary : public Incremental_binary
// 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_;
@@ -1566,44 +1586,22 @@ class Sized_incremental_binary : public Incremental_binary
// 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
@@ -1671,11 +1669,6 @@ class Sized_incr_relobj : public Sized_relobj_base<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.
- 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);
@@ -1801,10 +1794,6 @@ class Sized_incr_relobj : public Sized_relobj_base<size, big_endian>
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.
diff --git a/gold/layout.cc b/gold/layout.cc
index 66d30d9..d4b9f18 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -510,7 +510,7 @@ is_compressed_debug_section(const char* secname)
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)
@@ -880,7 +880,7 @@ Layout::init_fixed_output_section(const char* name,
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)
{
@@ -968,7 +968,7 @@ Layout::layout(Sized_relobj<size, big_endian>* object, unsigned int shndx,
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,
@@ -1035,7 +1035,7 @@ Layout::layout_reloc(Sized_relobj<size, big_endian>* object,
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,
@@ -1085,7 +1085,7 @@ Layout::layout_group(Symbol_table* symtab,
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,
@@ -4787,7 +4787,8 @@ Layout::init_fixed_output_section<64, true>(
#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*);
@@ -4796,7 +4797,8 @@ Layout::layout<32, false>(Sized_relobj<32, false>* object, unsigned int shndx,
#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*);
@@ -4805,7 +4807,8 @@ Layout::layout<32, true>(Sized_relobj<32, true>* object, unsigned int shndx,
#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*);
@@ -4814,7 +4817,8 @@ Layout::layout<64, false>(Sized_relobj<64, false>* object, unsigned int shndx,
#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*);
@@ -4823,7 +4827,7 @@ Layout::layout<64, true>(Sized_relobj<64, true>* object, unsigned int shndx,
#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,
@@ -4833,7 +4837,7 @@ Layout::layout_reloc<32, false>(Sized_relobj<32, false>* object,
#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,
@@ -4843,7 +4847,7 @@ Layout::layout_reloc<32, true>(Sized_relobj<32, true>* object,
#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,
@@ -4853,7 +4857,7 @@ Layout::layout_reloc<64, false>(Sized_relobj<64, false>* object,
#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,
@@ -4864,7 +4868,7 @@ Layout::layout_reloc<64, true>(Sized_relobj<64, true>* object,
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,
@@ -4877,7 +4881,7 @@ Layout::layout_group<32, false>(Symbol_table* symtab,
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,
@@ -4890,7 +4894,7 @@ Layout::layout_group<32, true>(Symbol_table* symtab,
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,
@@ -4903,7 +4907,7 @@ Layout::layout_group<64, false>(Symbol_table* symtab,
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,
@@ -4915,7 +4919,7 @@ Layout::layout_group<64, true>(Symbol_table* symtab,
#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,
@@ -4930,9 +4934,9 @@ Layout::layout_eh_frame<32, false>(Sized_relobj<32, false>* object,
#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,
@@ -4945,7 +4949,7 @@ Layout::layout_eh_frame<32, true>(Sized_relobj<32, true>* object,
#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,
@@ -4960,9 +4964,9 @@ Layout::layout_eh_frame<64, false>(Sized_relobj<64, false>* object,
#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,
diff --git a/gold/layout.h b/gold/layout.h
index 907181f..ced07b5 100644
--- a/gold/layout.h
+++ b/gold/layout.h
@@ -488,7 +488,7 @@ class Layout
// 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);
@@ -510,7 +510,7 @@ class Layout
// 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,
@@ -520,7 +520,7 @@ class Layout
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,
@@ -539,7 +539,7 @@ class Layout
// 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,
@@ -958,7 +958,7 @@ class Layout
// 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
diff --git a/gold/mapfile.cc b/gold/mapfile.cc
index 0cde51e..2062ae4 100644
--- a/gold/mapfile.cc
+++ b/gold/mapfile.cc
@@ -202,7 +202,7 @@ Mapfile::print_memory_map_header()
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();
@@ -273,8 +273,8 @@ Mapfile::print_input_section(Relobj* relobj, unsigned int shndx)
#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;
@@ -282,8 +282,8 @@ Mapfile::print_input_section(Relobj* relobj, unsigned int shndx)
#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;
@@ -291,8 +291,8 @@ Mapfile::print_input_section(Relobj* relobj, unsigned int shndx)
#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;
@@ -300,8 +300,8 @@ Mapfile::print_input_section(Relobj* relobj, unsigned int shndx)
#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;
diff --git a/gold/mapfile.h b/gold/mapfile.h
index 908a208..808fc66 100644
--- a/gold/mapfile.h
+++ b/gold/mapfile.h
@@ -33,7 +33,7 @@ class Archive;
class Symbol;
class Relobj;
template<int size, bool big_endian>
-class Sized_relobj;
+class Sized_relobj_file;
class Output_section;
class Output_data;
@@ -100,7 +100,7 @@ class Mapfile
// 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.
diff --git a/gold/object.cc b/gold/object.cc
index a39a37c..1160f0c 100644
--- a/gold/object.cc
+++ b/gold/object.cc
@@ -189,7 +189,7 @@ Object::section_contents(unsigned int shndx, section_size_type* plen,
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>
@@ -374,13 +374,35 @@ Relobj::finalize_incremental_relocs(Layout* layout, bool clear_counts)
// 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),
@@ -391,7 +413,6 @@ Sized_relobj<size, big_endian>::Sized_relobj(
local_symbol_offset_(0),
local_dynsym_offset_(0),
local_values_(),
- local_got_offsets_(),
local_plt_offsets_(),
kept_comdat_sections_(),
has_eh_frame_(false),
@@ -403,7 +424,7 @@ Sized_relobj<size, big_endian>::Sized_relobj(
}
template<int size, bool big_endian>
-Sized_relobj<size, big_endian>::~Sized_relobj()
+Sized_relobj_file<size, big_endian>::~Sized_relobj_file()
{
}
@@ -412,7 +433,7 @@ Sized_relobj<size, big_endian>::~Sized_relobj()
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);
@@ -425,7 +446,7 @@ Sized_relobj<size, big_endian>::do_setup()
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;
@@ -474,7 +495,7 @@ Sized_relobj<size, big_endian>::find_symtab(const unsigned char* pshdrs)
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());
@@ -487,7 +508,7 @@ Sized_relobj<size, big_endian>::do_initialize_xindex()
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
@@ -499,7 +520,7 @@ Sized_relobj<size, big_endian>::check_eh_frame_flags(
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
@@ -536,7 +557,7 @@ build_compressed_section_map(
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;
@@ -574,7 +595,7 @@ build_compressed_section_map(
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);
@@ -677,9 +698,9 @@ Sized_relobj<size, big_endian>::do_read_symbols(Read_symbols_data* 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_,
@@ -703,7 +724,7 @@ Sized_relobj<size, big_endian>::symbol_section_and_value(unsigned int sym,
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,
@@ -916,7 +937,7 @@ Sized_relobj<size, big_endian>::include_section_group(
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,
@@ -988,12 +1009,12 @@ Sized_relobj<size, big_endian>::include_linkonce_section(
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,
@@ -1001,9 +1022,9 @@ Sized_relobj<size, big_endian>::layout_section(Layout* layout,
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
@@ -1028,9 +1049,9 @@ Sized_relobj<size, big_endian>::layout_section(Layout* layout,
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()
@@ -1151,7 +1172,7 @@ Sized_relobj<size, big_endian>::do_layout(Symbol_table* symtab,
}
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)
{
@@ -1552,7 +1573,7 @@ Sized_relobj<size, big_endian>::do_layout(Symbol_table* symtab,
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;
@@ -1575,7 +1596,7 @@ Sized_relobj<size, big_endian>::do_layout_deferred_sections(Layout* layout)
// 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();
@@ -1607,9 +1628,9 @@ Sized_relobj<size, big_endian>::do_layout_deferred_sections(Layout* layout)
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)
{
@@ -1650,10 +1671,11 @@ Sized_relobj<size, big_endian>::do_add_symbols(Symbol_table* symtab,
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;
@@ -1699,7 +1721,7 @@ Sized_relobj<size, big_endian>::do_should_include_member(Symbol_table* symtab,
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)
{
@@ -1720,31 +1742,12 @@ Sized_relobj<size, big_endian>::do_for_all_global_symbols(
}
}
-// 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);
@@ -1755,7 +1758,7 @@ Sized_relobj<size, big_endian>::local_has_plt_offset(unsigned int symndx) const
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);
@@ -1767,8 +1770,8 @@ Sized_relobj<size, big_endian>::local_plt_offset(unsigned int symndx) const
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));
@@ -1783,8 +1786,8 @@ Sized_relobj<size, big_endian>::set_local_plt_offset(unsigned int symndx,
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)
@@ -1932,8 +1935,8 @@ Sized_relobj<size, big_endian>::do_count_local_symbols(Stringpool* pool,
// 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,
@@ -1982,8 +1985,8 @@ Sized_relobj<size, big_endian>::compute_final_local_value_internal(
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);
@@ -2085,8 +2088,8 @@ Sized_relobj<size, big_endian>::compute_final_local_value_internal(
// 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,
@@ -2095,7 +2098,7 @@ Sized_relobj<size, big_endian>::compute_final_local_value(
// 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);
@@ -2108,9 +2111,10 @@ Sized_relobj<size, big_endian>::compute_final_local_value(
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)));
@@ -2119,7 +2123,7 @@ Sized_relobj<size, big_endian>::do_finalize_local_symbols(unsigned int index,
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)
{
@@ -2153,7 +2157,8 @@ Sized_relobj<size, big_endian>::do_finalize_local_symbols(unsigned int index,
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)
@@ -2174,7 +2179,7 @@ Sized_relobj<size, big_endian>::do_set_local_dynsym_indexes(unsigned int index)
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;
@@ -2186,7 +2191,7 @@ Sized_relobj<size, big_endian>::do_set_local_dynsym_offset(off_t 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)
@@ -2205,7 +2210,7 @@ Sized_relobj<size, big_endian>::do_section_flags(unsigned int shndx)
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);
@@ -2220,7 +2225,7 @@ Sized_relobj<size, big_endian>::do_section_entsize(unsigned int shndx)
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,
@@ -2370,7 +2375,7 @@ Sized_relobj<size, big_endian>::write_local_symbols(
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)
@@ -2445,8 +2450,8 @@ Sized_relobj<size, big_endian>::get_symbol_location_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
{
@@ -2454,8 +2459,8 @@ Sized_relobj<size, big_endian>::map_to_kept_section(
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)
@@ -2472,7 +2477,7 @@ Sized_relobj<size, big_endian>::map_to_kept_section(
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
@@ -2851,22 +2856,22 @@ Object::read_section_data<64, true>(elfcpp::Elf_file<64, true, Object>*,
#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
diff --git a/gold/object.h b/gold/object.h
index dc56136..d9be4b5 100644
--- a/gold/object.h
+++ b/gold/object.h
@@ -834,7 +834,7 @@ class Object
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>
@@ -916,7 +916,7 @@ class Object
};
// 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
{
@@ -929,7 +929,9 @@ 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
@@ -1022,6 +1024,25 @@ class Relobj : public Object
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)
@@ -1262,6 +1283,10 @@ class Relobj : public Object
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
@@ -1379,7 +1404,7 @@ class Symbol_value
// 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;
@@ -1678,37 +1703,155 @@ typedef std::map<unsigned int, section_size_type> Compressed_section_map;
// 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;
@@ -1723,22 +1866,27 @@ class Sized_relobj : public Sized_relobj_base<size, big_endian>
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
@@ -1818,47 +1966,6 @@ class Sized_relobj : public Sized_relobj_base<size, big_endian>
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;
@@ -1872,17 +1979,6 @@ class Sized_relobj : public Sized_relobj_base<size, big_endian>
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.
@@ -1913,7 +2009,7 @@ class Sized_relobj : public Sized_relobj_base<size, big_endian>
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.
@@ -1961,11 +2057,6 @@ class Sized_relobj : public Sized_relobj_base<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.
- void
- do_for_all_local_got_entries(Got_offset_list::Visitor* v) const;
-
// Read the relocs.
void
do_read_relocs(Read_relocs_data*);
@@ -2061,27 +2152,6 @@ class Sized_relobj : public Sized_relobj_base<size, big_endian>
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)
@@ -2161,7 +2231,7 @@ class Sized_relobj : public Sized_relobj_base<size, big_endian>
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;
@@ -2369,10 +2439,6 @@ class Sized_relobj : public Sized_relobj_base<size, big_endian>
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;
@@ -2416,15 +2482,8 @@ class Sized_relobj : public Sized_relobj_base<size, big_endian>
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.
@@ -2548,7 +2607,7 @@ struct Relocate_info
// 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.
diff --git a/gold/output.cc b/gold/output.cc
index c3053db..6555830 100644
--- a/gold/output.cc
+++ b/gold/output.cc
@@ -941,10 +941,13 @@ set_needs_dynsym_index()
default:
{
const unsigned int lsi = this->local_sym_index_;
+ Sized_relobj_file<size, big_endian>* relobj =
+ this->u1_.relobj->sized_relobj();
+ gold_assert(relobj != NULL);
if (!this->is_section_symbol_)
- this->u1_.relobj->set_needs_output_dynsym_entry(lsi);
+ relobj->set_needs_output_dynsym_entry(lsi);
else
- this->u1_.relobj->output_section(lsi)->set_needs_dynsym_index();
+ relobj->output_section(lsi)->set_needs_dynsym_index();
}
break;
}
@@ -994,16 +997,19 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::get_symbol_index()
default:
{
const unsigned int lsi = this->local_sym_index_;
+ Sized_relobj_file<size, big_endian>* relobj =
+ this->u1_.relobj->sized_relobj();
+ gold_assert(relobj != NULL);
if (!this->is_section_symbol_)
{
if (dynamic)
- index = this->u1_.relobj->dynsym_index(lsi);
+ index = relobj->dynsym_index(lsi);
else
- index = this->u1_.relobj->symtab_index(lsi);
+ index = relobj->symtab_index(lsi);
}
else
{
- Output_section* os = this->u1_.relobj->output_section(lsi);
+ Output_section* os = relobj->output_section(lsi);
gold_assert(os != NULL);
if (dynamic)
index = os->dynsym_index();
@@ -1038,7 +1044,10 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::
if (offset != invalid_address)
return offset + addend;
// This is a merge section.
- offset = os->output_address(this->u1_.relobj, lsi, addend);
+ Sized_relobj_file<size, big_endian>* relobj =
+ this->u1_.relobj->sized_relobj();
+ gold_assert(relobj != NULL);
+ offset = os->output_address(relobj, lsi, addend);
gold_assert(offset != invalid_address);
return offset;
}
@@ -1059,8 +1068,10 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::get_address() const
address += os->address() + off;
else
{
- address = os->output_address(this->u2_.relobj, this->shndx_,
- address);
+ Sized_relobj_file<size, big_endian>* relobj =
+ this->u2_.relobj->sized_relobj();
+ gold_assert(relobj != NULL);
+ address = os->output_address(relobj, this->shndx_, address);
gold_assert(address != invalid_address);
}
}
@@ -1113,8 +1124,11 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::symbol_value(
&& this->local_sym_index_ != 0
&& !this->is_section_symbol_);
const unsigned int lsi = this->local_sym_index_;
- const Symbol_value<size>* symval = this->u1_.relobj->local_symbol(lsi);
- return symval->value(this->u1_.relobj, addend);
+ Sized_relobj_file<size, big_endian>* relobj =
+ this->u1_.relobj->sized_relobj();
+ gold_assert(relobj != NULL);
+ const Symbol_value<size>* symval = relobj->local_symbol(lsi);
+ return symval->value(relobj, addend);
}
// Reloc comparison. This function sorts the dynamic relocs for the
@@ -1265,7 +1279,7 @@ Output_relocatable_relocs<sh_type, size, big_endian>::set_final_data_size()
template<int size, bool big_endian>
Output_data_group<size, big_endian>::Output_data_group(
- Sized_relobj<size, big_endian>* relobj,
+ Sized_relobj_file<size, big_endian>* relobj,
section_size_type entry_count,
elfcpp::Elf_Word flags,
std::vector<unsigned int>* input_shndxes)
@@ -1367,7 +1381,7 @@ Output_data_got<size, big_endian>::Got_entry::write(unsigned char* pov) const
default:
{
- const Sized_relobj<size, big_endian>* object = this->u_.object;
+ const Sized_relobj_file<size, big_endian>* object = this->u_.object;
const unsigned int lsi = this->local_sym_index_;
const Symbol_value<size>* symval = object->local_symbol(lsi);
if (!this->use_plt_offset_)
@@ -1505,7 +1519,7 @@ Output_data_got<size, big_endian>::add_global_pair_with_rela(
template<int size, bool big_endian>
bool
Output_data_got<size, big_endian>::add_local(
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int symndx,
unsigned int got_type)
{
@@ -1523,7 +1537,7 @@ Output_data_got<size, big_endian>::add_local(
template<int size, bool big_endian>
bool
Output_data_got<size, big_endian>::add_local_plt(
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int symndx,
unsigned int got_type)
{
@@ -1542,7 +1556,7 @@ Output_data_got<size, big_endian>::add_local_plt(
template<int size, bool big_endian>
void
Output_data_got<size, big_endian>::add_local_with_rel(
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int symndx,
unsigned int got_type,
Rel_dyn* rel_dyn,
@@ -1559,7 +1573,7 @@ Output_data_got<size, big_endian>::add_local_with_rel(
template<int size, bool big_endian>
void
Output_data_got<size, big_endian>::add_local_with_rela(
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int symndx,
unsigned int got_type,
Rela_dyn* rela_dyn,
@@ -1579,7 +1593,7 @@ Output_data_got<size, big_endian>::add_local_with_rela(
template<int size, bool big_endian>
void
Output_data_got<size, big_endian>::add_local_pair_with_rel(
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int symndx,
unsigned int shndx,
unsigned int got_type,
@@ -1604,7 +1618,7 @@ Output_data_got<size, big_endian>::add_local_pair_with_rel(
template<int size, bool big_endian>
void
Output_data_got<size, big_endian>::add_local_pair_with_rela(
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int symndx,
unsigned int shndx,
unsigned int got_type,
@@ -1630,21 +1644,26 @@ Output_data_got<size, big_endian>::add_local_pair_with_rela(
template<int size, bool big_endian>
void
-Output_data_got<size, big_endian>::reserve_slot(unsigned int i)
+Output_data_got<size, big_endian>::reserve_local(
+ unsigned int i,
+ Sized_relobj<size, big_endian>* object,
+ unsigned int sym_index,
+ unsigned int got_type)
{
- this->free_list_.remove(i * size / 8, (i + 1) * size / 8);
+ this->reserve_slot(i);
+ object->set_local_got_offset(sym_index, got_type, this->got_offset(i));
}
// Reserve a slot in the GOT for a global symbol.
template<int size, bool big_endian>
void
-Output_data_got<size, big_endian>::reserve_slot_for_global(
+Output_data_got<size, big_endian>::reserve_global(
unsigned int i,
Symbol* gsym,
unsigned int got_type)
{
- this->free_list_.remove(i * size / 8, (i + 1) * size / 8);
+ this->reserve_slot(i);
gsym->set_got_offset(got_type, this->got_offset(i));
}
@@ -2189,7 +2208,7 @@ Output_section::set_entsize(uint64_t v)
template<int size, bool big_endian>
off_t
Output_section::add_input_section(Layout* layout,
- Sized_relobj<size, big_endian>* object,
+ Sized_relobj_file<size, big_endian>* object,
unsigned int shndx,
const char* secname,
const elfcpp::Shdr<size, big_endian>& shdr,
@@ -4821,7 +4840,7 @@ template
off_t
Output_section::add_input_section<32, false>(
Layout* layout,
- Sized_relobj<32, false>* object,
+ Sized_relobj_file<32, false>* object,
unsigned int shndx,
const char* secname,
const elfcpp::Shdr<32, false>& shdr,
@@ -4834,7 +4853,7 @@ template
off_t
Output_section::add_input_section<32, true>(
Layout* layout,
- Sized_relobj<32, true>* object,
+ Sized_relobj_file<32, true>* object,
unsigned int shndx,
const char* secname,
const elfcpp::Shdr<32, true>& shdr,
@@ -4847,7 +4866,7 @@ template
off_t
Output_section::add_input_section<64, false>(
Layout* layout,
- Sized_relobj<64, false>* object,
+ Sized_relobj_file<64, false>* object,
unsigned int shndx,
const char* secname,
const elfcpp::Shdr<64, false>& shdr,
@@ -4860,7 +4879,7 @@ template
off_t
Output_section::add_input_section<64, true>(
Layout* layout,
- Sized_relobj<64, true>* object,
+ Sized_relobj_file<64, true>* object,
unsigned int shndx,
const char* secname,
const elfcpp::Shdr<64, true>& shdr,
diff --git a/gold/output.h b/gold/output.h
index 418f016..8ca3598 100644
--- a/gold/output.h
+++ b/gold/output.h
@@ -46,6 +46,8 @@ template<int size, bool big_endian>
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.
@@ -1119,6 +1121,16 @@ class Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>
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;
@@ -1325,6 +1337,12 @@ class Output_reloc<elfcpp::SHT_RELA, dynamic, size, big_endian>
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;
@@ -1437,6 +1455,9 @@ class Output_data_reloc_base : public Output_data_reloc_generic
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:
@@ -1819,9 +1840,9 @@ class Output_data_reloc<elfcpp::SHT_RELA, dynamic, size, big_endian>
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));
@@ -1910,7 +1931,7 @@ class Output_data_group : public Output_section_data
{
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);
@@ -1930,7 +1951,7 @@ class Output_data_group : public Output_section_data
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.
@@ -2002,37 +2023,38 @@ class Output_data_got : public Output_section_data_build
// 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);
@@ -2046,13 +2068,19 @@ class Output_data_got : public Output_section_data_build
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.
@@ -2080,7 +2108,7 @@ class Output_data_got : public Output_section_data_build
{ 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)
{
@@ -2112,7 +2140,7 @@ class Output_data_got : public Output_section_data_build
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.
@@ -2608,7 +2636,7 @@ class Output_section : public Output_data
// 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);
diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index 661477a..c113bd2 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -67,7 +67,7 @@ class Target_powerpc : public Sized_target<size, big_endian>
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,
@@ -81,7 +81,7 @@ class Target_powerpc : public Sized_target<size, big_endian>
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,
@@ -116,7 +116,7 @@ class Target_powerpc : public Sized_target<size, big_endian>
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,
@@ -193,7 +193,7 @@ class Target_powerpc : public Sized_target<size, big_endian>
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,
@@ -201,7 +201,7 @@ class Target_powerpc : public Sized_target<size, big_endian>
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,
@@ -210,7 +210,7 @@ class Target_powerpc : public Sized_target<size, big_endian>
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>& ,
@@ -221,7 +221,7 @@ class Target_powerpc : public Sized_target<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,
@@ -231,11 +231,11 @@ class Target_powerpc : public Sized_target<size, big_endian>
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
@@ -313,7 +313,7 @@ class Target_powerpc : public Sized_target<size, big_endian>
// 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>*
@@ -330,7 +330,7 @@ class Target_powerpc : public Sized_target<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)
{
@@ -496,7 +496,7 @@ private:
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)
{
@@ -517,7 +517,7 @@ private:
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)
{
@@ -539,7 +539,7 @@ private:
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)
@@ -559,7 +559,7 @@ private:
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)
@@ -578,7 +578,7 @@ public:
// 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)
@@ -587,7 +587,7 @@ public:
// 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)
@@ -599,7 +599,7 @@ public:
// 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)
@@ -617,7 +617,7 @@ public:
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); }
@@ -640,7 +640,7 @@ public:
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); }
@@ -656,7 +656,7 @@ public:
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)
{
@@ -684,7 +684,7 @@ public:
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)
{
@@ -702,7 +702,7 @@ public:
// 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)
@@ -711,7 +711,7 @@ public:
// 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)
@@ -720,7 +720,7 @@ public:
// 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)
@@ -734,7 +734,7 @@ public:
// 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)
@@ -1068,9 +1068,10 @@ Target_powerpc<size, big_endian>::plt_entry_size() const
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)
{
@@ -1176,7 +1177,7 @@ Target_powerpc<size, big_endian>::Scan::get_reference_flags(
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"),
@@ -1284,7 +1285,7 @@ Target_powerpc<size, big_endian>::Scan::local(
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,
@@ -1402,7 +1403,7 @@ Target_powerpc<size, big_endian>::Scan::local(
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)
{
@@ -1418,7 +1419,7 @@ Target_powerpc<size, big_endian>::Scan::global(
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,
@@ -1609,7 +1610,7 @@ void
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,
@@ -1644,7 +1645,7 @@ void
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,
@@ -1756,7 +1757,7 @@ Target_powerpc<size, big_endian>::Relocate::relocate(
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
@@ -1959,7 +1960,7 @@ Target_powerpc<size, big_endian>::Relocate::relocate_tls(
{
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);
@@ -2033,7 +2034,7 @@ void
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,
diff --git a/gold/reloc.cc b/gold/reloc.cc
index c58e42b..97ed337 100644
--- a/gold/reloc.cc
+++ b/gold/reloc.cc
@@ -258,7 +258,7 @@ Relocate_task::get_name() const
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();
@@ -269,7 +269,7 @@ Sized_relobj<size, big_endian>::do_read_relocs(Read_relocs_data* rd)
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,
@@ -380,9 +380,9 @@ Sized_relobj<size, big_endian>::do_read_relocs(Read_relocs_data* rd)
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>();
@@ -420,7 +420,7 @@ Sized_relobj<size, big_endian>::do_gc_process_relocs(Symbol_table* symtab,
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)
{
@@ -537,7 +537,7 @@ class Emit_relocs_strategy
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,
@@ -564,7 +564,7 @@ Sized_relobj<size, big_endian>::emit_relocs_scan(
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,
@@ -590,7 +590,7 @@ Sized_relobj<size, big_endian>::emit_relocs_scan_reltype(
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)
@@ -608,7 +608,7 @@ Sized_relobj<size, big_endian>::incremental_relocs_scan(
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;
@@ -638,9 +638,9 @@ Sized_relobj<size, big_endian>::incremental_relocs_scan_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();
@@ -709,13 +709,13 @@ struct Read_multiple_compare
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;
@@ -888,7 +888,7 @@ Sized_relobj<size, big_endian>::write_sections(const unsigned char* pshdrs,
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,
@@ -900,7 +900,7 @@ Sized_relobj<size, big_endian>::do_relocate_sections(
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;
@@ -1024,7 +1024,7 @@ Sized_relobj<size, big_endian>::do_relocate_sections(
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,
@@ -1061,7 +1061,7 @@ Sized_relobj<size, big_endian>::emit_relocs(
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,
@@ -1093,7 +1093,7 @@ Sized_relobj<size, big_endian>::emit_relocs_reltype(
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,
@@ -1129,7 +1129,7 @@ Sized_relobj<size, big_endian>::incremental_relocs_write(
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,
@@ -1215,7 +1215,7 @@ Sized_relobj<size, big_endian>::incremental_relocs_write_reltype(
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)
@@ -1229,7 +1229,7 @@ Sized_relobj<size, big_endian>::initialize_input_to_output_maps()
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)
@@ -1247,7 +1247,7 @@ Sized_relobj<size, big_endian>::free_input_to_output_maps()
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,
@@ -1279,7 +1279,7 @@ Sized_relobj<size, big_endian>::split_stack_adjust(
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,
@@ -1436,10 +1436,10 @@ Sized_relobj<size, big_endian>::split_stack_adjust_reltype(
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
@@ -1636,127 +1636,127 @@ Track_relocs<size, big_endian>::advance(off_t offset)
#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,
@@ -1767,7 +1767,7 @@ Sized_relobj<32, false>::do_relocate_sections(
#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,
@@ -1778,7 +1778,7 @@ Sized_relobj<32, true>::do_relocate_sections(
#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,
@@ -1789,7 +1789,7 @@ Sized_relobj<64, false>::do_relocate_sections(
#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,
@@ -1800,41 +1800,41 @@ Sized_relobj<64, true>::do_relocate_sections(
#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)
diff --git a/gold/reloc.h b/gold/reloc.h
index 87e70cc..3a33c9b 100644
--- a/gold/reloc.h
+++ b/gold/reloc.h
@@ -47,7 +47,7 @@ template<int size>
class Sized_symbol;
template<int size, bool big_endian>
-class Sized_relobj;
+class Sized_relobj_file;
template<int size>
class Symbol_value;
@@ -337,7 +337,7 @@ private:
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;
@@ -365,7 +365,7 @@ private:
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)
{
@@ -395,7 +395,7 @@ private:
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)
{
@@ -425,7 +425,7 @@ private:
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)
@@ -447,7 +447,7 @@ public:
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); }
@@ -458,7 +458,7 @@ public:
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); }
@@ -472,7 +472,7 @@ public:
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); }
@@ -486,7 +486,7 @@ public:
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)
@@ -500,7 +500,7 @@ public:
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); }
@@ -511,7 +511,7 @@ public:
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); }
@@ -525,7 +525,7 @@ public:
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); }
@@ -540,7 +540,7 @@ public:
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)
@@ -554,7 +554,7 @@ public:
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); }
@@ -565,7 +565,7 @@ public:
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); }
@@ -579,7 +579,7 @@ public:
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); }
@@ -594,7 +594,7 @@ public:
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)
@@ -608,7 +608,7 @@ public:
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); }
@@ -620,7 +620,7 @@ public:
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); }
@@ -634,7 +634,7 @@ public:
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); }
@@ -649,7 +649,7 @@ public:
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)
diff --git a/gold/sparc.cc b/gold/sparc.cc
index 84614bd..080a480 100644
--- a/gold/sparc.cc
+++ b/gold/sparc.cc
@@ -69,7 +69,7 @@ class Target_sparc : public Sized_target<size, big_endian>
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,
@@ -83,7 +83,7 @@ class Target_sparc : public Sized_target<size, big_endian>
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,
@@ -118,7 +118,7 @@ class Target_sparc : public Sized_target<size, big_endian>
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,
@@ -203,7 +203,7 @@ class Target_sparc : public Sized_target<size, big_endian>
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,
@@ -211,7 +211,7 @@ class Target_sparc : public Sized_target<size, big_endian>
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,
@@ -220,7 +220,7 @@ class Target_sparc : public Sized_target<size, big_endian>
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>& ,
@@ -231,7 +231,7 @@ class Target_sparc : public Sized_target<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,
@@ -242,11 +242,11 @@ class Target_sparc : public Sized_target<size, big_endian>
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
@@ -324,7 +324,7 @@ class Target_sparc : public Sized_target<size, big_endian>
// 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.
@@ -352,7 +352,7 @@ class Target_sparc : public Sized_target<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)
{
@@ -472,7 +472,7 @@ private:
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)
{
@@ -493,7 +493,7 @@ private:
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)
{
@@ -516,7 +516,7 @@ private:
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)
@@ -536,7 +536,7 @@ private:
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)
@@ -556,7 +556,7 @@ public:
// 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)
@@ -568,7 +568,7 @@ public:
// 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)
@@ -580,7 +580,7 @@ public:
// 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)
@@ -592,7 +592,7 @@ public:
// 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)
@@ -615,7 +615,7 @@ public:
// 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)
@@ -627,7 +627,7 @@ public:
// 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)
@@ -648,7 +648,7 @@ public:
// 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)
{
@@ -658,7 +658,7 @@ public:
// 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)
@@ -679,7 +679,7 @@ public:
// 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)
{
@@ -689,7 +689,7 @@ public:
// 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)
@@ -701,7 +701,7 @@ public:
// 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)
@@ -722,7 +722,7 @@ public:
// 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)
{
@@ -741,7 +741,7 @@ public:
// 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)
{
@@ -751,7 +751,7 @@ public:
// 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)
{
@@ -761,7 +761,7 @@ public:
// 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)
{
@@ -771,7 +771,7 @@ public:
// 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)
{
@@ -782,7 +782,7 @@ public:
// 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)
@@ -794,7 +794,7 @@ public:
// 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)
@@ -806,7 +806,7 @@ public:
// 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)
@@ -818,7 +818,7 @@ public:
// 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)
@@ -830,7 +830,7 @@ public:
// 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)
{
@@ -840,7 +840,7 @@ public:
// 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)
{
@@ -850,7 +850,7 @@ public:
// 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)
{
@@ -860,7 +860,7 @@ public:
// 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)
{
@@ -870,7 +870,7 @@ public:
// 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)
@@ -882,7 +882,7 @@ public:
// 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)
{
@@ -892,7 +892,7 @@ public:
// 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)
@@ -904,7 +904,7 @@ public:
// 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)
{
@@ -914,7 +914,7 @@ public:
// 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)
{
@@ -924,7 +924,7 @@ public:
// 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)
{
@@ -934,7 +934,7 @@ public:
// 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)
{
@@ -944,7 +944,7 @@ public:
// 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)
{
@@ -1001,7 +1001,7 @@ public:
// 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)
{
@@ -1042,7 +1042,7 @@ public:
// 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)
{
@@ -1490,9 +1490,10 @@ Target_sparc<size, big_endian>::plt_entry_size() const
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)
{
@@ -1709,7 +1710,7 @@ Target_sparc<size, big_endian>::Scan::generate_tls_call(Symbol_table* symtab,
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"),
@@ -1816,7 +1817,7 @@ Target_sparc<size, big_endian>::Scan::local(
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,
@@ -2104,7 +2105,7 @@ Target_sparc<size, big_endian>::Scan::local(
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)
{
@@ -2120,7 +2121,7 @@ Target_sparc<size, big_endian>::Scan::global(
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,
@@ -2498,7 +2499,7 @@ void
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,
@@ -2533,7 +2534,7 @@ void
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,
@@ -2636,7 +2637,7 @@ Target_sparc<size, big_endian>::Relocate::relocate(
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
@@ -2979,7 +2980,7 @@ Target_sparc<size, big_endian>::Relocate::relocate_tls(
{
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();
@@ -3392,7 +3393,7 @@ void
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,
diff --git a/gold/symtab.cc b/gold/symtab.cc
index 3880ce1..a1ce3b7 100644
--- a/gold/symtab.cc
+++ b/gold/symtab.cc
@@ -1048,13 +1048,13 @@ Symbol_table::add_from_object(Object* object,
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;
@@ -1304,7 +1304,7 @@ Symbol_table::add_from_dynobj(
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;
@@ -3295,13 +3295,13 @@ Sized_symbol<64>::allocate_common(Output_data*, Value_type);
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
@@ -3309,13 +3309,13 @@ Symbol_table::add_from_relobj<32, false>(
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
@@ -3323,13 +3323,13 @@ Symbol_table::add_from_relobj<32, true>(
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
@@ -3337,13 +3337,13 @@ Symbol_table::add_from_relobj<64, false>(
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
@@ -3399,7 +3399,7 @@ Symbol_table::add_from_dynobj<32, false>(
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
@@ -3415,7 +3415,7 @@ Symbol_table::add_from_dynobj<32, true>(
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
@@ -3431,7 +3431,7 @@ Symbol_table::add_from_dynobj<64, false>(
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
@@ -3447,7 +3447,7 @@ Symbol_table::add_from_dynobj<64, true>(
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
diff --git a/gold/symtab.h b/gold/symtab.h
index 4196138..87e7099 100644
--- a/gold/symtab.h
+++ b/gold/symtab.h
@@ -42,7 +42,7 @@ class Mapfile;
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;
@@ -1309,11 +1309,11 @@ class Symbol_table
// *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.
@@ -1335,7 +1335,7 @@ class 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
diff --git a/gold/target-reloc.h b/gold/target-reloc.h
index 17c9c99..fc832dc 100644
--- a/gold/target-reloc.h
+++ b/gold/target-reloc.h
@@ -46,7 +46,7 @@ scan_relocs(
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,
@@ -213,7 +213,7 @@ relocate_section(
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;
@@ -475,7 +475,7 @@ void
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,
@@ -570,7 +570,7 @@ relocate_for_relocatable(
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;
diff --git a/gold/target.cc b/gold/target.cc
index 2c0cbbf..0e329cd 100644
--- a/gold/target.cc
+++ b/gold/target.cc
@@ -74,8 +74,8 @@ Target::do_make_elf_object_implementation(
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;
}
diff --git a/gold/target.h b/gold/target.h
index 6b25d5f..19e975d 100644
--- a/gold/target.h
+++ b/gold/target.h
@@ -45,6 +45,8 @@ class Object;
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;
@@ -642,7 +644,7 @@ class Sized_target : public Target
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,
@@ -667,7 +669,7 @@ class Sized_target : public Target
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,
@@ -706,7 +708,7 @@ class Sized_target : public Target
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,
@@ -807,6 +809,22 @@ class Sized_target : public Target
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.
diff --git a/gold/testsuite/binary_unittest.cc b/gold/testsuite/binary_unittest.cc
index 8e95062..a9f47c2 100644
--- a/gold/testsuite/binary_unittest.cc
+++ b/gold/testsuite/binary_unittest.cc
@@ -95,9 +95,9 @@ Sized_binary_test()
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);
diff --git a/gold/testsuite/testfile.cc b/gold/testsuite/testfile.cc
index 7f53792..228077a 100644
--- a/gold/testsuite/testfile.cc
+++ b/gold/testsuite/testfile.cc
@@ -44,13 +44,14 @@ class Target_test : public Sized_target<size, big_endian>
{ }
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"); }
@@ -64,7 +65,7 @@ class Target_test : public Sized_target<size, big_endian>
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*)
diff --git a/gold/x86_64.cc b/gold/x86_64.cc
index 9b9a3b1..a447d38 100644
--- a/gold/x86_64.cc
+++ b/gold/x86_64.cc
@@ -85,7 +85,7 @@ class Output_data_plt_x86_64 : public Output_section_data
// 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.
@@ -239,7 +239,7 @@ class Target_x86_64 : public Target_freebsd<64, false>
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,
@@ -253,7 +253,7 @@ class Target_x86_64 : public Target_freebsd<64, false>
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,
@@ -289,7 +289,7 @@ class Target_x86_64 : public Target_freebsd<64, false>
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,
@@ -390,6 +390,20 @@ class Target_x86_64 : public Target_freebsd<64, false>
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
@@ -408,7 +422,7 @@ class Target_x86_64 : public Target_freebsd<64, false>
// 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;
@@ -428,7 +442,7 @@ class Target_x86_64 : public Target_freebsd<64, false>
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,
@@ -436,7 +450,7 @@ class Target_x86_64 : public Target_freebsd<64, false>
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,
@@ -445,7 +459,7 @@ class Target_x86_64 : public Target_freebsd<64, false>
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,
@@ -455,7 +469,7 @@ class Target_x86_64 : public Target_freebsd<64, false>
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,
@@ -464,10 +478,10 @@ class Target_x86_64 : public Target_freebsd<64, false>
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
@@ -477,7 +491,8 @@ class Target_x86_64 : public Target_freebsd<64, false>
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_;
@@ -626,7 +641,7 @@ class Target_x86_64 : public Target_freebsd<64, false>
// 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.
@@ -640,7 +655,7 @@ class Target_x86_64 : public Target_freebsd<64, false>
// 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*
@@ -661,7 +676,7 @@ class Target_x86_64 : public Target_freebsd<64, false>
// 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)
{
@@ -692,12 +707,12 @@ class Target_x86_64 : public Target_freebsd<64, false>
// 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;
};
@@ -921,8 +936,9 @@ Output_data_plt_x86_64::add_entry(Symbol* gsym)
// 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_;
@@ -1168,7 +1184,7 @@ Target_x86_64::make_plt_entry(Symbol_table* symtab, Layout* layout,
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))
@@ -1261,9 +1277,101 @@ Target_x86_64::init_got_plt_for_update(Symbol_table* symtab,
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
@@ -1331,7 +1439,7 @@ Target_x86_64::reserve_tlsdesc_entries(Symbol_table* symtab,
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)
{
@@ -1472,8 +1580,9 @@ Target_x86_64::Scan::get_reference_flags(unsigned int r_type)
// 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);
@@ -1537,8 +1646,9 @@ Target_x86_64::Scan::check_non_pic(Relobj* object, unsigned int 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)
@@ -1553,7 +1663,7 @@ inline void
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,
@@ -1848,9 +1958,10 @@ Target_x86_64::Scan::local(Symbol_table* symtab,
// 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());
@@ -1888,7 +1999,7 @@ Target_x86_64::Scan::local_reloc_may_be_function_pointer(
Symbol_table* ,
Layout* ,
Target_x86_64* ,
- Sized_relobj<64, false>* ,
+ Sized_relobj_file<64, false>* ,
unsigned int ,
Output_section* ,
const elfcpp::Rela<64, false>& ,
@@ -1911,7 +2022,7 @@ Target_x86_64::Scan::global_reloc_may_be_function_pointer(
Symbol_table*,
Layout* ,
Target_x86_64* ,
- Sized_relobj<64, false>* ,
+ Sized_relobj_file<64, false>* ,
unsigned int ,
Output_section* ,
const elfcpp::Rela<64, false>& ,
@@ -1933,7 +2044,7 @@ inline void
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,
@@ -2277,7 +2388,7 @@ Target_x86_64::Scan::global(Symbol_table* symtab,
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,
@@ -2314,7 +2425,7 @@ Target_x86_64::gc_process_relocs(Symbol_table* symtab,
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,
@@ -2425,7 +2536,7 @@ Target_x86_64::Relocate::relocate(const Relocate_info<64, false>* relinfo,
}
}
- 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;
@@ -2673,7 +2784,7 @@ Target_x86_64::Relocate::relocate_tls(const Relocate_info<64, false>* relinfo,
{
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;
@@ -3278,7 +3389,7 @@ Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc(
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,