gas: replace bfd_alloc with notes_alloc

Alan Modra amodra@gmail.com
Fri Feb 14 08:23:44 GMT 2025
On Fri, Feb 14, 2025 at 08:06:04AM +0100, Jan Beulich wrote:
> On 13.02.2025 23:45, Alan Modra wrote:
> > --- a/gas/write.c
> > +++ b/gas/write.c
> > @@ -1804,9 +1804,8 @@ set_symtab (void)
> >    if (nsyms)
> >      {
> >        int i;
> > -      bfd_size_type amt = (bfd_size_type) nsyms * sizeof (asymbol *);
> >  
> > -      asympp = (asymbol **) bfd_alloc (stdoutput, amt);
> > +      asympp = notes_alloc (nsyms * sizeof (asymbol *));
> >        symp = symbol_rootP;
> >        for (i = 0; i < nsyms; symp = symbol_next (symp))
> >  	if (!symbol_removed_p (symp)
> 
> Just for my own education: Something potentially rather large (like an
> array of pointers to all symbols) is okay to take from an obstack,
> without risking to run out of space?

Yes, large allocations are fine.

-- 
Alan Modra


More information about the Binutils mailing list