This is the mail archive of the
mailing list for the binutils project.
Re: [PATCH v4] gold: Fix non-deterministic behaviour of Mips gold.
- From: Cary Coutant <ccoutant at gmail dot com>
- To: Vladimir Radosavljevic <Vladimir dot Radosavljevic at imgtec dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>, Petar Jovanovic <Petar dot Jovanovic at imgtec dot com>
- Date: Thu, 7 Apr 2016 07:42:11 -0700
- Subject: Re: [PATCH v4] gold: Fix non-deterministic behaviour of Mips gold.
- Authentication-results: sourceware.org; auth=none
- References: <3060420525346945A0ADBD567348A91723740FFD at BADAG02 dot ba dot imgtec dot org>
+ size_t addend = (sizeof(size_t) == 8
+ ? (this->addend_ & 0xffffffffffff) << 16
+ : (this->addend_ & 0xffff) << 16);
+ return name_hash_value ^ this->symndx_ ^ addend;
Mips_got_entry::addend_ is of type Mips_address, which is
Elf_types<size>::Elf_addr, So if you're building on a 64-bit host for
a 32-bit target, you'll have a 32-bit this->addend_, but a 64-bit
size_t. It's not clear to me why you want to mask the addend in either
case, though, and you're not taking advantage of a larger size_t by
shifting it further left. How about just this:
size_t addend = this->addend_;
return name_hash_value ^ this->symndx_ ^ (addend << 16);
If that's OK with you, I'll commit it with that change.