diff options
author | Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com> | 2015-12-03 15:29:17 -0800 |
---|---|---|
committer | Cary Coutant <ccoutant@gmail.com> | 2015-12-03 15:29:17 -0800 |
commit | 7ef8ae7c5f352bb1ef166af0fe6a09a3d3b39f67 (patch) | |
tree | 26bf34449c9d504a4b6dfcf872eafa655ef80a92 /gold/output.h | |
parent | e58c48b4c81f25ec08174f324990d021aad0e96e (diff) | |
download | gdb-7ef8ae7c5f352bb1ef166af0fe6a09a3d3b39f67.zip gdb-7ef8ae7c5f352bb1ef166af0fe6a09a3d3b39f67.tar.gz gdb-7ef8ae7c5f352bb1ef166af0fe6a09a3d3b39f67.tar.bz2 |
Take addend into account when making GOT entries for local symbols.
gold/
* object.cc (Sized_relobj::do_for_all_local_got_entries): Use
Local_got_entry_key for searching in local_got_offsets_.
* object.h (class Local_got_entry_key): New class.
(Relobj::local_has_got_offset): New overloaded method.
(Relobj::local_got_offset): Likewise.
(Relobj::set_local_got_offset): Likewise.
(Relobj::do_local_has_got_offset): Add addend argument.
(Relobj::do_local_got_offset): Likewise.
(Relobj::do_set_local_got_offset): Likewise.
(Sized_relobj::do_local_has_got_offset): Add addend argument, and use
Local_got_entry_key for searching through local_got_offsets_.
(Sized_relobj::do_local_got_offset): Likewise.
(Sized_relobj::do_set_local_got_offset): Likewise.
(Sized_relobj::Local_got_offsets): Change type of the key from
unsigned int to Local_got_entry_key, and add hash and equal_to.
* output.cc (Got_entry::write): Take addend into account for
calculating value of the local symbol for GOT.
(Output_data_got::add_local): New definition of overloaded method.
(Output_data_got::add_local_with_rel): Likewise.
(Output_data_got::add_local_pair_with_rel): Likewise.
* output.h (Output_data_got::add_local): New declaration of overloaded
method.
Diffstat (limited to 'gold/output.h')
-rw-r--r-- | gold/output.h | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/gold/output.h b/gold/output.h index c7ad54e..5b8c01c 100644 --- a/gold/output.h +++ b/gold/output.h @@ -2335,6 +2335,13 @@ class Output_data_got : public Output_data_got_base bool add_local(Relobj* object, unsigned int sym_index, unsigned int got_type); + // Add an entry for a local symbol plus ADDEND to the GOT. This returns + // true if this is a new GOT entry, false if the symbol already has a GOT + // entry. + bool + add_local(Relobj* object, unsigned int sym_index, unsigned int got_type, + uint64_t addend); + // Like add_local, but use the PLT offset of the local symbol if it // has one. bool @@ -2353,6 +2360,13 @@ class Output_data_got : public Output_data_got_base unsigned int got_type, Output_data_reloc_generic* rel_dyn, unsigned int r_type); + // Add an entry for a local symbol plus ADDEND to the GOT, and add a dynamic + // relocation of type R_TYPE for the GOT entry. + void + add_local_with_rel(Relobj* object, unsigned int sym_index, + unsigned int got_type, Output_data_reloc_generic* rel_dyn, + unsigned int r_type, uint64_t addend); + // Add a pair of entries for a local symbol to the GOT, and add // a dynamic relocation of type R_TYPE using the section symbol of // the output section to which input section SHNDX maps, on the first. @@ -2364,6 +2378,17 @@ class Output_data_got : public Output_data_got_base Output_data_reloc_generic* rel_dyn, unsigned int r_type); + // Add a pair of entries for a local symbol plus ADDEND to the GOT, and add + // a dynamic relocation of type R_TYPE using the section symbol of + // the output section to which input section SHNDX maps, on the first. + // The first got entry will have a value of zero, the second the + // value of the local symbol. + void + add_local_pair_with_rel(Relobj* object, unsigned int sym_index, + unsigned int shndx, unsigned int got_type, + Output_data_reloc_generic* rel_dyn, + unsigned int r_type, uint64_t addend); + // Add a pair of entries for a local symbol to the GOT, and add // a dynamic relocation of type R_TYPE using STN_UNDEF on the first. // The first got entry will have a value of zero, the second the @@ -2434,20 +2459,21 @@ class Output_data_got : public Output_data_got_base public: // Create a zero entry. Got_entry() - : local_sym_index_(RESERVED_CODE), use_plt_or_tls_offset_(false) + : local_sym_index_(RESERVED_CODE), use_plt_or_tls_offset_(false), + addend_(0) { this->u_.constant = 0; } // Create a global symbol entry. Got_entry(Symbol* gsym, bool use_plt_or_tls_offset) : local_sym_index_(GSYM_CODE), - use_plt_or_tls_offset_(use_plt_or_tls_offset) + use_plt_or_tls_offset_(use_plt_or_tls_offset), addend_(0) { this->u_.gsym = gsym; } // Create a local symbol entry. Got_entry(Relobj* object, unsigned int local_sym_index, bool use_plt_or_tls_offset) : local_sym_index_(local_sym_index), - use_plt_or_tls_offset_(use_plt_or_tls_offset) + use_plt_or_tls_offset_(use_plt_or_tls_offset), addend_(0) { gold_assert(local_sym_index != GSYM_CODE && local_sym_index != CONSTANT_CODE @@ -2456,6 +2482,19 @@ class Output_data_got : public Output_data_got_base this->u_.object = object; } + // Create a local symbol entry plus addend. + Got_entry(Relobj* object, unsigned int local_sym_index, + bool use_plt_or_tls_offset, uint64_t addend) + : local_sym_index_(local_sym_index), + use_plt_or_tls_offset_(use_plt_or_tls_offset), addend_(addend) + { + gold_assert(local_sym_index != GSYM_CODE + && local_sym_index != CONSTANT_CODE + && local_sym_index != RESERVED_CODE + && local_sym_index == this->local_sym_index_); + this->u_.object = object; + } + // Create a constant entry. The constant is a host value--it will // be swapped, if necessary, when it is written out. explicit Got_entry(Valtype constant) @@ -2489,6 +2528,8 @@ class Output_data_got : public Output_data_got_base // Whether to use the PLT offset of the symbol if it has one. // For TLS symbols, whether to offset the symbol value. bool use_plt_or_tls_offset_ : 1; + // The addend. + uint64_t addend_; }; typedef std::vector<Got_entry> Got_entries; |