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]

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


Hi Ian,

   Here is an updated patch.  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.  The patch was tested on x86_64 and ARM Linux.

-Doug

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

        * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
        offset_.
        (Stringpool_template::new_key_offset): New method.
        (Stringpool_template::add_string): Assign offsets when adding new
        strings.
        (Stringpool_template::set_string_offsets): Do not set string offsets
        when not optimizing.
        * 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.
        (Stringpool_template::new_key_offset): New method declaration.
        (Stringpool_template::offset_): New data member.


2010/3/14 Doug Kwan (Ãö®¶¼w) <dougkwan@google.com>:
> 2010/3/14 Ian Lance Taylor <iant@google.com>:
>
>> 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?
>
> That's better. I can submit another patch.
>
> -Doug
>

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]