This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: RFC: Short circuit bfd_map_over_sections
On Fri, Apr 30, 2004 at 11:06:50AM +0930, Alan Modra wrote:
> On Thu, Apr 29, 2004 at 05:01:33PM -0700, H. J. Lu wrote:
> > bfd_map_over_sections is used to call a function on each section in
> > a bfd. However, there are many places where bfd_map_over_sections
> > is called to find something. It isn't necessary to go through all
> > sections once it is found. I'd like to modify bfd_map_over_sections to
>
> I like the idea. The following trick might help too, allowing you to
> find sections with the same name without going via bfd_map_over_sections.
>
> I don't intend to apply this patch unless you (or others) find a use for
> it.
>
It may be useful for
http://sources.redhat.com/ml/binutils/2004-04/msg00763.html
Alan, can you take a look at it and
http://sources.redhat.com/ml/binutils/2004-04/msg00772.html
They are needed for section group support.
We can add
asection *bfd_get_section_by_name_if
(bfd *abfd, const char *name,
bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj),
void *obj);
It will return the first section named NAME and FUNC returns true.
H.J.