This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: RFC: Add bfd_get_section_ident
On Fri, May 28, 2004 at 05:59:12PM -0400, Ian Lance Taylor wrote:
> "H. J. Lu" <hjl@lucon.org> writes:
>
> > Here is the start. I can make other changes to make
> >
> > # objdump -j section
> >
> > work with multiple sections with the same name.
>
> bfd_get_section_ident() is a space leak. It should use bfd_alloc(),
> not bfd_malloc(). If allocation fails, I think it should return NULL,
> not silently return the wrong value. (This is more or less the
> conversation we just had a couple of weeks ago.)
I can make those changes.
>
> Now, that said, do we really need two new fields in asection? That
> can be pretty costly in the linker, with regard to memory space.
>
> > +void
> > +_bfd_elf_setup_group_pointers (bfd *abfd)
> > +{
> > + unsigned int i;
> > + unsigned int num_group = elf_tdata (abfd)->num_group;
> > +
> > + if (num_group == (unsigned) -1)
> > + return;
> > +
> > + for (i = 0; i < num_group; i++)
> > + {
> > + Elf_Internal_Shdr *shdr = elf_tdata (abfd)->group_sect_ptr[i];
> > + Elf_Internal_Group *idx = (Elf_Internal_Group *) shdr->contents;
> > + unsigned int n_elt = shdr->sh_size / 4;
> > +
> > + while (--n_elt != 0)
> > + (++idx)->shdr->bfd_section->group = shdr->bfd_section;
> > + }
> > +}
>
> Is the assignment to n_elt correct in always dividing by 4?
Yes. That is in gABI.
H.J.