[GOLD] Remove addend from Local_got_entry_key

This patch removes the addend from Local_got_entry_key, which is
unnecessary now that Got_offset_list has an addend.  Note that it
might be advantageous to keep the addend in Local_got_entry_key when
linking objects containing a large number of section_sym+addend@got
relocations.  I opted to save some memory by removing the field but
left the class there in case we might need to restore {sym,addend}
lookup.  That's also why this change is split out from the
Got_offset_list change.

	PR 28192
	* object.h (Local_got_entry_key): Delete addend_ field.
	Adjust constructor and methods to suit.
	* object.cc (Sized_relobj::do_for_all_local_got_entries):
	Update key.
This commit is contained in:
Alan Modra 2021-08-28 14:23:33 +09:30
parent 912697efc1
commit 973b2b402e
2 changed files with 7 additions and 10 deletions

View File

@ -427,7 +427,7 @@ Sized_relobj<size, big_endian>::do_for_all_local_got_entries(
unsigned int nsyms = this->local_symbol_count();
for (unsigned int i = 0; i < nsyms; i++)
{
Local_got_entry_key key(i, 0);
Local_got_entry_key key(i);
Local_got_offsets::const_iterator p = this->local_got_offsets_.find(key);
if (p != this->local_got_offsets_.end())
{

View File

@ -327,15 +327,15 @@ class Got_offset_list
class Local_got_entry_key
{
public:
Local_got_entry_key(unsigned int symndx, uint64_t addend)
: symndx_(symndx), addend_(addend)
Local_got_entry_key(unsigned int symndx)
: symndx_(symndx)
{}
// Whether this equals to another Local_got_entry_key.
bool
eq(const Local_got_entry_key& key) const
{
return (this->symndx_ == key.symndx_ && this->addend_ == key.addend_);
return this->symndx_ == key.symndx_;
}
// Compute a hash value for this using 64-bit FNV-1a hash.
@ -345,7 +345,6 @@ class Local_got_entry_key
uint64_t h = 14695981039346656037ULL; // FNV offset basis.
uint64_t prime = 1099511628211ULL;
h = (h ^ static_cast<uint64_t>(this->symndx_)) * prime;
h = (h ^ static_cast<uint64_t>(this->addend_)) * prime;
return h;
}
@ -368,8 +367,6 @@ class Local_got_entry_key
private:
// The local symbol index.
unsigned int symndx_;
// The addend.
uint64_t addend_;
};
// Type for mapping section index to uncompressed size and contents.
@ -2135,7 +2132,7 @@ class Sized_relobj : public Relobj
do_local_has_got_offset(unsigned int symndx, unsigned int got_type,
uint64_t addend) const
{
Local_got_entry_key key(symndx, addend);
Local_got_entry_key key(symndx);
Local_got_offsets::const_iterator p =
this->local_got_offsets_.find(key);
return (p != this->local_got_offsets_.end()
@ -2148,7 +2145,7 @@ class Sized_relobj : public Relobj
do_local_got_offset(unsigned int symndx, unsigned int got_type,
uint64_t addend) const
{
Local_got_entry_key key(symndx, addend);
Local_got_entry_key key(symndx);
Local_got_offsets::const_iterator p =
this->local_got_offsets_.find(key);
gold_assert(p != this->local_got_offsets_.end());
@ -2163,7 +2160,7 @@ class Sized_relobj : public Relobj
do_set_local_got_offset(unsigned int symndx, unsigned int got_type,
unsigned int got_offset, uint64_t addend)
{
Local_got_entry_key key(symndx, addend);
Local_got_entry_key key(symndx);
Local_got_offsets::const_iterator p =
this->local_got_offsets_.find(key);
if (p != this->local_got_offsets_.end())