aboutsummaryrefslogtreecommitdiff
path: root/gold/object.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-08-05 14:32:56 +0930
committerAlan Modra <amodra@gmail.com>2021-09-18 08:20:11 +0930
commit912697efc15768894c13a9370a2fcaa950f24558 (patch)
tree5f1c97e1870cee187d20fbdbca17d605e18c12e5 /gold/object.h
parent6bc2c6ee80c32462a120927b0a3d1a828769f045 (diff)
downloadfsf-binutils-gdb-912697efc15768894c13a9370a2fcaa950f24558.zip
fsf-binutils-gdb-912697efc15768894c13a9370a2fcaa950f24558.tar.gz
fsf-binutils-gdb-912697efc15768894c13a9370a2fcaa950f24558.tar.bz2
[GOLD] Got_offset_list: addend field
This is the first in a series of patches aimed at supporting GOT entries against symbol plus addend generally for PowerPC64 rather than just section symbol plus addend as gold has currently. This patch adds an addend field to Got_offset_list, so that both local and global symbols can have GOT entries with addend. PR 28192 * object.h (Got_offset_list): Add addend_ field, init in both constructors. Adjust all accessors to suit. (Sized_relobj::do_local_has_got_offset): Adjust to suit. (Sized_relobj::do_local_got_offset): Likewise. (Sized_relobj::do_set_local_got_offset): Likewise. * symtab.h (Symbol::has_got_offset): Add optional addend param. (Symbol::got_offset, Symbol::set_got_offset): Likewise. * incremental.cc (Local_got_offset_visitor::visit): Add unused uint64_t parameter with FIXME. (Global_got_offset_visitor::visit): Add unused uint64_t parameter.
Diffstat (limited to 'gold/object.h')
-rw-r--r--gold/object.h33
1 files changed, 19 insertions, 14 deletions
diff --git a/gold/object.h b/gold/object.h
index 38f4a2f..66e565c 100644
--- a/gold/object.h
+++ b/gold/object.h
@@ -214,11 +214,13 @@ class Got_offset_list
{
public:
Got_offset_list()
- : got_type_(-1U), got_offset_(0), got_next_(NULL)
+ : got_type_(-1U), got_offset_(0), addend_(0), got_next_(NULL)
{ }
- Got_offset_list(unsigned int got_type, unsigned int got_offset)
- : got_type_(got_type), got_offset_(got_offset), got_next_(NULL)
+ Got_offset_list(unsigned int got_type, unsigned int got_offset,
+ uint64_t addend)
+ : got_type_(got_type), got_offset_(got_offset), addend_(addend),
+ got_next_(NULL)
{ }
~Got_offset_list()
@@ -236,29 +238,31 @@ class Got_offset_list
{
this->got_type_ = -1U;
this->got_offset_ = 0;
+ this->addend_ = 0;
this->got_next_ = NULL;
}
// Set the offset for the GOT entry of type GOT_TYPE.
void
- set_offset(unsigned int got_type, unsigned int got_offset)
+ set_offset(unsigned int got_type, unsigned int got_offset, uint64_t addend)
{
if (this->got_type_ == -1U)
{
this->got_type_ = got_type;
this->got_offset_ = got_offset;
+ this->addend_ = addend;
}
else
{
for (Got_offset_list* g = this; g != NULL; g = g->got_next_)
{
- if (g->got_type_ == got_type)
+ if (g->got_type_ == got_type && g->addend_ == addend)
{
g->got_offset_ = got_offset;
return;
}
}
- Got_offset_list* g = new Got_offset_list(got_type, got_offset);
+ Got_offset_list* g = new Got_offset_list(got_type, got_offset, addend);
g->got_next_ = this->got_next_;
this->got_next_ = g;
}
@@ -266,11 +270,11 @@ class Got_offset_list
// Return the offset for a GOT entry of type GOT_TYPE.
unsigned int
- get_offset(unsigned int got_type) const
+ get_offset(unsigned int got_type, uint64_t addend) const
{
for (const Got_offset_list* g = this; g != NULL; g = g->got_next_)
{
- if (g->got_type_ == got_type)
+ if (g->got_type_ == got_type && g->addend_ == addend)
return g->got_offset_;
}
return -1U;
@@ -297,7 +301,7 @@ class Got_offset_list
{ }
virtual void
- visit(unsigned int, unsigned int) = 0;
+ visit(unsigned int, unsigned int, uint64_t) = 0;
};
// Loop over all GOT offset entries, calling a visitor class V for each.
@@ -307,12 +311,13 @@ class Got_offset_list
if (this->got_type_ == -1U)
return;
for (const Got_offset_list* g = this; g != NULL; g = g->got_next_)
- v->visit(g->got_type_, g->got_offset_);
+ v->visit(g->got_type_, g->got_offset_, g->addend_);
}
private:
unsigned int got_type_;
unsigned int got_offset_;
+ uint64_t addend_;
Got_offset_list* got_next_;
};
@@ -2134,7 +2139,7 @@ class Sized_relobj : public Relobj
Local_got_offsets::const_iterator p =
this->local_got_offsets_.find(key);
return (p != this->local_got_offsets_.end()
- && p->second->get_offset(got_type) != -1U);
+ && p->second->get_offset(got_type, addend) != -1U);
}
// Return the GOT offset of type GOT_TYPE of the local symbol
@@ -2147,7 +2152,7 @@ class Sized_relobj : public Relobj
Local_got_offsets::const_iterator p =
this->local_got_offsets_.find(key);
gold_assert(p != this->local_got_offsets_.end());
- unsigned int off = p->second->get_offset(got_type);
+ unsigned int off = p->second->get_offset(got_type, addend);
gold_assert(off != -1U);
return off;
}
@@ -2162,10 +2167,10 @@ class Sized_relobj : public Relobj
Local_got_offsets::const_iterator p =
this->local_got_offsets_.find(key);
if (p != this->local_got_offsets_.end())
- p->second->set_offset(got_type, got_offset);
+ p->second->set_offset(got_type, got_offset, addend);
else
{
- Got_offset_list* g = new Got_offset_list(got_type, got_offset);
+ Got_offset_list* g = new Got_offset_list(got_type, got_offset, addend);
std::pair<Local_got_offsets::iterator, bool> ins =
this->local_got_offsets_.insert(std::make_pair(key, g));
gold_assert(ins.second);