[PATCH v4] gold: Fix non-deterministic behaviour of Mips gold.

Cary Coutant ccoutant@gmail.com
Thu Apr 7 14:42:00 GMT 2016


+    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.

-cary



More information about the Binutils mailing list