This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH][GOLD] Make string offset assignment independent of implementation of unordered map elements order.
"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