[PATCH][GOLD] Handle .ARM.exidx sections in garbage collection.

Sriraman Tallam tmsriram@google.com
Tue Jan 12 18:11:00 GMT 2010


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
>



More information about the Binutils mailing list