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] Handle .ARM.exidx sections in garbage collection.


On Mon, Jan 11, 2010 at 9:55 PM, Ian Lance Taylor <iant@google.com> wrote:
> "Doug Kwan (éæå)" <dougkwan@google.com> writes:
>
>> 2010-01-11 ÂDoug Kwan Â<dougkwan@google.com>
>>
>> Â Â Â Â * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
>> Â Â Â Â (Target_arm::do_finalize_sections): Define special EXIDX section
>> Â Â Â Â symbols only if referenced.
>> Â Â Â Â * gc.h (Garbage_collection::add_reference): New method.
>> Â Â Â Â (gc_process_relocs): Use Garbage_collection::add_reference to avoid
>> Â Â Â Â code duplication.
>
> This is OK.
>
> Thanks.
>
>
>> + Â// Add a reference from the SRC_SHNDX-th section of SRC_OBJECT to
>> + Â// DST_SHNDX-th section of DST_OBJECT.
>> + Âvoid
>> + Âadd_reference(Object* src_object, unsigned int src_shndx,
>> + Â Â Â Â Â Â Object* dst_object, unsigned int dst_shndx)
>> + Â{
>> + Â ÂSection_id src_id(src_object, src_shndx);
>> + Â ÂSection_id dst_id(dst_object, dst_shndx);
>> + Â ÂSection_ref::iterator p = this->section_reloc_map_.find(src_id);
>> + Â Âif (p == this->section_reloc_map_.end())
>> + Â Â Âthis->section_reloc_map_[src_id].insert(dst_id);
>> + Â Âelse
>> + Â Â Âp->second.insert(dst_id);
>> + Â}
>
> This code is a bit inefficient because it does a map lookup, which is
> O(log N), twice when adding a new src_id. ÂI wonder if it would be a
> little better if Section_ref were changed to use a pointer to
> Sections_reachable, and were changed to be a hash table, and this code
> were changed to use insert rather than find. ÂSri, that's something
> you could look at if you are feeling bored some day.

Sure, I will send a patch for this soon.

>
> Ian
>


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