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 relocation stub order independent of Unordered_map implementation.


"Doug Kwan (éæå)" <dougkwan@google.com> writes:

> 2010-03-17  Doug Kwan  <dougkwan@google.com>
>
>         * arm.cc (Stub_table::Stub_table): Initialize new data members
>         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
>         (Stub_table::add_reloc_stub): Assign stub offset and update
>         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
>         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
>         New data members.
>         (Stub_table::update_data_size_and_addralign): Use
>         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
>         instead of going over all reloc stubs.
>         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
>         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
>         Stringpool_template::offset_ depending on
>         Stringpool_template::zero_null_.
>         (Stringpool_template::new_key_offset): Remove code to initialize
>         Stringpool_template::offset_.
>         * stringpool.h (Stringpool_template::set_no_zero_null): Set
>         Stringpool_template::offset_ to zero.

> @@ -36,7 +36,8 @@ namespace gold
>  template<typename Stringpool_char>
>  Stringpool_template<Stringpool_char>::Stringpool_template()
>    : string_set_(), key_to_offset_(), strings_(), strtab_size_(0),
> -    zero_null_(true), optimize_(false), offset_(0)
> +    zero_null_(true), optimize_(false),
> +    offset_(this->zero_null_ ? sizeof(Stringpool_char) : 0)

Might as well just set offset_ to sizeof(Stringpool_char) since that
is what it will always wind up as anyhow.

> diff -u -u -p -r1.24 stringpool.h
> --- gold/stringpool.h	16 Mar 2010 01:26:15 -0000	1.24
> +++ gold/stringpool.h	17 Mar 2010 21:14:37 -0000
> @@ -180,6 +180,7 @@ class Stringpool_template
>    {
>      gold_assert(this->string_set_.empty());
>      this->zero_null_ = false;
> +    this->offset_ = 0;
>    }

Then I think you can add to the assert && this->offset_ ==
sizeof(Stringpool_char).

This is OK with those changes.

Thanks.

Ian


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