This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
xmalloc section name
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Date: Sat, 15 Dec 2001 02:28:38 +1030
- Subject: xmalloc section name
Found while testing my "hash table for bfd sections" patch.
get_stab_string_offset calls subseg_new, which calls subseg_get,
which calls bfd_make_section_old_way. If the section doesn't already
exist, a new section is made with a reference back to the string.
gas/ChangeLog
* config/obj-elf.c (obj_elf_init_stab_section): References are
kept to section name strings. Don't alloca them!
Index: gas/config/obj-elf.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-elf.c,v
retrieving revision 1.44
diff -u -p -r1.44 obj-elf.c
--- obj-elf.c 2001/11/13 03:24:25 1.44
+++ obj-elf.c 2001/12/14 15:47:14
@@ -1641,7 +1641,7 @@ obj_elf_init_stab_section (seg)
/* Zero it out. */
memset (p, 0, 12);
as_where (&file, (unsigned int *) NULL);
- stabstr_name = (char *) alloca (strlen (segment_name (seg)) + 4);
+ stabstr_name = (char *) xmalloc (strlen (segment_name (seg)) + 4);
strcpy (stabstr_name, segment_name (seg));
strcat (stabstr_name, "str");
stroff = get_stab_string_offset (file, stabstr_name);