diff options
author | Alan Modra <amodra@gmail.com> | 2021-08-28 14:23:33 +0930 |
---|---|---|
committer | Andreas K. Hüttel <dilfridge@gentoo.org> | 2021-10-29 19:00:36 +0200 |
commit | 347699fc372e8f691d8f8ab6ed6dc84bf0a98e97 (patch) | |
tree | 5e218848461d2fbed6a94af875ef1a0d8ea55fc5 | |
parent | [GOLD] Got_offset_list: addend field (diff) | |
download | binutils-gdb-347699fc372e8f691d8f8ab6ed6dc84bf0a98e97.tar.gz binutils-gdb-347699fc372e8f691d8f8ab6ed6dc84bf0a98e97.tar.bz2 binutils-gdb-347699fc372e8f691d8f8ab6ed6dc84bf0a98e97.zip |
[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.
(cherry picked from commit 973b2b402ebf660e2bbbac60e85469164d76ecfc)
(cherry picked from commit 92cadfef751e4031f6bcda6278dc1c92011fbe6c)
-rw-r--r-- | gold/object.cc | 2 | ||||
-rw-r--r-- | gold/object.h | 15 |
2 files changed, 7 insertions, 10 deletions
diff --git a/gold/object.cc b/gold/object.cc index 45cf30d4aaf..b7a2a6cfdfa 100644 --- a/gold/object.cc +++ b/gold/object.cc @@ -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()) { diff --git a/gold/object.h b/gold/object.h index 66e565c1b4c..2dbe4b3e1be 100644 --- a/gold/object.h +++ b/gold/object.h @@ -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()) |