Mips: Fix TLS LDM GOT entry.
authorVladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
Wed, 15 Mar 2017 23:49:16 +0000 (16:49 -0700)
committerCary Coutant <ccoutant@gmail.com>
Wed, 15 Mar 2017 23:51:35 +0000 (16:51 -0700)
gold/
* mips.cc (Mips_got_entry::hash()): Shift addend to reduce
possibility of collisions.
(Mips_got_entry::equals): Fix case for GOT_TLS_LDM
entries.

gold/ChangeLog
gold/mips.cc

index d490468e4898ed5c9f90f105802d944acfb5c829..d8d67e10a3ac03e9462008f3babafc115577d1f4 100644 (file)
@@ -1,3 +1,10 @@
+2017-03-15  Vladimir Radosavljevic  <Vladimir.Radosavljevic@imgtec.com>
+
+       * mips.cc (Mips_got_entry::hash()): Shift addend to reduce
+       possibility of collisions.
+       (Mips_got_entry::equals): Fix case for GOT_TLS_LDM
+       entries.
+
 2017-03-15  Vladimir Radosavljevic  <Vladimir.Radosavljevic@imgtec.com>
 
        * mips.cc (Mips_relobj::merge_processor_specific_data_): New data
index 4cf3364bda3178b1f279411a92dfe89a4b69d1b8..4fc160bbe9bdd7d16622bbf58c3c92e0b05ac4bf 100644 (file)
@@ -474,22 +474,24 @@ class Mips_got_entry
          ? this->d.object->name().c_str()
          : this->d.sym->name());
     size_t addend = this->addend_;
-    return name_hash_value ^ this->symndx_ ^ addend;
+    return name_hash_value ^ this->symndx_ ^ (addend << 16);
   }
 
   // Return whether this entry is equal to OTHER.
   bool
   equals(Mips_got_entry<size, big_endian>* other) const
   {
+    if (this->symndx_ != other->symndx_
+        || this->tls_type_ != other->tls_type_)
+      return false;
+
     if (this->tls_type_ == GOT_TLS_LDM)
       return true;
 
-    return ((this->tls_type_ == other->tls_type_)
-             && (this->symndx_ == other->symndx_)
-             && ((this->symndx_ != -1U)
-                  ? (this->d.object == other->d.object)
-                  : (this->d.sym == other->d.sym))
-             && (this->addend_ == other->addend_));
+    return (((this->symndx_ != -1U)
+              ? (this->d.object == other->d.object)
+              : (this->d.sym == other->d.sym))
+            && (this->addend_ == other->addend_));
   }
 
   // Return input object that needs this GOT entry.