This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH][gold] Mips: Fix TLS LDM GOT entry
- From: Vladimir Radosavljevic <Vladimir dot Radosavljevic at imgtec dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Cc: "ccoutant at gmail dot com" <ccoutant at gmail dot com>, Petar Jovanovic <Petar dot Jovanovic at imgtec dot com>
- Date: Fri, 10 Mar 2017 17:02:11 +0000
- Subject: [PATCH][gold] Mips: Fix TLS LDM GOT entry
- Authentication-results: sourceware.org; auth=none
For some cases TLS LDM entry was not added to the GOT. This patch fixes that.
It also shifts addend to reduce possibility of collisions (IIRC this was missed
from the original commit).
Regards,
Vladimir
ChangeLog -
* mips.cc (Mips_got_entry::hash()): Shift addend to reduce
possibility of collisions.
(Mips_got_entry::equals): Fix case for GOT_TLS_LDM
entries.
diff --git a/gold/mips.cc b/gold/mips.cc
index 95bf6db..a01e30b 100644
--- a/gold/mips.cc
+++ b/gold/mips.cc
@@ -471,22 +471,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.