mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-06 14:49:38 +08:00
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.
This commit is contained in:
@ -322,7 +322,6 @@ tic54x_asg (int x ATTRIBUTE_UNUSED)
|
||||
int c;
|
||||
char *name;
|
||||
char *str;
|
||||
char *tmp;
|
||||
int quoted = *input_line_pointer == '"';
|
||||
|
||||
ILLEGAL_WITHIN_STRUCT ();
|
||||
@ -360,12 +359,8 @@ tic54x_asg (int x ATTRIBUTE_UNUSED)
|
||||
return;
|
||||
}
|
||||
|
||||
tmp = xmalloc (strlen (str) + 1);
|
||||
strcpy (tmp, str);
|
||||
str = tmp;
|
||||
tmp = xmalloc (strlen (name) + 1);
|
||||
strcpy (tmp, name);
|
||||
name = tmp;
|
||||
str = xstrdup (str);
|
||||
name = xstrdup (name);
|
||||
subsym_create_or_replace (name, str);
|
||||
(void) restore_line_pointer (c);
|
||||
demand_empty_rest_of_line ();
|
||||
@ -549,21 +544,16 @@ stag_add_field_symbols (struct stag *stag,
|
||||
symbolS *rootsym,
|
||||
const char *root_stag_name)
|
||||
{
|
||||
char prefix[strlen (path) + 2];
|
||||
char * prefix;
|
||||
struct stag_field *field = stag->field;
|
||||
|
||||
/* Construct a symbol for every field contained within this structure
|
||||
including fields within structure fields. */
|
||||
strcpy (prefix, path);
|
||||
if (*path)
|
||||
strcat (prefix, ".");
|
||||
prefix = concat (path, *path ? "." : "", NULL);
|
||||
|
||||
while (field != NULL)
|
||||
{
|
||||
int len = strlen (prefix) + strlen (field->name) + 2;
|
||||
char *name = xmalloc (len);
|
||||
strcpy (name, prefix);
|
||||
strcat (name, field->name);
|
||||
char *name = concat (prefix, field->name, NULL);
|
||||
|
||||
if (rootsym == NULL)
|
||||
{
|
||||
@ -577,12 +567,10 @@ stag_add_field_symbols (struct stag *stag,
|
||||
}
|
||||
else
|
||||
{
|
||||
char *replacement = xmalloc (strlen (name)
|
||||
+ strlen (stag->name) + 2);
|
||||
strcpy (replacement, S_GET_NAME (rootsym));
|
||||
strcat (replacement, "+");
|
||||
strcat (replacement, root_stag_name);
|
||||
strcat (replacement, name + strlen (S_GET_NAME (rootsym)));
|
||||
char *replacement;
|
||||
|
||||
replacement = concat (S_GET_NAME (rootsym), "+", root_stag_name,
|
||||
name + strlen (S_GET_NAME (rootsym)), NULL);
|
||||
hash_insert (subsym_hash[0], name, replacement);
|
||||
}
|
||||
|
||||
@ -593,7 +581,9 @@ stag_add_field_symbols (struct stag *stag,
|
||||
field->offset,
|
||||
rootsym, root_stag_name);
|
||||
field = field->next;
|
||||
free (name);
|
||||
}
|
||||
free (prefix);
|
||||
}
|
||||
|
||||
/* Keep track of stag fields so that when structures are nested we can add the
|
||||
@ -695,11 +685,12 @@ tic54x_struct (int arg)
|
||||
}
|
||||
else
|
||||
{
|
||||
char label[strlen (S_GET_NAME (line_label)) + 1];
|
||||
strcpy (label, S_GET_NAME (line_label));
|
||||
current_stag->sym = symbol_new (label, absolute_section,
|
||||
char * label = xstrdup (S_GET_NAME (line_label));
|
||||
current_stag->sym = symbol_new (label,
|
||||
absolute_section,
|
||||
(valueT) abs_section_offset,
|
||||
&zero_address_frag);
|
||||
free (label);
|
||||
}
|
||||
current_stag->name = S_GET_NAME (current_stag->sym);
|
||||
SF_SET_LOCAL (current_stag->sym);
|
||||
@ -803,9 +794,9 @@ tic54x_tag (int ignore ATTRIBUTE_UNUSED)
|
||||
}
|
||||
else
|
||||
{
|
||||
char label[strlen (S_GET_NAME (line_label)) + 1];
|
||||
char * label;
|
||||
|
||||
strcpy (label, S_GET_NAME (line_label));
|
||||
label = xstrdup (S_GET_NAME (line_label));
|
||||
if (current_stag != NULL)
|
||||
stag_add_field (current_stag, label,
|
||||
abs_section_offset - S_GET_VALUE (current_stag->sym),
|
||||
@ -818,11 +809,13 @@ tic54x_tag (int ignore ATTRIBUTE_UNUSED)
|
||||
{
|
||||
as_bad (_(".tag target '%s' undefined"), label);
|
||||
ignore_rest_of_line ();
|
||||
free (label);
|
||||
return;
|
||||
}
|
||||
stag_add_field_symbols (stag, S_GET_NAME (sym),
|
||||
S_GET_VALUE (stag->sym), sym, stag->name);
|
||||
}
|
||||
free (label);
|
||||
}
|
||||
|
||||
/* Bump by the struct size, but only if we're within a .struct section. */
|
||||
@ -933,12 +926,13 @@ tic54x_struct_field (int type)
|
||||
}
|
||||
else
|
||||
{
|
||||
char label[strlen (S_GET_NAME (line_label) + 1)];
|
||||
char * label;
|
||||
|
||||
strcpy (label, S_GET_NAME (line_label));
|
||||
label = xstrdup (S_GET_NAME (line_label));
|
||||
stag_add_field (current_stag, label,
|
||||
abs_section_offset - S_GET_VALUE (current_stag->sym),
|
||||
NULL);
|
||||
free (label);
|
||||
}
|
||||
|
||||
if (current_stag->is_union)
|
||||
@ -4528,7 +4522,7 @@ subsym_substitute (char *line, int forced)
|
||||
if (value == NULL)
|
||||
{
|
||||
char digit[11];
|
||||
char *namecopy = strcpy (xmalloc (strlen (name) + 1), name);
|
||||
char *namecopy = xstrdup (name);
|
||||
|
||||
value = strcpy (xmalloc (strlen (name) + sizeof (digit) + 1),
|
||||
name);
|
||||
@ -4653,7 +4647,7 @@ subsym_substitute (char *line, int forced)
|
||||
substitutions are performed, or a substitution that has been
|
||||
previously made is encountered again.
|
||||
|
||||
put the symbol into the recursion hash table so we only
|
||||
Put the symbol into the recursion hash table so we only
|
||||
try to replace a symbol once. */
|
||||
if (recurse)
|
||||
{
|
||||
|
Reference in New Issue
Block a user