[PATCH][GOLD] Make string offset assignment independent of implementation of unordered map elements order.
Ian Lance Taylor
iant@google.com
Mon Mar 15 23:21:00 GMT 2010
"Doug Kwan (關振德)" <dougkwan@google.com> writes:
> We may get incorrect offset if
> Stringpool_template::set_no_zero_null is set after the first offset is
> assigned. Currently set_no_zero_null is only used by merged string
> section and is called before any strings are inserted. So it should
> be okay.
Please add "gold_assert(this->offset_ == 0);" to set_no_zero_null.
> +template<typename Stringpool_char>
> +void
> +Stringpool_template<Stringpool_char>::new_key_offset(const Stringpool_char* s,
> + size_t length)
> +{
> + section_offset_type offset;
> + if (this->zero_null_ && s[0] == 0)
> + offset = 0;
You can test length == 0 rather than s[0] == 0.
This is OK with those changes.
Thanks.
Ian
More information about the Binutils
mailing list