gas: replace bfd_alloc with notes_alloc

Jan Beulich jbeulich@suse.com
Fri Feb 14 07:06:04 GMT 2025


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? So far e.g. the "notes" in the
function name has been suggesting to me that only reasonably small
pieces should be taken from there.

Jan


More information about the Binutils mailing list