summaryrefslogtreecommitdiff
path: root/gold/symtab.h
diff options
context:
space:
mode:
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 8da9e6dcfbf..bd417948cd3 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