This is the mail archive of the
mailing list for the binutils project.
Re: [PATCH v2 4/4] 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: Tue, 8 Mar 2016 15:46:50 -0800
- Subject: Re: [PATCH v2 4/4] gold: Fix non-deterministic behaviour of Mips gold.
- Authentication-results: sourceware.org; auth=none
- References: <3060420525346945A0ADBD567348A91723737281 at BADAG02 dot ba dot imgtec dot org>
> Changelog -
> * mips.cc (Mips_got_entry::hash): Delete.
> (class Mips_got_entry_hash): Likewise.
> (struct Got_page_entry_hash): Likewise.
> (Mips_got_entry::equals): Change to compare_less.
> (class Mips_got_entry_eq): Change to Mips_got_entry_compare_less.
> (struct Got_page_entry_eq): Change to Got_page_entry_compare_less.
> (Got_entry_set): Change from Unordered_set to std::set.
> (Got_page_entry_set): Likewise.
> (global_got_symbols_): Likewise.
> (Mips_output_data_mips_stubs::symbols_): Likewise.
> (Mips_output_data_la25_stub::symbols_): Likewise.
> (Mips_got_info::record_got_entry): Don't use find before insert.
> (Mips_got_info::record_got_page_entry): Likewise.
It's usually better to sort at the end rather than maintain a sorted
list throughout. Since you can't sort an unordered set, however, you
may want to try putting the (pointers to) entries into a vector, with
an unordered set of pointers on the side. At the end, you could then
sort the vector and throw away the set.
Or, you could build the unordered set just as you do now, then at the
end copy the pointers into a vector for sorting. (With the advantage
that you can size the vector beforehand, halving the cost of building
I don't know which approach will be better in this case, so it may be
If you've done the measurements, or are confident that std::set is the
right thing to use, let me know and I'll approve this patch.