From e1fa0163505af867009ea73fc5f705162120e795 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Mon, 21 Mar 2016 16:31:46 +0000 Subject: Remove use of alloca. bfd * warning.m4 (GCC_WARN_CFLAGS): Add -Wstack-usage=262144 * configure: Regenerate. * elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Replace use of alloca with call to xmalloc. * elf32-nds32.c: Likewise. * elf64-hppa.c: Likewise. * elfxx-mips.c: Likewise. * pef.c: Likewise. * pei-x86_64.c: Likewise. * som.c: Likewise. * xsym.c: Likewise. binutils * dlltool.c: Replace use of alloca with call to xmalloc. * dllwrap.c: Likewise. * nlmconv.c: Likewise. * objdump.c: Likewise. * resrc.c: Likewise. * winduni.c: Likewise. * configure: Regenerate. gas * atof-generic.c: Replace use of alloca with call to xmalloc. * cgen.c: Likewise. * dwarf2dbg.c: Likewise. * macro.c: Likewise. * remap.c: Likewise. * stabs.c: Likewise. * symbols.c: Likewise. * config/obj-elf.c: Likewise. * config/tc-aarch64.c: Likewise. * config/tc-arc.c: Likewise. * config/tc-arm.c: Likewise. * config/tc-avr.c: Likewise. * config/tc-ia64.c: Likewise. * config/tc-mips.c: Likewise. * config/tc-msp430.c: Likewise. * config/tc-nds32.c: Likewise. * config/tc-ppc.c: Likewise. * config/tc-sh.c: Likewise. * config/tc-tic30.c: Likewise. * config/tc-tic54x.c: Likewise. * config/tc-xstormy16.c: Likewise. * config/te-vms.c: Likewise. * configure: Regenerate. ld * emultempl/msp430.em: Replace use of alloca with call to xmalloc. * plugin.c: Likewise. * pe-dll.c: Likewise. --- gas/config/obj-elf.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'gas/config/obj-elf.c') diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index e8af394..bacaca3 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -1607,7 +1607,7 @@ obj_elf_vendor_attribute (int vendor) if (i == 0) goto bad; - name = (char *) alloca (i + 1); + name = xmalloc (i + 1); memcpy (name, s, i); name[i] = '\0'; @@ -1620,8 +1620,10 @@ obj_elf_vendor_attribute (int vendor) { as_bad (_("Attribute name not recognised: %s"), name); ignore_rest_of_line (); + free (name); return 0; } + free (name); } type = _bfd_elf_obj_attrs_arg_type (stdoutput, vendor, tag); @@ -2085,9 +2087,7 @@ adjust_stab_sections (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) if (!strcmp ("str", sec->name + strlen (sec->name) - 3)) return; - name = (char *) alloca (strlen (sec->name) + 4); - strcpy (name, sec->name); - strcat (name, "str"); + name = concat (sec->name, "str", NULL); strsec = bfd_get_section_by_name (abfd, name); if (strsec) strsz = bfd_section_size (abfd, strsec); @@ -2100,6 +2100,7 @@ adjust_stab_sections (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) bfd_h_put_16 (abfd, nsyms, p + 6); bfd_h_put_32 (abfd, strsz, p + 8); + free (name); } #ifdef NEED_ECOFF_DEBUG -- cgit v1.1