[PATCH] Include alloca.h for bfd
Ian Lance Taylor
ian@zembu.com
Thu Aug 23 10:29:00 GMT 2001
Andrew Cagney <ac131313@cygnus.com> writes:
> >
> > Argh. I _knew_ I've forgotten something.
> > 2001-08-23 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
> > /bfd/ChangeLog
> > * linker.c (_bfd_generic_link_add_archive_symbols): Replace alloca()
> > by bfd_malloc().
> > diff -BurpNX /bigdisk/src/binutils-exclude src-orig/bfd/linker.c
> > src/bfd/linker.c
> > --- src-orig/bfd/linker.c Sat Aug 18 21:47:22 2001
> > +++ src/bfd/linker.c Thu Aug 23 18:09:21 2001
> > @@ -1007,9 +1007,13 @@ _bfd_generic_link_add_archive_symbols (a
> > let's look for its import thunk */
> > if (info->pei386_auto_import)
> > {
> > - char *buf = alloca (strlen (h->root.string) + 10);
> > + char *buf = (char *) bfd_malloc (strlen (h->root.string) + 10);
> > + if (buf == NULL)
> > + return false;
> > +
> > sprintf (buf, "__imp_%s", h->root.string);
>
> Hmm, shame you can't use asprintf(). It does everything you want
> except use bfd_malloc().
Now that you mention it, we could use asprintf there. There is an
implementation in libiberty. If it can't allocate memory, it sets the
buffer to NULL.
Doesn't matter much, though.
Ian
More information about the Binutils
mailing list