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.


"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.

Ian


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