summaryrefslogtreecommitdiff
path: root/gold/symtab.h
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2008-03-25 18:37:16 +0000
committerCary Coutant <ccoutant@google.com>2008-03-25 18:37:16 +0000
commit0a65a3a7402d9b8523844366c638a0354f48dfa4 (patch)
tree38d2a9a2cbf1277091cd8de1f92c3e6871156407 /gold/symtab.h
parent403fe1979f7a9e128d3904731e709fadbf60ea81 (diff)
* i386.cc (Target_i386::Got_type): New enum declaration.
(Target_i386::Scan::local): Updated callers of Output_data_got member functions. (Target_i386::Scan::global): Likewise. (Target_i386::Relocate::relocate): Likewise. (Target_i386::Relocate::relocate_tls): Likewise. * object.h (Got_offset_list): New class. (Sized_relobj::local_has_got_offset): Added got_type parameter. (Sized_relobj::local_got_offset): Likewise. (Sized_relobj::set_local_got_offset): Likewise. (Sized_relobj::local_has_tls_got_offset): Removed. (Sized_relobj::local_tls_got_offset): Removed. (Sized_relobj::set_local_tls_got_offset): Removed. (Sized_relobj::Local_got_offsets): Changed to store a list of offsets. * output.cc (Output_data_got::add_global): Added got_type parameter. (Output_data_got::add_global_with_rel): Likewise. (Output_data_got::add_global_with_rela): Likewise. (Output_data_got::add_global_pair_with_rel): New function. (Output_data_got::add_global_pair_with_rela): New function. (Output_data_got::add_local): Added got_type parameter. (Output_data_got::add_local_with_rel): Likewise. (Output_data_got::add_local_with_rela): Likewise. (Output_data_got::add_local_pair_with_rel): New function. (Output_data_got::add_local_pair_with_rela): New function. (Output_data_got::add_global_tls): Removed. (Output_data_got::add_global_tls_with_rel): Removed. (Output_data_got::add_global_tls_with_rela): Removed. (Output_data_got::add_local_tls): Removed. (Output_data_got::add_local_tls_with_rel): Removed. (Output_data_got::add_local_tls_with_rela): Removed. * output.h (Output_data_got::add_global): Added got_type parameter. (Output_data_got::add_global_with_rel): Likewise. (Output_data_got::add_global_with_rela): Likewise. (Output_data_got::add_global_pair_with_rel): New function. (Output_data_got::add_global_pair_with_rela): New function. (Output_data_got::add_local): Added got_type parameter. (Output_data_got::add_local_with_rel): Likewise. (Output_data_got::add_local_with_rela): Likewise. (Output_data_got::add_local_pair_with_rel): New function. (Output_data_got::add_local_pair_with_rela): New function. (Output_data_got::add_global_tls): Removed. (Output_data_got::add_global_tls_with_rel): Removed. (Output_data_got::add_global_tls_with_rela): Removed. (Output_data_got::add_local_tls): Removed. (Output_data_got::add_local_tls_with_rel): Removed. (Output_data_got::add_local_tls_with_rela): Removed. * resolve.cc (Symbol::override_base_with_special): Removed reference to has_got_offset_ field. * symtab.cc (Symbol::init_fields): Replaced initialization of got_offset_ with got_offsets_. Removed initialization of has_got_offset_ *symtab.h (Symbol::has_got_offset): Aded got_type parameter. (Symbol::got_offset): Likewise. (Symbol::set_got_offset): Likewise. (Symbol::has_tls_got_offset): Removed. (Symbol::tls_got_offset): Removed. (Symbol::set_tls_got_offset): Removed. (Symbol::got_offset_): Removed. (Symbol::tls_mod_got_offset_): Removed. (Symbol::tls_pair_got_offset_): Removed. (Symbol::got_offsets_): New field. (Symbol::has_got_offset): Removed. (Symbol::has_tls_mod_got_offset): Removed. (Symbol::has_tls_pair_got_offset): Removed. * x86_64.cc (Target_x86_64::Got_type): New enum declaration. (Target_x86_64::Scan::local): Updated callers of Output_data_got member functions. (Target_x86_64::Scan::global): Likewise. (Target_x86_64::Relocate::relocate): Likewise. (Target_x86_64::Relocate::relocate_tls): Likewise.
Diffstat (limited to 'gold/symtab.h')
-rw-r--r--gold/symtab.h73
1 files changed, 13 insertions, 60 deletions
diff --git a/gold/symtab.h b/gold/symtab.h
index 8da9e6dcfb..bd417948cd 100644
--- a/gold/symtab.h
+++ b/gold/symtab.h
@@ -323,53 +323,22 @@ class Symbol
// Return whether this symbol has an entry in the GOT section.
// For a TLS symbol, this GOT entry will hold its tp-relative offset.
bool
- has_got_offset() const
- { return this->has_got_offset_; }
+ has_got_offset(unsigned int got_type) const
+ { return this->got_offsets_.get_offset(got_type) != -1U; }
// Return the offset into the GOT section of this symbol.
unsigned int
- got_offset() const
+ got_offset(unsigned int got_type) const
{
- gold_assert(this->has_got_offset());
- return this->got_offset_;
+ unsigned int got_offset = this->got_offsets_.get_offset(got_type);
+ gold_assert(got_offset != -1U);
+ return got_offset;
}
// Set the GOT offset of this symbol.
void
- set_got_offset(unsigned int got_offset)
- {
- this->has_got_offset_ = true;
- this->got_offset_ = got_offset;
- }
-
- // Return whether this TLS symbol has an entry in the GOT section for
- // its module index or, if NEED_PAIR is true, has a pair of entries
- // for its module index and dtv-relative offset.
- bool
- has_tls_got_offset(bool need_pair) const
- {
- return (this->has_tls_mod_got_offset_
- && (!need_pair || this->has_tls_pair_got_offset_));
- }
-
- // Return the offset into the GOT section for this symbol's TLS module
- // index or, if NEED_PAIR is true, for the pair of entries for the
- // module index and dtv-relative offset.
- unsigned int
- tls_got_offset(bool need_pair) const
- {
- gold_assert(this->has_tls_got_offset(need_pair));
- return this->tls_mod_got_offset_;
- }
-
- // Set the GOT offset of this symbol.
- void
- set_tls_got_offset(unsigned int got_offset, bool have_pair)
- {
- this->has_tls_mod_got_offset_ = true;
- this->has_tls_pair_got_offset_ = have_pair;
- this->tls_mod_got_offset_ = got_offset;
- }
+ set_got_offset(unsigned int got_type, unsigned int got_offset)
+ { this->got_offsets_.set_offset(got_type, got_offset); }
// Return whether this symbol has an entry in the PLT section.
bool
@@ -719,18 +688,11 @@ class Symbol
unsigned int dynsym_index_;
// If this symbol has an entry in the GOT section (has_got_offset_
- // is true), this is the offset from the start of the GOT section.
- // For a TLS symbol, if has_tls_tpoff_got_offset_ is true, this
- // serves as the GOT offset for the GOT entry that holds its
- // TP-relative offset.
- unsigned int got_offset_;
-
- // If this is a TLS symbol and has an entry in the GOT section
- // for a module index or a pair of entries (module index,
- // dtv-relative offset), these are the offsets from the start
- // of the GOT section.
- unsigned int tls_mod_got_offset_;
- unsigned int tls_pair_got_offset_;
+ // is true), this holds the offset from the start of the GOT section.
+ // A symbol may have more than one GOT offset (e.g., when mixing
+ // modules compiled with two different TLS models), but will usually
+ // have at most one.
+ Got_offset_list got_offsets_;
// If this symbol has an entry in the PLT section (has_plt_offset_
// is true), then this is the offset from the start of the PLT
@@ -769,15 +731,6 @@ class Symbol
bool in_reg_ : 1;
// True if we've seen this symbol in a dynamic object.
bool in_dyn_ : 1;
- // True if the symbol has an entry in the GOT section.
- // For a TLS symbol, this GOT entry will hold its tp-relative offset.
- bool has_got_offset_ : 1;
- // True if the symbol has an entry in the GOT section for its
- // module index.
- bool has_tls_mod_got_offset_ : 1;
- // True if the symbol has a pair of entries in the GOT section for its
- // module index and dtv-relative offset.
- bool has_tls_pair_got_offset_ : 1;
// True if the symbol has an entry in the PLT section.
bool has_plt_offset_ : 1;
// True if this is a dynamic symbol which needs a special value in