Remove more alloca calls
* config/tc-alpha.c (load_expression): Replace alloca with xmalloc. (emit_jsrjmp, tc_gen_reloc): Likewise. * config/tc-i370.c (i370_macro): Likewise.
This commit is contained in:
parent
96254e5c28
commit
39a0d071ae
3 changed files with 16 additions and 5 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2016-03-22 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* config/tc-alpha.c (load_expression): Replace alloca with xmalloc.
|
||||||
|
(emit_jsrjmp, tc_gen_reloc): Likewise.
|
||||||
|
* config/tc-i370.c (i370_macro): Likewise.
|
||||||
|
|
||||||
2016-03-22 Nick Clifton <nickc@redhat.com>
|
2016-03-22 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
* configure: Regenerate.
|
* configure: Regenerate.
|
||||||
|
|
|
@ -1384,13 +1384,14 @@ load_expression (int targreg,
|
||||||
ptr1 = strstr (symname, "..") + 2;
|
ptr1 = strstr (symname, "..") + 2;
|
||||||
if (ptr1 > ptr2)
|
if (ptr1 > ptr2)
|
||||||
ptr1 = symname;
|
ptr1 = symname;
|
||||||
ensymname = (char *) alloca (ptr2 - ptr1 + 5);
|
ensymname = (char *) xmalloc (ptr2 - ptr1 + 5);
|
||||||
memcpy (ensymname, ptr1, ptr2 - ptr1);
|
memcpy (ensymname, ptr1, ptr2 - ptr1);
|
||||||
memcpy (ensymname + (ptr2 - ptr1), "..en", 5);
|
memcpy (ensymname + (ptr2 - ptr1), "..en", 5);
|
||||||
|
|
||||||
gas_assert (insn.nfixups + 1 <= MAX_INSN_FIXUPS);
|
gas_assert (insn.nfixups + 1 <= MAX_INSN_FIXUPS);
|
||||||
insn.fixups[insn.nfixups].reloc = BFD_RELOC_ALPHA_NOP;
|
insn.fixups[insn.nfixups].reloc = BFD_RELOC_ALPHA_NOP;
|
||||||
ensym = symbol_find_or_make (ensymname);
|
ensym = symbol_find_or_make (ensymname);
|
||||||
|
free (ensymname);
|
||||||
symbol_mark_used (ensym);
|
symbol_mark_used (ensym);
|
||||||
/* The fixup must be the same as the BFD_RELOC_ALPHA_BOH
|
/* The fixup must be the same as the BFD_RELOC_ALPHA_BOH
|
||||||
case in emit_jsrjmp. See B.4.5.2 of the OpenVMS Linker
|
case in emit_jsrjmp. See B.4.5.2 of the OpenVMS Linker
|
||||||
|
@ -1416,13 +1417,14 @@ load_expression (int targreg,
|
||||||
ptr1 = strstr (symname, "..") + 2;
|
ptr1 = strstr (symname, "..") + 2;
|
||||||
if (ptr1 > ptr2)
|
if (ptr1 > ptr2)
|
||||||
ptr1 = symname;
|
ptr1 = symname;
|
||||||
psymname = (char *) alloca (ptr2 - ptr1 + 1);
|
psymname = (char *) xmalloc (ptr2 - ptr1 + 1);
|
||||||
memcpy (psymname, ptr1, ptr2 - ptr1);
|
memcpy (psymname, ptr1, ptr2 - ptr1);
|
||||||
psymname [ptr2 - ptr1] = 0;
|
psymname [ptr2 - ptr1] = 0;
|
||||||
|
|
||||||
gas_assert (insn.nfixups + 1 <= MAX_INSN_FIXUPS);
|
gas_assert (insn.nfixups + 1 <= MAX_INSN_FIXUPS);
|
||||||
insn.fixups[insn.nfixups].reloc = BFD_RELOC_ALPHA_LDA;
|
insn.fixups[insn.nfixups].reloc = BFD_RELOC_ALPHA_LDA;
|
||||||
psym = symbol_find_or_make (psymname);
|
psym = symbol_find_or_make (psymname);
|
||||||
|
free (psymname);
|
||||||
symbol_mark_used (psym);
|
symbol_mark_used (psym);
|
||||||
insn.fixups[insn.nfixups].exp.X_op = O_subtract;
|
insn.fixups[insn.nfixups].exp.X_op = O_subtract;
|
||||||
insn.fixups[insn.nfixups].exp.X_add_symbol = psym;
|
insn.fixups[insn.nfixups].exp.X_add_symbol = psym;
|
||||||
|
@ -2881,7 +2883,7 @@ emit_jsrjmp (const expressionS *tok,
|
||||||
char *ensymname;
|
char *ensymname;
|
||||||
|
|
||||||
/* Build the entry name as 'NAME..en'. */
|
/* Build the entry name as 'NAME..en'. */
|
||||||
ensymname = (char *) alloca (symlen + 5);
|
ensymname = (char *) xmalloc (symlen + 5);
|
||||||
memcpy (ensymname, symname, symlen);
|
memcpy (ensymname, symname, symlen);
|
||||||
memcpy (ensymname + symlen, "..en", 5);
|
memcpy (ensymname + symlen, "..en", 5);
|
||||||
|
|
||||||
|
@ -2903,6 +2905,7 @@ emit_jsrjmp (const expressionS *tok,
|
||||||
insn.fixups[0].procsym = alpha_evax_proc->symbol;
|
insn.fixups[0].procsym = alpha_evax_proc->symbol;
|
||||||
insn.nfixups++;
|
insn.nfixups++;
|
||||||
alpha_linkage_symbol = 0;
|
alpha_linkage_symbol = 0;
|
||||||
|
free (ensymname);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -6279,11 +6282,12 @@ tc_gen_reloc (asection *sec ATTRIBUTE_UNUSED,
|
||||||
if (pname_len > 4 && strcmp (pname + pname_len - 4, "..en") == 0)
|
if (pname_len > 4 && strcmp (pname + pname_len - 4, "..en") == 0)
|
||||||
{
|
{
|
||||||
symbolS *sym;
|
symbolS *sym;
|
||||||
char *my_pname = (char *) alloca (pname_len - 4 + 1);
|
char *my_pname = (char *) xmalloc (pname_len - 4 + 1);
|
||||||
|
|
||||||
memcpy (my_pname, pname, pname_len - 4);
|
memcpy (my_pname, pname, pname_len - 4);
|
||||||
my_pname [pname_len - 4] = 0;
|
my_pname [pname_len - 4] = 0;
|
||||||
sym = symbol_find (my_pname);
|
sym = symbol_find (my_pname);
|
||||||
|
free (my_pname);
|
||||||
if (sym == NULL)
|
if (sym == NULL)
|
||||||
abort ();
|
abort ();
|
||||||
|
|
||||||
|
|
|
@ -1867,7 +1867,7 @@ i370_macro (char *str, const struct i370_macro *macro)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Put the string together. */
|
/* Put the string together. */
|
||||||
complete = s = alloca (len + 1);
|
complete = s = xmalloc (len + 1);
|
||||||
format = macro->format;
|
format = macro->format;
|
||||||
while (*format != '\0')
|
while (*format != '\0')
|
||||||
{
|
{
|
||||||
|
@ -1885,6 +1885,7 @@ i370_macro (char *str, const struct i370_macro *macro)
|
||||||
|
|
||||||
/* Assemble the constructed instruction. */
|
/* Assemble the constructed instruction. */
|
||||||
md_assemble (complete);
|
md_assemble (complete);
|
||||||
|
free (complete);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This routine is called for each instruction to be assembled. */
|
/* This routine is called for each instruction to be assembled. */
|
||||||
|
|
Loading…
Reference in a new issue