+// The Local_got_entry_key used to index the GOT offsets for local
+// non-TLS symbols, and tp-relative offsets for TLS symbols.
+
+class Local_got_entry_key
+{
+ public:
+ Local_got_entry_key(unsigned int symndx, uint64_t addend)
+ : symndx_(symndx), addend_(addend)
+ {}
+
+ // 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_);
+ }
+
+ // Compute a hash value for this using 64-bit FNV-1a hash.
+ size_t
+ hash_value() const
+ {
+ 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;
+ }
+
+ // Functors for associative containers.
+ struct equal_to
+ {
+ bool
+ operator()(const Local_got_entry_key& key1,
+ const Local_got_entry_key& key2) const
+ { return key1.eq(key2); }
+ };
+
+ struct hash
+ {
+ size_t
+ operator()(const Local_got_entry_key& key) const
+ { return key.hash_value(); }
+ };
+
+ private:
+ // The local symbol index.
+ unsigned int symndx_;
+ // The addend.
+ uint64_t addend_;
+};
+