This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Hi,

    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.

-Doug

2010-03-13  Doug Kwan  <dougkwan@google.com>

        * stringpool.cc (Stringpool_template::set_string_offsets): Set
        string offsets in the order strings are inserted.
        * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
        member size_.
        (Chunked_vector::clear): Clear size_.
        (Chunked_vector::reserve): Call reserve method of all Element_vectors.
        (Chunked_vector::size): Return size_.
        (Chunked_vector::push_back): Use size_ to find insert position.
        (Chunked_vector::size_): New data member.

Attachment: patch-stringpool.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]