[PATCH][GOLD] Make string offset assignment independent of implementation of unordered map elements order.

Ian Lance Taylor iant@google.com
Mon Mar 15 05:21:00 GMT 2010


"Doug Kwan (關振德)" <dougkwan@google.com> writes:

>     Currently Stringpool_template::set_string_offsets transverse an
> unordered map and assign string offsets for unoptimized string pools.
> The ordered of elements in an unordered map depends on many things
> like the version of STL used and the with of size_t.   This leads to
> different outputs generated from the same input.  This patch fixes
> this problem by assigning strings offsets in the order strings are
> inserted into a string pool.    The patch was tested on both x86_64
> Linux and ARM Linux natively.

The stringpool code is pretty time intensive for the linker, so I'm
not thrilled about walking the hash table twice.  When not optimizing,
I think we can actually calculate key_to_offset_ as we add strings to
the table.  That's even better, since we can eliminate the hash table
walk.  How does that sound?

Ian



More information about the Binutils mailing list