This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH] Include alloca.h for bfd
>
> 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().
Andrew