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:
parent
c55978a67a
commit
e1fa016350
@ -1,3 +1,17 @@
|
||||
2016-03-21 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
* 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.
|
||||
|
||||
2016-03-15 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR ld/19827
|
||||
|
2
bfd/configure
vendored
2
bfd/configure
vendored
@ -12264,7 +12264,7 @@ fi
|
||||
|
||||
NO_WERROR=
|
||||
if test "${ERROR_ON_WARNING}" = yes ; then
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror -Wstack-usage=262144"
|
||||
NO_WERROR="-Wno-error"
|
||||
fi
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "elf32-m68hc1x.h"
|
||||
#include "elf/m68hc11.h"
|
||||
#include "opcode/m68hc11.h"
|
||||
|
||||
#include "libiberty.h"
|
||||
|
||||
#define m68hc12_stub_hash_lookup(table, string, create, copy) \
|
||||
((struct elf32_m68hc11_stub_hash_entry *) \
|
||||
@ -592,13 +592,13 @@ m68hc11_elf_export_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
|
||||
result = (* htab->build_one_stub) (gen_entry, in_arg);
|
||||
|
||||
/* Make a printable name that does not conflict with the real function. */
|
||||
name = alloca (strlen (stub_entry->root.string) + 16);
|
||||
sprintf (name, "tramp.%s", stub_entry->root.string);
|
||||
name = concat ("tramp.", stub_entry->root.string, NULL);
|
||||
|
||||
/* Export the symbol for debugging/disassembling. */
|
||||
m68hc11_elf_set_symbol (htab->stub_bfd, info, name,
|
||||
stub_entry->stub_offset,
|
||||
stub_entry->stub_sec);
|
||||
free (name);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -956,6 +956,9 @@ elf32_m68hc11_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
bfd_boolean is_section_symbol = FALSE;
|
||||
struct elf_link_hash_entry *h;
|
||||
bfd_vma val;
|
||||
const char * msg;
|
||||
char * buf;
|
||||
bfd_boolean res;
|
||||
|
||||
r_symndx = ELF32_R_SYM (rel->r_info);
|
||||
r_type = ELF32_R_TYPE (rel->r_info);
|
||||
@ -1113,15 +1116,14 @@ elf32_m68hc11_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
/* Get virtual address of instruction having the relocation. */
|
||||
if (is_far)
|
||||
{
|
||||
const char* msg;
|
||||
char* buf;
|
||||
msg = _("Reference to the far symbol `%s' using a wrong "
|
||||
"relocation may result in incorrect execution");
|
||||
buf = alloca (strlen (msg) + strlen (name) + 10);
|
||||
buf = xmalloc (strlen (msg) + strlen (name) + 10);
|
||||
sprintf (buf, msg, name);
|
||||
|
||||
(* info->callbacks->warning)
|
||||
(info, buf, name, input_bfd, NULL, rel->r_offset);
|
||||
free (buf);
|
||||
}
|
||||
|
||||
/* Get virtual address of instruction having the relocation. */
|
||||
@ -1148,17 +1150,16 @@ elf32_m68hc11_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
}
|
||||
else
|
||||
{
|
||||
const char * msg;
|
||||
char * buf;
|
||||
|
||||
msg = _("XGATE address (%lx) is not within shared RAM"
|
||||
"(0xE000-0xFFFF), therefore you must manually offset "
|
||||
"the address, and possibly manage the page, in your "
|
||||
"code.");
|
||||
buf = alloca (strlen (msg) + 128);
|
||||
buf = xmalloc (strlen (msg) + 128);
|
||||
sprintf (buf, msg, phys_addr);
|
||||
if (!((*info->callbacks->warning) (info, buf, name, input_bfd,
|
||||
input_section, insn_addr)))
|
||||
res = (*info->callbacks->warning) (info, buf, name, input_bfd,
|
||||
input_section, insn_addr);
|
||||
free (buf);
|
||||
if (! res)
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
@ -1168,37 +1169,31 @@ elf32_m68hc11_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
&& m68hc11_addr_is_banked (pinfo, insn_addr)
|
||||
&& phys_page != insn_page && !(e_flags & E_M68HC11_NO_BANK_WARNING))
|
||||
{
|
||||
const char * msg;
|
||||
char * buf;
|
||||
|
||||
msg = _("banked address [%lx:%04lx] (%lx) is not in the same bank "
|
||||
"as current banked address [%lx:%04lx] (%lx)");
|
||||
|
||||
buf = alloca (strlen (msg) + 128);
|
||||
buf = xmalloc (strlen (msg) + 128);
|
||||
sprintf (buf, msg, phys_page, phys_addr,
|
||||
(long) (relocation + rel->r_addend),
|
||||
insn_page, m68hc11_phys_addr (pinfo, insn_addr),
|
||||
(long) (insn_addr));
|
||||
if (!((*info->callbacks->warning)
|
||||
(info, buf, name, input_bfd, input_section,
|
||||
rel->r_offset)))
|
||||
res = (*info->callbacks->warning)
|
||||
(info, buf, name, input_bfd, input_section, rel->r_offset);
|
||||
free (buf);
|
||||
if (! res)
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (phys_page != 0 && insn_page == 0)
|
||||
{
|
||||
const char * msg;
|
||||
char * buf;
|
||||
|
||||
msg = _("reference to a banked address [%lx:%04lx] in the "
|
||||
"normal address space at %04lx");
|
||||
|
||||
buf = alloca (strlen (msg) + 128);
|
||||
buf = xmalloc (strlen (msg) + 128);
|
||||
sprintf (buf, msg, phys_page, phys_addr, insn_addr);
|
||||
if (!((*info->callbacks->warning)
|
||||
(info, buf, name, input_bfd, input_section,
|
||||
insn_addr)))
|
||||
res = (*info->callbacks->warning)
|
||||
(info, buf, name, input_bfd, input_section, insn_addr);
|
||||
free (buf);
|
||||
if (! res)
|
||||
return FALSE;
|
||||
|
||||
relocation = phys_addr;
|
||||
@ -1231,9 +1226,6 @@ elf32_m68hc11_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
relocation += 0xC000;
|
||||
else
|
||||
{
|
||||
const char * msg;
|
||||
char * buf;
|
||||
|
||||
/* Get virtual address of instruction having the relocation. */
|
||||
insn_addr = input_section->output_section->vma
|
||||
+ input_section->output_offset + rel->r_offset;
|
||||
@ -1241,10 +1233,12 @@ elf32_m68hc11_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
msg = _("S12 address (%lx) is not within shared RAM"
|
||||
"(0x2000-0x4000), therefore you must manually "
|
||||
"offset the address in your code");
|
||||
buf = alloca (strlen (msg) + 128);
|
||||
buf = xmalloc (strlen (msg) + 128);
|
||||
sprintf (buf, msg, phys_addr);
|
||||
if (!((*info->callbacks->warning) (info, buf, name, input_bfd,
|
||||
input_section, insn_addr)))
|
||||
res = (*info->callbacks->warning) (info, buf, name, input_bfd,
|
||||
input_section, insn_addr);
|
||||
free (buf);
|
||||
if (! res)
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
@ -1265,8 +1259,6 @@ elf32_m68hc11_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
|
||||
if (r != bfd_reloc_ok)
|
||||
{
|
||||
const char * msg = (const char *) 0;
|
||||
|
||||
switch (r)
|
||||
{
|
||||
case bfd_reloc_overflow:
|
||||
|
@ -2300,7 +2300,7 @@ nds32_insertion_sort (void *base, size_t nmemb, size_t size,
|
||||
{
|
||||
char *ptr = (char *) base;
|
||||
int i, j;
|
||||
char *tmp = alloca (size);
|
||||
char *tmp = xmalloc (size);
|
||||
|
||||
/* If i is less than j, i is inserted before j.
|
||||
|
||||
@ -2324,6 +2324,7 @@ nds32_insertion_sort (void *base, size_t nmemb, size_t size,
|
||||
memmove (ptr + (j + 1) * size, ptr + j * size, (i - j) * size);
|
||||
memcpy (ptr + j * size, tmp, size);
|
||||
}
|
||||
free (tmp);
|
||||
}
|
||||
|
||||
/* Sort relocation by r_offset.
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "elf/hppa.h"
|
||||
#include "libhppa.h"
|
||||
#include "elf64-hppa.h"
|
||||
|
||||
#include "libiberty.h"
|
||||
|
||||
#define ARCH_SIZE 64
|
||||
|
||||
@ -1094,20 +1094,18 @@ allocate_global_data_opd (struct elf_link_hash_entry *eh, void *data)
|
||||
char *new_name;
|
||||
struct elf_link_hash_entry *nh;
|
||||
|
||||
new_name = alloca (strlen (eh->root.root.string) + 2);
|
||||
new_name[0] = '.';
|
||||
strcpy (new_name + 1, eh->root.root.string);
|
||||
new_name = concat (".", eh->root.root.string, NULL);
|
||||
|
||||
nh = elf_link_hash_lookup (elf_hash_table (x->info),
|
||||
new_name, TRUE, TRUE, TRUE);
|
||||
|
||||
free (new_name);
|
||||
nh->root.type = eh->root.type;
|
||||
nh->root.u.def.value = eh->root.u.def.value;
|
||||
nh->root.u.def.section = eh->root.u.def.section;
|
||||
|
||||
if (! bfd_elf_link_record_dynamic_symbol (x->info, nh))
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
hh->opd_offset = x->ofs;
|
||||
x->ofs += OPD_ENTRY_SIZE;
|
||||
@ -2205,9 +2203,7 @@ elf64_hppa_finalize_opd (struct elf_link_hash_entry *eh, void *data)
|
||||
char *new_name;
|
||||
struct elf_link_hash_entry *nh;
|
||||
|
||||
new_name = alloca (strlen (eh->root.root.string) + 2);
|
||||
new_name[0] = '.';
|
||||
strcpy (new_name + 1, eh->root.root.string);
|
||||
new_name = concat (".", eh->root.root.string, NULL);
|
||||
|
||||
nh = elf_link_hash_lookup (elf_hash_table (info),
|
||||
new_name, TRUE, TRUE, FALSE);
|
||||
@ -2216,6 +2212,7 @@ elf64_hppa_finalize_opd (struct elf_link_hash_entry *eh, void *data)
|
||||
symbol index. */
|
||||
if (nh)
|
||||
dynindx = nh->dynindx;
|
||||
free (new_name);
|
||||
}
|
||||
|
||||
rel.r_addend = 0;
|
||||
|
@ -1580,17 +1580,20 @@ mips_elf_create_stub_symbol (struct bfd_link_info *info,
|
||||
{
|
||||
struct bfd_link_hash_entry *bh;
|
||||
struct elf_link_hash_entry *elfh;
|
||||
const char *name;
|
||||
char *name;
|
||||
bfd_boolean res;
|
||||
|
||||
if (ELF_ST_IS_MICROMIPS (h->root.other))
|
||||
value |= 1;
|
||||
|
||||
/* Create a new symbol. */
|
||||
name = ACONCAT ((prefix, h->root.root.root.string, NULL));
|
||||
name = concat (prefix, h->root.root.root.string, NULL);
|
||||
bh = NULL;
|
||||
if (!_bfd_generic_link_add_one_symbol (info, s->owner, name,
|
||||
BSF_LOCAL, s, value, NULL,
|
||||
TRUE, FALSE, &bh))
|
||||
res = _bfd_generic_link_add_one_symbol (info, s->owner, name,
|
||||
BSF_LOCAL, s, value, NULL,
|
||||
TRUE, FALSE, &bh);
|
||||
free (name);
|
||||
if (! res)
|
||||
return FALSE;
|
||||
|
||||
/* Make it a local function. */
|
||||
@ -1612,9 +1615,10 @@ mips_elf_create_shadow_symbol (struct bfd_link_info *info,
|
||||
{
|
||||
struct bfd_link_hash_entry *bh;
|
||||
struct elf_link_hash_entry *elfh;
|
||||
const char *name;
|
||||
char *name;
|
||||
asection *s;
|
||||
bfd_vma value;
|
||||
bfd_boolean res;
|
||||
|
||||
/* Read the symbol's value. */
|
||||
BFD_ASSERT (h->root.root.type == bfd_link_hash_defined
|
||||
@ -1623,11 +1627,13 @@ mips_elf_create_shadow_symbol (struct bfd_link_info *info,
|
||||
value = h->root.root.u.def.value;
|
||||
|
||||
/* Create a new symbol. */
|
||||
name = ACONCAT ((prefix, h->root.root.root.string, NULL));
|
||||
name = concat (prefix, h->root.root.root.string, NULL);
|
||||
bh = NULL;
|
||||
if (!_bfd_generic_link_add_one_symbol (info, s->owner, name,
|
||||
BSF_LOCAL, s, value, NULL,
|
||||
TRUE, FALSE, &bh))
|
||||
res = _bfd_generic_link_add_one_symbol (info, s->owner, name,
|
||||
BSF_LOCAL, s, value, NULL,
|
||||
TRUE, FALSE, &bh);
|
||||
free (name);
|
||||
if (! res)
|
||||
return FALSE;
|
||||
|
||||
/* Make it local and copy the other attributes from H. */
|
||||
|
@ -217,7 +217,7 @@ bfd_pef_print_symbol (bfd *abfd,
|
||||
fprintf (file, " %-5s %s", symbol->section->name, symbol->name);
|
||||
if (CONST_STRNEQ (symbol->name, "__traceback_"))
|
||||
{
|
||||
unsigned char *buf = alloca (symbol->udata.i);
|
||||
unsigned char *buf = xmalloc (symbol->udata.i);
|
||||
size_t offset = symbol->value + 4;
|
||||
size_t len = symbol->udata.i;
|
||||
int ret;
|
||||
@ -227,6 +227,7 @@ bfd_pef_print_symbol (bfd *abfd,
|
||||
len, 0, NULL, file);
|
||||
if (ret < 0)
|
||||
fprintf (file, " [ERROR]");
|
||||
free (buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -602,7 +602,7 @@ pex64_bfd_print_pdata_section (bfd *abfd, void *vfile, asection *pdata_section)
|
||||
if (strcmp (pdata_section->name, ".pdata") != 0)
|
||||
{
|
||||
size_t len = strlen (pdata_section->name);
|
||||
char *xdata_name = alloca (len + 1);
|
||||
char *xdata_name = xmalloc (len + 1);
|
||||
|
||||
xdata_name = memcpy (xdata_name, pdata_section->name, len + 1);
|
||||
/* Transform .pdata prefix into .xdata prefix. */
|
||||
@ -610,6 +610,7 @@ pex64_bfd_print_pdata_section (bfd *abfd, void *vfile, asection *pdata_section)
|
||||
xdata_name [1] = 'x';
|
||||
xdata_section = pex64_get_section_by_rva (abfd, xdata_base,
|
||||
xdata_name);
|
||||
free (xdata_name);
|
||||
}
|
||||
/* Second, try the .xdata section itself. */
|
||||
if (!xdata_section)
|
||||
|
24
bfd/som.c
24
bfd/som.c
@ -24,7 +24,7 @@
|
||||
#include "sysdep.h"
|
||||
#include "alloca-conf.h"
|
||||
#include "bfd.h"
|
||||
|
||||
#include "libiberty.h"
|
||||
#include "libbfd.h"
|
||||
#include "som.h"
|
||||
#include "safe-ctype.h"
|
||||
@ -3304,11 +3304,12 @@ som_write_space_strings (bfd *abfd,
|
||||
/* Chunk of memory that we can use as buffer space, then throw
|
||||
away. */
|
||||
size_t tmp_space_size = SOM_TMP_BUFSIZE;
|
||||
char *tmp_space = alloca (tmp_space_size);
|
||||
char *tmp_space = xmalloc (tmp_space_size);
|
||||
char *p = tmp_space;
|
||||
unsigned int strings_size = 0;
|
||||
asection *section;
|
||||
bfd_size_type amt;
|
||||
bfd_size_type res;
|
||||
|
||||
/* Seek to the start of the space strings in preparation for writing
|
||||
them out. */
|
||||
@ -3355,7 +3356,7 @@ som_write_space_strings (bfd *abfd,
|
||||
tmp_space_size = length + 5;
|
||||
else
|
||||
tmp_space_size = 2 * tmp_space_size;
|
||||
tmp_space = alloca (tmp_space_size);
|
||||
tmp_space = xrealloc (tmp_space, tmp_space_size);
|
||||
}
|
||||
|
||||
/* Reset to beginning of the (possibly new) buffer space. */
|
||||
@ -3391,7 +3392,9 @@ som_write_space_strings (bfd *abfd,
|
||||
/* Done with the space/subspace strings. Write out any information
|
||||
contained in a partial block. */
|
||||
amt = p - tmp_space;
|
||||
if (bfd_bwrite ((void *) &tmp_space[0], amt, abfd) != amt)
|
||||
res = bfd_bwrite ((void *) &tmp_space[0], amt, abfd);
|
||||
free (tmp_space);
|
||||
if (res != amt)
|
||||
return FALSE;
|
||||
*string_sizep = strings_size;
|
||||
return TRUE;
|
||||
@ -3408,15 +3411,14 @@ som_write_symbol_strings (bfd *abfd,
|
||||
struct som_compilation_unit *compilation_unit)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
/* Chunk of memory that we can use as buffer space, then throw
|
||||
away. */
|
||||
size_t tmp_space_size = SOM_TMP_BUFSIZE;
|
||||
char *tmp_space = alloca (tmp_space_size);
|
||||
char *tmp_space = xmalloc (tmp_space_size);
|
||||
char *p = tmp_space;
|
||||
|
||||
unsigned int strings_size = 0;
|
||||
bfd_size_type amt;
|
||||
bfd_size_type res;
|
||||
|
||||
/* This gets a bit gruesome because of the compilation unit. The
|
||||
strings within the compilation unit are part of the symbol
|
||||
@ -3475,7 +3477,7 @@ som_write_symbol_strings (bfd *abfd,
|
||||
tmp_space_size = 5 + length;
|
||||
else
|
||||
tmp_space_size = 2 * tmp_space_size;
|
||||
tmp_space = alloca (tmp_space_size);
|
||||
tmp_space = xrealloc (tmp_space, tmp_space_size);
|
||||
}
|
||||
|
||||
/* Reset to beginning of the (possibly new) buffer
|
||||
@ -3530,7 +3532,7 @@ som_write_symbol_strings (bfd *abfd,
|
||||
tmp_space_size = 5 + length;
|
||||
else
|
||||
tmp_space_size = 2 * tmp_space_size;
|
||||
tmp_space = alloca (tmp_space_size);
|
||||
tmp_space = xrealloc (tmp_space, tmp_space_size);
|
||||
}
|
||||
|
||||
/* Reset to beginning of the (possibly new) buffer space. */
|
||||
@ -3563,7 +3565,9 @@ som_write_symbol_strings (bfd *abfd,
|
||||
|
||||
/* Scribble out any partial block. */
|
||||
amt = p - tmp_space;
|
||||
if (bfd_bwrite ((void *) &tmp_space[0], amt, abfd) != amt)
|
||||
res = bfd_bwrite ((void *) &tmp_space[0], amt, abfd);
|
||||
free (tmp_space);
|
||||
if (res != amt)
|
||||
return FALSE;
|
||||
|
||||
*string_sizep = strings_size;
|
||||
|
@ -49,7 +49,7 @@ fi
|
||||
|
||||
NO_WERROR=
|
||||
if test "${ERROR_ON_WARNING}" = yes ; then
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror -Wstack-usage=262144"
|
||||
NO_WERROR="-Wno-error"
|
||||
fi
|
||||
|
||||
|
@ -1804,7 +1804,7 @@ bfd_sym_print_type_information_table_entry (bfd *abfd,
|
||||
|
||||
fprintf (f, "\n ");
|
||||
|
||||
buf = alloca (entry->physical_size);
|
||||
buf = malloc (entry->physical_size);
|
||||
if (buf == NULL)
|
||||
{
|
||||
fprintf (f, "[ERROR]\n");
|
||||
@ -1813,11 +1813,13 @@ bfd_sym_print_type_information_table_entry (bfd *abfd,
|
||||
if (bfd_seek (abfd, entry->offset, SEEK_SET) < 0)
|
||||
{
|
||||
fprintf (f, "[ERROR]\n");
|
||||
free (buf);
|
||||
return;
|
||||
}
|
||||
if (bfd_bread (buf, entry->physical_size, abfd) != entry->physical_size)
|
||||
{
|
||||
fprintf (f, "[ERROR]\n");
|
||||
free (buf);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1837,6 +1839,7 @@ bfd_sym_print_type_information_table_entry (bfd *abfd,
|
||||
|
||||
if (offset != entry->physical_size)
|
||||
fprintf (f, "\n [parser used %lu bytes instead of %lu]", offset, entry->physical_size);
|
||||
free (buf);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,3 +1,13 @@
|
||||
2016-03-21 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
* 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.
|
||||
|
||||
2016-03-07 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
PR binutils/19775
|
||||
|
2
binutils/configure
vendored
2
binutils/configure
vendored
@ -11982,7 +11982,7 @@ fi
|
||||
|
||||
NO_WERROR=
|
||||
if test "${ERROR_ON_WARNING}" = yes ; then
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror -Wstack-usage=262144"
|
||||
NO_WERROR="-Wno-error"
|
||||
fi
|
||||
|
||||
|
@ -1253,7 +1253,7 @@ def_import (const char *app_name, const char *module, const char *dllext,
|
||||
const char *entry, int ord_val, const char *its_name)
|
||||
{
|
||||
const char *application_name;
|
||||
char *buf;
|
||||
char *buf = NULL;
|
||||
|
||||
if (entry != NULL)
|
||||
application_name = entry;
|
||||
@ -1266,13 +1266,12 @@ def_import (const char *app_name, const char *module, const char *dllext,
|
||||
}
|
||||
|
||||
if (dllext != NULL)
|
||||
{
|
||||
buf = (char *) alloca (strlen (module) + strlen (dllext) + 2);
|
||||
sprintf (buf, "%s.%s", module, dllext);
|
||||
module = buf;
|
||||
}
|
||||
module = buf = concat (module, ".", dllext, NULL);
|
||||
|
||||
append_import (application_name, module, ord_val, its_name);
|
||||
|
||||
if (buf)
|
||||
free (buf);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1334,7 +1333,7 @@ run (const char *what, char *args)
|
||||
if (*s == ' ')
|
||||
i++;
|
||||
i++;
|
||||
argv = alloca (sizeof (char *) * (i + 3));
|
||||
argv = xmalloc (sizeof (char *) * (i + 3));
|
||||
i = 0;
|
||||
argv[i++] = what;
|
||||
s = args;
|
||||
@ -1353,6 +1352,7 @@ run (const char *what, char *args)
|
||||
|
||||
pid = pexecute (argv[0], (char * const *) argv, program_name, temp_base,
|
||||
&errmsg_fmt, &errmsg_arg, PEXECUTE_ONE | PEXECUTE_SEARCH);
|
||||
free(argv);
|
||||
|
||||
if (pid == -1)
|
||||
{
|
||||
@ -1986,12 +1986,13 @@ assemble_file (const char * source, const char * dest)
|
||||
{
|
||||
char * cmd;
|
||||
|
||||
cmd = (char *) alloca (strlen (ASM_SWITCHES) + strlen (as_flags)
|
||||
+ strlen (source) + strlen (dest) + 50);
|
||||
cmd = xmalloc (strlen (ASM_SWITCHES) + strlen (as_flags)
|
||||
+ strlen (source) + strlen (dest) + 50);
|
||||
|
||||
sprintf (cmd, "%s %s -o %s %s", ASM_SWITCHES, as_flags, dest, source);
|
||||
|
||||
run (as_name, cmd);
|
||||
free (cmd);
|
||||
}
|
||||
|
||||
static const char * temp_file_to_remove[5];
|
||||
@ -3295,7 +3296,7 @@ gen_lib_file (int delay)
|
||||
{
|
||||
char *name;
|
||||
|
||||
name = (char *) alloca (strlen (TMP_STUB) + 10);
|
||||
name = xmalloc (strlen (TMP_STUB) + 10);
|
||||
for (i = 0; (exp = d_exports_lexically[i]); i++)
|
||||
{
|
||||
/* Don't delete non-existent stubs for PRIVATE entries. */
|
||||
@ -3313,6 +3314,7 @@ gen_lib_file (int delay)
|
||||
non_fatal (_("cannot delete %s: %s"), name, strerror (errno));
|
||||
}
|
||||
}
|
||||
free (name);
|
||||
}
|
||||
|
||||
inform (_("Created lib file"));
|
||||
|
@ -364,7 +364,7 @@ run (const char *what, char *args)
|
||||
if (*s == ' ')
|
||||
i++;
|
||||
i++;
|
||||
argv = alloca (sizeof (char *) * (i + 3));
|
||||
argv = xmalloc (sizeof (char *) * (i + 3));
|
||||
i = 0;
|
||||
argv[i++] = what;
|
||||
s = args;
|
||||
@ -392,6 +392,7 @@ run (const char *what, char *args)
|
||||
|
||||
pid = pexecute (argv[0], (char * const *) argv, prog_name, temp_base,
|
||||
&errmsg_fmt, &errmsg_arg, PEXECUTE_ONE | PEXECUTE_SEARCH);
|
||||
free (argv);
|
||||
|
||||
if (pid == -1)
|
||||
{
|
||||
|
@ -2082,7 +2082,7 @@ link_inputs (struct string_list *inputs, char *ld, char * mfile)
|
||||
for (q = inputs; q != NULL; q = q->next)
|
||||
++c;
|
||||
|
||||
argv = (char **) alloca ((c + 7) * sizeof (char *));
|
||||
argv = (char **) xmalloc ((c + 7) * sizeof (char *));
|
||||
|
||||
#ifndef __MSDOS__
|
||||
if (ld == NULL)
|
||||
@ -2140,6 +2140,8 @@ link_inputs (struct string_list *inputs, char *ld, char * mfile)
|
||||
|
||||
pid = pexecute (ld, argv, program_name, (char *) NULL, &errfmt, &errarg,
|
||||
PEXECUTE_SEARCH | PEXECUTE_ONE);
|
||||
free (argv);
|
||||
|
||||
if (pid == -1)
|
||||
{
|
||||
fprintf (stderr, _("%s: execution of %s failed: "), program_name, ld);
|
||||
|
@ -1348,6 +1348,7 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset)
|
||||
unsigned int linenumber;
|
||||
unsigned int discriminator;
|
||||
bfd_boolean reloc;
|
||||
char *path = NULL;
|
||||
|
||||
if (! with_line_numbers && ! with_source_code)
|
||||
return;
|
||||
@ -1368,20 +1369,21 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset)
|
||||
{
|
||||
char *path_up;
|
||||
const char *fname = filename;
|
||||
char *path = (char *) alloca (prefix_length + PATH_MAX + 1);
|
||||
|
||||
path = xmalloc (prefix_length + PATH_MAX + 1);
|
||||
|
||||
if (prefix_length)
|
||||
memcpy (path, prefix, prefix_length);
|
||||
path_up = path + prefix_length;
|
||||
|
||||
/* Build relocated filename, stripping off leading directories
|
||||
from the initial filename if requested. */
|
||||
from the initial filename if requested. */
|
||||
if (prefix_strip > 0)
|
||||
{
|
||||
int level = 0;
|
||||
const char *s;
|
||||
|
||||
/* Skip selected directory levels. */
|
||||
/* Skip selected directory levels. */
|
||||
for (s = fname + 1; *s != '\0' && level < prefix_strip; s++)
|
||||
if (IS_DIR_SEPARATOR(*s))
|
||||
{
|
||||
@ -1390,7 +1392,7 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset)
|
||||
}
|
||||
}
|
||||
|
||||
/* Update complete filename. */
|
||||
/* Update complete filename. */
|
||||
strncpy (path_up, fname, PATH_MAX);
|
||||
path_up[PATH_MAX] = '\0';
|
||||
|
||||
@ -1469,6 +1471,9 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset)
|
||||
|
||||
if (discriminator != prev_discriminator)
|
||||
prev_discriminator = discriminator;
|
||||
|
||||
if (path)
|
||||
free (path);
|
||||
}
|
||||
|
||||
/* Pseudo FILE object for strings. */
|
||||
|
@ -215,7 +215,7 @@ run_cmd (char *cmd, const char *redir)
|
||||
i++;
|
||||
|
||||
i++;
|
||||
argv = alloca (sizeof (char *) * (i + 3));
|
||||
argv = xmalloc (sizeof (char *) * (i + 3));
|
||||
i = 0;
|
||||
s = cmd;
|
||||
|
||||
@ -266,6 +266,7 @@ run_cmd (char *cmd, const char *redir)
|
||||
|
||||
pid = pexecute (argv[0], (char * const *) argv, program_name, temp_base,
|
||||
&errmsg_fmt, &errmsg_arg, PEXECUTE_ONE | PEXECUTE_SEARCH);
|
||||
free (argv);
|
||||
|
||||
/* Restore stdout to its previous setting. */
|
||||
dup2 (stdout_save, STDOUT_FILENO);
|
||||
|
@ -213,7 +213,7 @@ unicode_from_ascii_len (rc_uint_type *length, unichar **unicode, const char *asc
|
||||
}
|
||||
|
||||
/* Make sure we have zero terminated string. */
|
||||
p = tmp = (char *) alloca (a_length + 1);
|
||||
p = tmp = (char *) xmalloc (a_length + 1);
|
||||
memcpy (tmp, ascii, a_length);
|
||||
tmp[a_length] = 0;
|
||||
|
||||
@ -279,6 +279,8 @@ unicode_from_ascii_len (rc_uint_type *length, unichar **unicode, const char *asc
|
||||
|
||||
if (length)
|
||||
*length = idx;
|
||||
|
||||
free (tmp);
|
||||
}
|
||||
|
||||
/* Convert an unicode string to an ASCII string. We just copy it,
|
||||
|
@ -1,3 +1,29 @@
|
||||
2016-03-21 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
* 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.
|
||||
|
||||
2016-03-20 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
|
||||
|
||||
* tc-i386.c (f32_1): Change type to unsigned char[].
|
||||
|
@ -305,6 +305,8 @@ atof_generic (/* return pointer to just AFTER number we read. */
|
||||
{
|
||||
int count; /* Number of useful digits left to scan. */
|
||||
|
||||
LITTLENUM_TYPE *temporary_binary_low = NULL;
|
||||
LITTLENUM_TYPE *power_binary_low = NULL;
|
||||
LITTLENUM_TYPE *digits_binary_low;
|
||||
unsigned int precision;
|
||||
unsigned int maximum_useful_digits;
|
||||
@ -362,7 +364,7 @@ atof_generic (/* return pointer to just AFTER number we read. */
|
||||
* sizeof (LITTLENUM_TYPE);
|
||||
|
||||
digits_binary_low = (LITTLENUM_TYPE *)
|
||||
alloca (size_of_digits_in_chars);
|
||||
xmalloc (size_of_digits_in_chars);
|
||||
|
||||
memset ((char *) digits_binary_low, '\0', size_of_digits_in_chars);
|
||||
|
||||
@ -455,13 +457,11 @@ atof_generic (/* return pointer to just AFTER number we read. */
|
||||
* giving return_binary_mantissa and return_binary_exponent.
|
||||
*/
|
||||
|
||||
LITTLENUM_TYPE *power_binary_low;
|
||||
int decimal_exponent_is_negative;
|
||||
/* This refers to the "-56" in "12.34E-56". */
|
||||
/* FALSE: decimal_exponent is positive (or 0) */
|
||||
/* TRUE: decimal_exponent is negative */
|
||||
FLONUM_TYPE temporary_flonum;
|
||||
LITTLENUM_TYPE *temporary_binary_low;
|
||||
unsigned int size_of_power_in_littlenums;
|
||||
unsigned int size_of_power_in_chars;
|
||||
|
||||
@ -479,8 +479,9 @@ atof_generic (/* return pointer to just AFTER number we read. */
|
||||
size_of_power_in_chars = size_of_power_in_littlenums
|
||||
* sizeof (LITTLENUM_TYPE) + 2;
|
||||
|
||||
power_binary_low = (LITTLENUM_TYPE *) alloca (size_of_power_in_chars);
|
||||
temporary_binary_low = (LITTLENUM_TYPE *) alloca (size_of_power_in_chars);
|
||||
power_binary_low = (LITTLENUM_TYPE *) xmalloc (size_of_power_in_chars);
|
||||
temporary_binary_low = (LITTLENUM_TYPE *) xmalloc (size_of_power_in_chars);
|
||||
|
||||
memset ((char *) power_binary_low, '\0', size_of_power_in_chars);
|
||||
*power_binary_low = 1;
|
||||
power_of_10_flonum.exponent = 0;
|
||||
@ -571,7 +572,6 @@ atof_generic (/* return pointer to just AFTER number we read. */
|
||||
(void) putchar ('\n');
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -585,6 +585,11 @@ atof_generic (/* return pointer to just AFTER number we read. */
|
||||
/* Assert sign of the number we made is '+'. */
|
||||
address_of_generic_floating_point_number->sign = digits_sign_char;
|
||||
|
||||
if (temporary_binary_low)
|
||||
free (temporary_binary_low);
|
||||
if (power_binary_low)
|
||||
free (power_binary_low);
|
||||
free (digits_binary_low);
|
||||
}
|
||||
return return_value;
|
||||
}
|
||||
|
@ -891,7 +891,6 @@ gas_cgen_md_apply_fix (fixP, valP, seg)
|
||||
const CGEN_OPERAND *operand = cgen_operand_lookup_by_num (cd, opindex);
|
||||
const char *errmsg;
|
||||
bfd_reloc_code_real_type reloc_type;
|
||||
CGEN_FIELDS *fields = alloca (CGEN_CPU_SIZEOF_FIELDS (cd));
|
||||
const CGEN_INSN *insn = fixP->fx_cgen.insn;
|
||||
#ifdef OBJ_COMPLEX_RELC
|
||||
int start;
|
||||
@ -927,6 +926,8 @@ gas_cgen_md_apply_fix (fixP, valP, seg)
|
||||
finish the job. Testing for pcrel is a temporary hack. */
|
||||
|| fixP->fx_pcrel)
|
||||
{
|
||||
CGEN_FIELDS *fields = xmalloc (CGEN_CPU_SIZEOF_FIELDS (cd));
|
||||
|
||||
CGEN_CPU_SET_FIELDS_BITSIZE (cd) (fields, CGEN_INSN_BITSIZE (insn));
|
||||
CGEN_CPU_SET_VMA_OPERAND (cd) (cd, opindex, fields, (bfd_vma) value);
|
||||
|
||||
@ -950,6 +951,8 @@ gas_cgen_md_apply_fix (fixP, valP, seg)
|
||||
#endif
|
||||
if (errmsg)
|
||||
as_bad_where (fixP->fx_file, fixP->fx_line, "%s", errmsg);
|
||||
|
||||
free (fields);
|
||||
}
|
||||
|
||||
if (fixP->fx_done)
|
||||
|
@ -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
|
||||
|
@ -1241,7 +1241,7 @@ create_register_alias (char *newname, char *p)
|
||||
nlen = strlen (newname);
|
||||
#endif
|
||||
|
||||
nbuf = alloca (nlen + 1);
|
||||
nbuf = xmalloc (nlen + 1);
|
||||
memcpy (nbuf, newname, nlen);
|
||||
nbuf[nlen] = '\0';
|
||||
|
||||
@ -1265,7 +1265,10 @@ create_register_alias (char *newname, char *p)
|
||||
the artificial FOO alias because it has already been created by the
|
||||
first .req. */
|
||||
if (insert_reg_alias (nbuf, old->number, old->type) == NULL)
|
||||
return TRUE;
|
||||
{
|
||||
free (nbuf);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
for (p = nbuf; *p; p++)
|
||||
@ -1275,6 +1278,7 @@ create_register_alias (char *newname, char *p)
|
||||
insert_reg_alias (nbuf, old->number, old->type);
|
||||
}
|
||||
|
||||
free (nbuf);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -2894,7 +2894,7 @@ md_parse_option (int c, char *arg ATTRIBUTE_UNUSED)
|
||||
case OPTION_MCPU:
|
||||
{
|
||||
int i;
|
||||
char *s = alloca (strlen (arg) + 1);
|
||||
char *s = xmalloc (strlen (arg) + 1);
|
||||
|
||||
{
|
||||
char *t = s;
|
||||
@ -2907,7 +2907,7 @@ md_parse_option (int c, char *arg ATTRIBUTE_UNUSED)
|
||||
|
||||
for (i = 0; cpu_types[i].name; ++i)
|
||||
{
|
||||
if (!strcmp (cpu_types[i].name, s))
|
||||
if (strcmp (cpu_types[i].name, s) == 0)
|
||||
{
|
||||
arc_target = cpu_types[i].flags;
|
||||
arc_target_name = cpu_types[i].name;
|
||||
@ -2921,9 +2921,8 @@ md_parse_option (int c, char *arg ATTRIBUTE_UNUSED)
|
||||
}
|
||||
|
||||
if (!cpu_types[i].name)
|
||||
{
|
||||
as_fatal (_("unknown architecture: %s\n"), arg);
|
||||
}
|
||||
as_fatal (_("unknown architecture: %s\n"), arg);
|
||||
free (s);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2255,7 +2255,7 @@ create_register_alias (char * newname, char *p)
|
||||
nlen = strlen (newname);
|
||||
#endif
|
||||
|
||||
nbuf = (char *) alloca (nlen + 1);
|
||||
nbuf = xmalloc (nlen + 1);
|
||||
memcpy (nbuf, newname, nlen);
|
||||
nbuf[nlen] = '\0';
|
||||
|
||||
@ -2279,7 +2279,10 @@ create_register_alias (char * newname, char *p)
|
||||
the artificial FOO alias because it has already been created by the
|
||||
first .req. */
|
||||
if (insert_reg_alias (nbuf, old->number, old->type) == NULL)
|
||||
return TRUE;
|
||||
{
|
||||
free (nbuf);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
for (p = nbuf; *p; p++)
|
||||
@ -2289,6 +2292,7 @@ create_register_alias (char * newname, char *p)
|
||||
insert_reg_alias (nbuf, old->number, old->type);
|
||||
}
|
||||
|
||||
free (nbuf);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -2416,7 +2420,7 @@ create_neon_reg_alias (char *newname, char *p)
|
||||
namelen = strlen (newname);
|
||||
#endif
|
||||
|
||||
namebuf = (char *) alloca (namelen + 1);
|
||||
namebuf = xmalloc (namelen + 1);
|
||||
strncpy (namebuf, newname, namelen);
|
||||
namebuf[namelen] = '\0';
|
||||
|
||||
@ -2439,6 +2443,7 @@ create_neon_reg_alias (char *newname, char *p)
|
||||
insert_neon_reg_alias (namebuf, basereg->number, basetype,
|
||||
typeinfo.defined != 0 ? &typeinfo : NULL);
|
||||
|
||||
free (namebuf);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -2754,8 +2759,9 @@ find_real_start (symbolS * symbolP)
|
||||
if (S_IS_LOCAL (symbolP) || name[0] == '.')
|
||||
return symbolP;
|
||||
|
||||
real_start = ACONCAT ((STUB_NAME, name, NULL));
|
||||
real_start = concat (STUB_NAME, name, NULL);
|
||||
new_target = symbol_find (real_start);
|
||||
free (real_start);
|
||||
|
||||
if (new_target == NULL)
|
||||
{
|
||||
@ -3529,7 +3535,8 @@ s_arm_elf_cons (int nbytes)
|
||||
XXX Surely there is a cleaner way to do this. */
|
||||
char *p = input_line_pointer;
|
||||
int offset;
|
||||
char *save_buf = (char *) alloca (input_line_pointer - base);
|
||||
char *save_buf = xmalloc (input_line_pointer - base);
|
||||
|
||||
memcpy (save_buf, base, input_line_pointer - base);
|
||||
memmove (base + (input_line_pointer - before_reloc),
|
||||
base, before_reloc - base);
|
||||
@ -3543,6 +3550,7 @@ s_arm_elf_cons (int nbytes)
|
||||
memset (p, 0, nbytes);
|
||||
fix_new_exp (frag_now, p - frag_now->fr_literal + offset,
|
||||
size, &exp, 0, (enum bfd_reloc_code_real) reloc);
|
||||
free (save_buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -14852,13 +14860,15 @@ do_neon_addsub_if_i (void)
|
||||
static void
|
||||
neon_exchange_operands (void)
|
||||
{
|
||||
void *scratch = alloca (sizeof (inst.operands[0]));
|
||||
if (inst.operands[1].present)
|
||||
{
|
||||
void *scratch = xmalloc (sizeof (inst.operands[0]));
|
||||
|
||||
/* Swap operands[1] and operands[2]. */
|
||||
memcpy (scratch, &inst.operands[1], sizeof (inst.operands[0]));
|
||||
inst.operands[1] = inst.operands[2];
|
||||
memcpy (&inst.operands[2], scratch, sizeof (inst.operands[0]));
|
||||
free (scratch);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -562,7 +562,7 @@ md_parse_option (int c, char *arg)
|
||||
case OPTION_MMCU:
|
||||
{
|
||||
int i;
|
||||
char *s = alloca (strlen (arg) + 1);
|
||||
char *s = xmalloc (strlen (arg) + 1);
|
||||
|
||||
{
|
||||
char *t = s;
|
||||
@ -577,6 +577,7 @@ md_parse_option (int c, char *arg)
|
||||
if (strcmp (mcu_types[i].name, s) == 0)
|
||||
break;
|
||||
|
||||
free (s);
|
||||
if (!mcu_types[i].name)
|
||||
{
|
||||
show_mcu_list (stderr);
|
||||
@ -587,12 +588,12 @@ md_parse_option (int c, char *arg)
|
||||
type - this for allows passing -mmcu=... via gcc ASM_SPEC as well
|
||||
as .arch ... in the asm output at the same time. */
|
||||
if (avr_mcu == &default_mcu || avr_mcu->mach == mcu_types[i].mach)
|
||||
{
|
||||
specified_mcu.name = mcu_types[i].name;
|
||||
specified_mcu.isa |= mcu_types[i].isa;
|
||||
specified_mcu.mach = mcu_types[i].mach;
|
||||
avr_mcu = &specified_mcu;
|
||||
}
|
||||
{
|
||||
specified_mcu.name = mcu_types[i].name;
|
||||
specified_mcu.isa |= mcu_types[i].isa;
|
||||
specified_mcu.mach = mcu_types[i].mach;
|
||||
avr_mcu = &specified_mcu;
|
||||
}
|
||||
else
|
||||
as_fatal (_("redefinition of mcu type `%s' to `%s'"),
|
||||
avr_mcu->name, mcu_types[i].name);
|
||||
|
@ -3566,7 +3566,6 @@ start_unwind_section (const segT text_seg, int sec_index)
|
||||
char *sec_name;
|
||||
const char *prefix = special_section_name [sec_index];
|
||||
const char *suffix;
|
||||
size_t prefix_len, suffix_len, sec_name_len;
|
||||
|
||||
sec_text_name = segment_name (text_seg);
|
||||
text_name = sec_text_name;
|
||||
@ -3590,20 +3589,13 @@ start_unwind_section (const segT text_seg, int sec_index)
|
||||
suffix += sizeof (".gnu.linkonce.t.") - 1;
|
||||
}
|
||||
|
||||
prefix_len = strlen (prefix);
|
||||
suffix_len = strlen (suffix);
|
||||
sec_name_len = prefix_len + suffix_len;
|
||||
sec_name = alloca (sec_name_len + 1);
|
||||
memcpy (sec_name, prefix, prefix_len);
|
||||
memcpy (sec_name + prefix_len, suffix, suffix_len);
|
||||
sec_name [sec_name_len] = '\0';
|
||||
sec_name = concat (prefix, suffix, NULL);
|
||||
|
||||
/* Handle COMDAT group. */
|
||||
if ((text_seg->flags & SEC_LINK_ONCE) != 0
|
||||
&& (elf_section_flags (text_seg) & SHF_GROUP) != 0)
|
||||
{
|
||||
char *section;
|
||||
size_t len, group_name_len;
|
||||
const char *group_name = elf_group_name (text_seg);
|
||||
|
||||
if (group_name == NULL)
|
||||
@ -3611,22 +3603,14 @@ start_unwind_section (const segT text_seg, int sec_index)
|
||||
as_bad (_("Group section `%s' has no group signature"),
|
||||
sec_text_name);
|
||||
ignore_rest_of_line ();
|
||||
free (sec_name);
|
||||
return;
|
||||
}
|
||||
/* We have to construct a fake section directive. */
|
||||
group_name_len = strlen (group_name);
|
||||
len = (sec_name_len
|
||||
+ 16 /* ,"aG",@progbits, */
|
||||
+ group_name_len /* ,group_name */
|
||||
+ 7); /* ,comdat */
|
||||
|
||||
section = alloca (len + 1);
|
||||
memcpy (section, sec_name, sec_name_len);
|
||||
memcpy (section + sec_name_len, ",\"aG\",@progbits,", 16);
|
||||
memcpy (section + sec_name_len + 16, group_name, group_name_len);
|
||||
memcpy (section + len - 7, ",comdat", 7);
|
||||
section [len] = '\0';
|
||||
/* We have to construct a fake section directive. */
|
||||
section = concat (sec_name, ",\"aG\",@progbits,", group_name, ",comdat", NULL);
|
||||
set_section (section);
|
||||
free (section);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3636,6 +3620,7 @@ start_unwind_section (const segT text_seg, int sec_index)
|
||||
}
|
||||
|
||||
elf_linked_to_section (now_seg) = text_seg;
|
||||
free (sec_name);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -8078,8 +8063,7 @@ ia64_parse_name (char *name, expressionS *e, char *nextcharP)
|
||||
}
|
||||
}
|
||||
|
||||
end = alloca (strlen (name) + 1);
|
||||
strcpy (end, name);
|
||||
end = xstrdup (name);
|
||||
name = ia64_canonicalize_symbol_name (end);
|
||||
if ((dr = hash_find (md.dynreg_hash, name)))
|
||||
{
|
||||
@ -8089,8 +8073,10 @@ ia64_parse_name (char *name, expressionS *e, char *nextcharP)
|
||||
bits. */
|
||||
e->X_op = O_register;
|
||||
e->X_add_number = dr->base | (dr->num_regs << 16);
|
||||
free (end);
|
||||
return 1;
|
||||
}
|
||||
free (end);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2420,9 +2420,8 @@ set_insn_error_ss (int argnum, const char *msg, const char *s1, const char *s2)
|
||||
static void
|
||||
report_insn_error (const char *str)
|
||||
{
|
||||
const char *msg;
|
||||
const char *msg = concat (insn_error.msg, " `%s'", NULL);
|
||||
|
||||
msg = ACONCAT ((insn_error.msg, " `%s'", NULL));
|
||||
switch (insn_error.format)
|
||||
{
|
||||
case ERR_FMT_PLAIN:
|
||||
@ -2437,6 +2436,8 @@ report_insn_error (const char *str)
|
||||
as_bad (msg, insn_error.u.ss[0], insn_error.u.ss[1], str);
|
||||
break;
|
||||
}
|
||||
|
||||
free ((char *) msg);
|
||||
}
|
||||
|
||||
/* Initialize vr4120_conflicts. There is a bit of duplication here:
|
||||
@ -13530,14 +13531,14 @@ mips_lookup_insn (struct hash_control *hash, const char *start,
|
||||
struct mips_opcode *insn;
|
||||
|
||||
/* Make a copy of the instruction so that we can fiddle with it. */
|
||||
name = alloca (length + 1);
|
||||
name = xmalloc (length + 1);
|
||||
memcpy (name, start, length);
|
||||
name[length] = '\0';
|
||||
|
||||
/* Look up the instruction as-is. */
|
||||
insn = (struct mips_opcode *) hash_find (hash, name);
|
||||
if (insn)
|
||||
return insn;
|
||||
goto end;
|
||||
|
||||
dot = strchr (name, '.');
|
||||
if (dot && dot[1])
|
||||
@ -13552,7 +13553,7 @@ mips_lookup_insn (struct hash_control *hash, const char *start,
|
||||
if (insn && (insn->pinfo2 & INSN2_VU0_CHANNEL_SUFFIX) != 0)
|
||||
{
|
||||
*opcode_extra |= mask << mips_vu0_channel_mask.lsb;
|
||||
return insn;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -13577,12 +13578,15 @@ mips_lookup_insn (struct hash_control *hash, const char *start,
|
||||
if (insn)
|
||||
{
|
||||
forced_insn_length = suffix;
|
||||
return insn;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
insn = NULL;
|
||||
end:
|
||||
free (name);
|
||||
return insn;
|
||||
}
|
||||
|
||||
/* Assemble an instruction into its binary format. If the instruction
|
||||
|
@ -698,7 +698,7 @@ static unsigned int silicon_errata_warn = 0;
|
||||
static void
|
||||
msp430_set_arch (int option)
|
||||
{
|
||||
char *str = (char *) alloca (32); /* 32 for good measure. */
|
||||
char str[32]; /* 32 for good measure. */
|
||||
|
||||
input_line_pointer = extract_word (input_line_pointer, str, 32);
|
||||
|
||||
|
@ -5141,6 +5141,7 @@ void
|
||||
md_assemble (char *str)
|
||||
{
|
||||
struct nds32_asm_insn insn;
|
||||
expressionS expr;
|
||||
char *out;
|
||||
struct nds32_pseudo_opcode *popcode;
|
||||
const struct nds32_field *fld = NULL;
|
||||
@ -5176,7 +5177,7 @@ md_assemble (char *str)
|
||||
}
|
||||
|
||||
label_exist = 0;
|
||||
insn.info = (expressionS *) alloca (sizeof (expressionS));
|
||||
insn.info = & expr;
|
||||
asm_desc.result = NASM_OK;
|
||||
nds32_assemble (&asm_desc, &insn, str);
|
||||
|
||||
|
@ -3523,7 +3523,7 @@ ppc_macro (char *str, const struct powerpc_macro *macro)
|
||||
}
|
||||
|
||||
/* Put the string together. */
|
||||
complete = s = (char *) alloca (len + 1);
|
||||
complete = s = (char *) xmalloc (len + 1);
|
||||
format = macro->format;
|
||||
while (*format != '\0')
|
||||
{
|
||||
@ -3541,6 +3541,7 @@ ppc_macro (char *str, const struct powerpc_macro *macro)
|
||||
|
||||
/* Assemble the constructed instruction. */
|
||||
md_assemble (complete);
|
||||
free (complete);
|
||||
}
|
||||
|
||||
#ifdef OBJ_ELF
|
||||
|
@ -2292,7 +2292,6 @@ build_relax (sh_opcode_info *opcode, sh_operand_info *op)
|
||||
static char *
|
||||
insert_loop_bounds (char *output, sh_operand_info *operand)
|
||||
{
|
||||
char *name;
|
||||
symbolS *end_sym;
|
||||
|
||||
/* Since the low byte of the opcode will be overwritten by the reloc, we
|
||||
@ -2305,6 +2304,7 @@ insert_loop_bounds (char *output, sh_operand_info *operand)
|
||||
if (sh_relax)
|
||||
{
|
||||
static int count = 0;
|
||||
char name[11];
|
||||
|
||||
/* If the last loop insn is a two-byte-insn, it is in danger of being
|
||||
swapped with the insn after it. To prevent this, create a new
|
||||
@ -2313,7 +2313,6 @@ insert_loop_bounds (char *output, sh_operand_info *operand)
|
||||
right in the middle, but four byte insns are not swapped anyways. */
|
||||
/* A REPEAT takes 6 bytes. The SH has a 32 bit address space.
|
||||
Hence a 9 digit number should be enough to count all REPEATs. */
|
||||
name = alloca (11);
|
||||
sprintf (name, "_R%x", count++ & 0x3fffffff);
|
||||
end_sym = symbol_new (name, undefined_section, 0, &zero_address_frag);
|
||||
/* Make this a local symbol. */
|
||||
|
@ -399,7 +399,6 @@ static operand *
|
||||
tic30_operand (char *token)
|
||||
{
|
||||
unsigned int count;
|
||||
char ind_buffer[strlen (token)];
|
||||
operand *current_op;
|
||||
|
||||
debug ("In tic30_operand with %s\n", token);
|
||||
@ -463,6 +462,9 @@ tic30_operand (char *token)
|
||||
int disp_number = 0;
|
||||
int buffer_posn = 1;
|
||||
ind_addr_type *ind_addr_op;
|
||||
char * ind_buffer;
|
||||
|
||||
ind_buffer = xmalloc (strlen (token));
|
||||
|
||||
debug ("Found indirect reference\n");
|
||||
ind_buffer[0] = *token;
|
||||
@ -480,11 +482,13 @@ tic30_operand (char *token)
|
||||
if (found_ar)
|
||||
{
|
||||
as_bad (_("More than one AR register found in indirect reference"));
|
||||
free (ind_buffer);
|
||||
return NULL;
|
||||
}
|
||||
if (*(token + count + 1) < '0' || *(token + count + 1) > '7')
|
||||
{
|
||||
as_bad (_("Illegal AR register in indirect reference"));
|
||||
free (ind_buffer);
|
||||
return NULL;
|
||||
}
|
||||
ar_number = *(token + count + 1) - '0';
|
||||
@ -505,6 +509,7 @@ tic30_operand (char *token)
|
||||
if (found_disp)
|
||||
{
|
||||
as_bad (_("More than one displacement found in indirect reference"));
|
||||
free (ind_buffer);
|
||||
return NULL;
|
||||
}
|
||||
count++;
|
||||
@ -513,6 +518,7 @@ tic30_operand (char *token)
|
||||
if (!is_digit_char (*(token + count)))
|
||||
{
|
||||
as_bad (_("Invalid displacement in indirect reference"));
|
||||
free (ind_buffer);
|
||||
return NULL;
|
||||
}
|
||||
disp[disp_posn++] = *(token + (count++));
|
||||
@ -530,6 +536,7 @@ tic30_operand (char *token)
|
||||
if (!found_ar)
|
||||
{
|
||||
as_bad (_("AR register not found in indirect reference"));
|
||||
free (ind_buffer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -546,18 +553,21 @@ tic30_operand (char *token)
|
||||
{
|
||||
/* Maybe an implied displacement of 1 again. */
|
||||
as_bad (_("required displacement wasn't given in indirect reference"));
|
||||
return 0;
|
||||
free (ind_buffer);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
as_bad (_("illegal indirect reference"));
|
||||
free (ind_buffer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (found_disp && (disp_number < 0 || disp_number > 255))
|
||||
{
|
||||
as_bad (_("displacement must be an unsigned 8-bit number"));
|
||||
free (ind_buffer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -565,6 +575,7 @@ tic30_operand (char *token)
|
||||
current_op->indirect.disp = disp_number;
|
||||
current_op->indirect.ARnum = ar_number;
|
||||
current_op->op_type = Indirect;
|
||||
free (ind_buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -486,13 +486,14 @@ xstormy16_md_apply_fix (fixS * fixP,
|
||||
const CGEN_OPERAND *operand = cgen_operand_lookup_by_num (cd, opindex);
|
||||
const char *errmsg;
|
||||
bfd_reloc_code_real_type reloc_type;
|
||||
CGEN_FIELDS *fields = alloca (CGEN_CPU_SIZEOF_FIELDS (cd));
|
||||
const CGEN_INSN *insn = fixP->fx_cgen.insn;
|
||||
|
||||
/* If the reloc has been fully resolved finish the operand here. */
|
||||
/* FIXME: This duplicates the capabilities of code in BFD. */
|
||||
if (fixP->fx_done)
|
||||
{
|
||||
CGEN_FIELDS *fields = xmalloc (CGEN_CPU_SIZEOF_FIELDS (cd));
|
||||
|
||||
CGEN_CPU_SET_FIELDS_BITSIZE (cd) (fields, CGEN_INSN_BITSIZE (insn));
|
||||
CGEN_CPU_SET_VMA_OPERAND (cd) (cd, opindex, fields, (bfd_vma) value);
|
||||
|
||||
@ -516,6 +517,8 @@ xstormy16_md_apply_fix (fixS * fixP,
|
||||
#endif
|
||||
if (errmsg)
|
||||
as_bad_where (fixP->fx_file, fixP->fx_line, "%s", errmsg);
|
||||
|
||||
free (fields);
|
||||
}
|
||||
|
||||
if (fixP->fx_done)
|
||||
|
@ -115,7 +115,8 @@ vms_file_stats_name (const char *dirname,
|
||||
char *rfo,
|
||||
int *ver)
|
||||
{
|
||||
char fullname[strlen (dirname) + strlen (filename) + 1];
|
||||
char * fullname;
|
||||
|
||||
#ifdef VMS
|
||||
struct FAB fab;
|
||||
struct NAM nam;
|
||||
@ -168,9 +169,7 @@ vms_file_stats_name (const char *dirname,
|
||||
return 0;
|
||||
}
|
||||
|
||||
strcpy (fullname, dirname);
|
||||
strcat (fullname, filename);
|
||||
|
||||
fullname = concat (dirname, filename, NULL);
|
||||
tryfile = to_vms_file_spec (fullname);
|
||||
|
||||
/* Allocate and initialize a FAB and NAM structures. */
|
||||
@ -188,14 +187,20 @@ vms_file_stats_name (const char *dirname,
|
||||
/* Validate filespec syntax and device existence. */
|
||||
status = SYS$PARSE (&fab, 0, 0);
|
||||
if ((status & 1) != 1)
|
||||
return 1;
|
||||
{
|
||||
free (fullname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
file.string[nam.nam$b_esl] = 0;
|
||||
|
||||
/* Find matching filespec. */
|
||||
status = SYS$SEARCH (&fab, 0, 0);
|
||||
if ((status & 1) != 1)
|
||||
return 1;
|
||||
{
|
||||
free (fullname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
file.string[nam.nam$b_esl] = 0;
|
||||
result.string[result.length=nam.nam$b_rsl] = 0;
|
||||
@ -206,7 +211,10 @@ vms_file_stats_name (const char *dirname,
|
||||
chan = 0;
|
||||
status = SYS$ASSIGN (&devicedsc, &chan, 0, 0, 0);
|
||||
if ((status & 1) != 1)
|
||||
return 1;
|
||||
{
|
||||
free (fullname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Initialize the FIB and fill in the directory id field. */
|
||||
memset (&fib, 0, sizeof (fib));
|
||||
@ -224,22 +232,39 @@ vms_file_stats_name (const char *dirname,
|
||||
= SYS$QIOW (0, chan, IO$_ACCESS|IO$M_ACCESS, &iosb, 0, 0,
|
||||
&fibdsc, &filedsc, &result.length, &resultdsc, &atrlst, 0);
|
||||
if ((status & 1) != 1)
|
||||
return 1;
|
||||
{
|
||||
free (fullname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((iosb.status & 1) != 1)
|
||||
return 1;
|
||||
{
|
||||
free (fullname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
result.string[result.length] = 0;
|
||||
status = SYS$QIOW (0, chan, IO$_DEACCESS, &iosb, 0, 0, &fibdsc, 0, 0, 0,
|
||||
&atrlst, 0);
|
||||
if ((status & 1) != 1)
|
||||
return 1;
|
||||
{
|
||||
free (fullname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((iosb.status & 1) != 1)
|
||||
return 1;
|
||||
{
|
||||
free (fullname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Deassign the channel and exit. */
|
||||
status = SYS$DASSGN (chan);
|
||||
if ((status & 1) != 1)
|
||||
return 1;
|
||||
{
|
||||
free (fullname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (cdt) *cdt = create;
|
||||
if (siz) *siz = (512 * 65536 * recattr.fat$w_efblkh) +
|
||||
@ -253,11 +278,13 @@ vms_file_stats_name (const char *dirname,
|
||||
struct tm *ts;
|
||||
long long gmtoff, secs, nsecs;
|
||||
|
||||
strcpy (fullname, dirname);
|
||||
strcat (fullname, filename);
|
||||
fullname = concat (dirname, filename, NULL);
|
||||
|
||||
if ((stat (fullname, &buff)) != 0)
|
||||
return 1;
|
||||
{
|
||||
free (fullname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (cdt)
|
||||
{
|
||||
@ -308,6 +335,7 @@ vms_file_stats_name (const char *dirname,
|
||||
*ver = 1;
|
||||
#endif /* VMS */
|
||||
|
||||
free (fullname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
2
gas/configure
vendored
2
gas/configure
vendored
@ -11755,7 +11755,7 @@ fi
|
||||
|
||||
NO_WERROR=
|
||||
if test "${ERROR_ON_WARNING}" = yes ; then
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror -Wstack-usage=262144"
|
||||
NO_WERROR="-Wno-error"
|
||||
fi
|
||||
|
||||
|
@ -643,13 +643,14 @@ dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED)
|
||||
{
|
||||
size_t dir_len = strlen (dirs[files[filenum].dir]);
|
||||
size_t file_len = strlen (files[filenum].filename);
|
||||
char *cp = (char *) alloca (dir_len + 1 + file_len + 1);
|
||||
char *cp = (char *) xmalloc (dir_len + 1 + file_len + 1);
|
||||
|
||||
memcpy (cp, dirs[files[filenum].dir], dir_len);
|
||||
INSERT_DIR_SEPARATOR (cp, dir_len);
|
||||
memcpy (cp + dir_len + 1, files[filenum].filename, file_len);
|
||||
cp[dir_len + file_len + 1] = '\0';
|
||||
listing_source_file (cp);
|
||||
free (cp);
|
||||
}
|
||||
else
|
||||
listing_source_file (files[filenum].filename);
|
||||
|
@ -1250,13 +1250,14 @@ check_macro (const char *line, sb *expand,
|
||||
if (is_name_ender (*s))
|
||||
++s;
|
||||
|
||||
copy = (char *) alloca (s - line + 1);
|
||||
copy = (char *) xmalloc (s - line + 1);
|
||||
memcpy (copy, line, s - line);
|
||||
copy[s - line] = '\0';
|
||||
for (cls = copy; *cls != '\0'; cls ++)
|
||||
*cls = TOLOWER (*cls);
|
||||
|
||||
macro = (macro_entry *) hash_find (macro_hash, copy);
|
||||
free (copy);
|
||||
|
||||
if (macro == NULL)
|
||||
return 0;
|
||||
@ -1288,7 +1289,7 @@ delete_macro (const char *name)
|
||||
macro_entry *macro;
|
||||
|
||||
len = strlen (name);
|
||||
copy = (char *) alloca (len + 1);
|
||||
copy = (char *) xmalloc (len + 1);
|
||||
for (i = 0; i < len; ++i)
|
||||
copy[i] = TOLOWER (name[i]);
|
||||
copy[i] = '\0';
|
||||
@ -1303,6 +1304,7 @@ delete_macro (const char *name)
|
||||
}
|
||||
else
|
||||
as_warn (_("Attempt to purge non-existant macro `%s'"), copy);
|
||||
free (copy);
|
||||
}
|
||||
|
||||
/* Handle the MRI IRP and IRPC pseudo-ops. These are handled as a
|
||||
|
18
gas/remap.c
18
gas/remap.c
@ -73,19 +73,13 @@ const char *
|
||||
remap_debug_filename (const char *filename)
|
||||
{
|
||||
debug_prefix_map *map;
|
||||
char *s;
|
||||
const char *name;
|
||||
size_t name_len;
|
||||
|
||||
for (map = debug_prefix_maps; map; map = map->next)
|
||||
if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0)
|
||||
break;
|
||||
if (!map)
|
||||
return xstrdup (filename);
|
||||
name = filename + map->old_len;
|
||||
name_len = strlen (name) + 1;
|
||||
s = (char *) alloca (name_len + map->new_len);
|
||||
memcpy (s, map->new_prefix, map->new_len);
|
||||
memcpy (s + map->new_len, name, name_len);
|
||||
return xstrdup (s);
|
||||
{
|
||||
const char *name = filename + map->old_len;
|
||||
return concat (map->new_prefix, name, NULL);
|
||||
}
|
||||
|
||||
return xstrdup (filename);
|
||||
}
|
||||
|
@ -500,9 +500,9 @@ stabs_generate_asm_file (void)
|
||||
char *dir2;
|
||||
|
||||
dir = remap_debug_filename (getpwd ());
|
||||
dir2 = (char *) alloca (strlen (dir) + 2);
|
||||
sprintf (dir2, "%s%s", dir, "/");
|
||||
dir2 = concat (dir, "/", NULL);
|
||||
generate_asm_file (N_SO, dir2);
|
||||
free (dir2);
|
||||
xfree ((char *) dir);
|
||||
}
|
||||
generate_asm_file (N_SO, file);
|
||||
@ -635,13 +635,13 @@ stabs_generate_asm_lineno (void)
|
||||
|
||||
if (in_dot_func_p)
|
||||
{
|
||||
buf = (char *) alloca (100 + strlen (current_function_label));
|
||||
buf = (char *) xmalloc (100 + strlen (current_function_label));
|
||||
sprintf (buf, "%d,0,%d,%s-%s\n", N_SLINE, lineno,
|
||||
sym, current_function_label);
|
||||
}
|
||||
else
|
||||
{
|
||||
buf = (char *) alloca (100);
|
||||
buf = (char *) xmalloc (100);
|
||||
sprintf (buf, "%d,0,%d,%s\n", N_SLINE, lineno, sym);
|
||||
}
|
||||
input_line_pointer = buf;
|
||||
@ -650,6 +650,7 @@ stabs_generate_asm_lineno (void)
|
||||
|
||||
input_line_pointer = hold;
|
||||
outputting_stabs_line_debug = 0;
|
||||
free (buf);
|
||||
}
|
||||
|
||||
/* Emit a function stab.
|
||||
|
@ -743,34 +743,40 @@ symbol_find (const char *name)
|
||||
symbolS *
|
||||
symbol_find_noref (const char *name, int noref)
|
||||
{
|
||||
symbolS * result;
|
||||
char * copy = NULL;
|
||||
|
||||
#ifdef tc_canonicalize_symbol_name
|
||||
{
|
||||
char *copy;
|
||||
size_t len = strlen (name) + 1;
|
||||
|
||||
copy = (char *) alloca (len);
|
||||
memcpy (copy, name, len);
|
||||
copy = xstrdup (name);
|
||||
name = tc_canonicalize_symbol_name (copy);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (! symbols_case_sensitive)
|
||||
{
|
||||
char *copy;
|
||||
const char *orig;
|
||||
char *copy2 = NULL;
|
||||
unsigned char c;
|
||||
|
||||
orig = name;
|
||||
name = copy = (char *) alloca (strlen (name) + 1);
|
||||
if (copy != NULL)
|
||||
copy2 = copy;
|
||||
name = copy = xmalloc (strlen (name) + 1);
|
||||
|
||||
while ((c = *orig++) != '\0')
|
||||
{
|
||||
*copy++ = TOUPPER (c);
|
||||
}
|
||||
*copy++ = TOUPPER (c);
|
||||
*copy = '\0';
|
||||
|
||||
if (copy2 != NULL)
|
||||
free (copy2);
|
||||
copy = (char *) name;
|
||||
}
|
||||
|
||||
return symbol_find_exact_noref (name, noref);
|
||||
result = symbol_find_exact_noref (name, noref);
|
||||
if (copy != NULL)
|
||||
free (copy);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Once upon a time, symbols were kept in a singly linked list. At
|
||||
|
2
gold/configure
vendored
2
gold/configure
vendored
@ -6728,7 +6728,7 @@ fi
|
||||
|
||||
NO_WERROR=
|
||||
if test "${ERROR_ON_WARNING}" = yes ; then
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror -Wstack-usage=262144"
|
||||
NO_WERROR="-Wno-error"
|
||||
fi
|
||||
|
||||
|
2
gprof/configure
vendored
2
gprof/configure
vendored
@ -12138,7 +12138,7 @@ fi
|
||||
|
||||
NO_WERROR=
|
||||
if test "${ERROR_ON_WARNING}" = yes ; then
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror -Wstack-usage=262144"
|
||||
NO_WERROR="-Wno-error"
|
||||
fi
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
2016-03-21 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
* emultempl/msp430.em: Replace use of alloca with call to xmalloc.
|
||||
* plugin.c: Likewise.
|
||||
* pe-dll.c: Likewise.
|
||||
|
||||
2016-03-18 Awson <kyrab@mail.ru>
|
||||
|
||||
PR 19531
|
||||
|
2
ld/configure
vendored
2
ld/configure
vendored
@ -15581,7 +15581,7 @@ fi
|
||||
|
||||
NO_WERROR=
|
||||
if test "${ERROR_ON_WARNING}" = yes ; then
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror -Wstack-usage=262144"
|
||||
NO_WERROR="-Wno-error"
|
||||
fi
|
||||
|
||||
|
@ -171,6 +171,7 @@ gld${EMULATION_NAME}_place_orphan (asection * s,
|
||||
char * lower_name;
|
||||
char * upper_name;
|
||||
char * name;
|
||||
char * buf = NULL;
|
||||
lang_output_section_statement_type * lower;
|
||||
lang_output_section_statement_type * upper;
|
||||
lang_output_section_statement_type * os;
|
||||
@ -197,15 +198,15 @@ gld${EMULATION_NAME}_place_orphan (asection * s,
|
||||
only use the part of the name before the second dot. */
|
||||
if (strchr (secname + 1, '.') != NULL)
|
||||
{
|
||||
name = ACONCAT ((secname, NULL));
|
||||
buf = name = xstrdup (secname);
|
||||
|
||||
* strchr (name + 1, '.') = 0;
|
||||
}
|
||||
else
|
||||
name = (char *) secname;
|
||||
|
||||
lower_name = ACONCAT ((".lower", name, NULL));
|
||||
upper_name = ACONCAT ((".upper", name, NULL));
|
||||
lower_name = concat (".lower", name, NULL);
|
||||
upper_name = concat (".upper", name, NULL);
|
||||
|
||||
/* Find the corresponding lower and upper sections. */
|
||||
lower = lang_output_section_find (lower_name);
|
||||
@ -220,7 +221,7 @@ gld${EMULATION_NAME}_place_orphan (asection * s,
|
||||
if (upper == NULL)
|
||||
{
|
||||
einfo ("%P: error: no section named %s or %s in linker script\n", lower_name, upper_name);
|
||||
return NULL;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else if (upper == NULL)
|
||||
@ -255,6 +256,11 @@ gld${EMULATION_NAME}_place_orphan (asection * s,
|
||||
}
|
||||
|
||||
lang_add_section (& os->children, s, NULL, os);
|
||||
end:
|
||||
free (upper_name);
|
||||
free (lower_name);
|
||||
if (buf)
|
||||
free (buf);
|
||||
return os;
|
||||
}
|
||||
EOF
|
||||
|
42
ld/pe-dll.c
42
ld/pe-dll.c
@ -894,17 +894,17 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *
|
||||
|
||||
for (i = 0; i < NE; i++)
|
||||
{
|
||||
char *int_name = pe_def_file->exports[i].internal_name;
|
||||
char *name;
|
||||
|
||||
name = xmalloc (strlen (pe_def_file->exports[i].internal_name) + 2);
|
||||
if (pe_details->underscored
|
||||
&& (*pe_def_file->exports[i].internal_name != '@'))
|
||||
name = xmalloc (strlen (int_name) + 2);
|
||||
if (pe_details->underscored && int_name[0] != '@')
|
||||
{
|
||||
*name = '_';
|
||||
strcpy (name + 1, pe_def_file->exports[i].internal_name);
|
||||
strcpy (name + 1, int_name);
|
||||
}
|
||||
else
|
||||
strcpy (name, pe_def_file->exports[i].internal_name);
|
||||
strcpy (name, int_name);
|
||||
|
||||
blhe = bfd_link_hash_lookup (info->hash,
|
||||
name,
|
||||
@ -940,7 +940,7 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *
|
||||
but we must take care not to be fooled when the user wants to export
|
||||
a symbol that actually really has a dot in it, so we only check
|
||||
for them here, after real defined symbols have already been matched. */
|
||||
else if (strchr (pe_def_file->exports[i].internal_name, '.'))
|
||||
else if (strchr (int_name, '.'))
|
||||
{
|
||||
count_exported++;
|
||||
if (!pe_def_file->exports[i].flag_noname)
|
||||
@ -961,20 +961,20 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *
|
||||
{
|
||||
/* xgettext:c-format */
|
||||
einfo (_("%XCannot export %s: symbol not defined\n"),
|
||||
pe_def_file->exports[i].internal_name);
|
||||
int_name);
|
||||
}
|
||||
else if (blhe)
|
||||
{
|
||||
/* xgettext:c-format */
|
||||
einfo (_("%XCannot export %s: symbol wrong type (%d vs %d)\n"),
|
||||
pe_def_file->exports[i].internal_name,
|
||||
int_name,
|
||||
blhe->type, bfd_link_hash_defined);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* xgettext:c-format */
|
||||
einfo (_("%XCannot export %s: symbol not found\n"),
|
||||
pe_def_file->exports[i].internal_name);
|
||||
int_name);
|
||||
}
|
||||
free (name);
|
||||
}
|
||||
@ -2884,7 +2884,7 @@ pe_find_cdecl_alias_match (struct bfd_link_info *linfo, char *name)
|
||||
struct bfd_link_hash_entry *h = NULL;
|
||||
struct key_value *kv;
|
||||
struct key_value key;
|
||||
char *at, *lname = (char *) alloca (strlen (name) + 3);
|
||||
char *at, *lname = xmalloc (strlen (name) + 3);
|
||||
|
||||
strcpy (lname, name);
|
||||
|
||||
@ -2900,10 +2900,12 @@ pe_find_cdecl_alias_match (struct bfd_link_info *linfo, char *name)
|
||||
{
|
||||
h = bfd_link_hash_lookup (linfo->hash, kv->oname, FALSE, FALSE, FALSE);
|
||||
if (h->type == bfd_link_hash_undefined)
|
||||
return h;
|
||||
goto return_h;
|
||||
}
|
||||
|
||||
if (lname[0] == '?')
|
||||
return NULL;
|
||||
goto return_NULL;
|
||||
|
||||
if (at || lname[0] == '@')
|
||||
{
|
||||
if (lname[0] == '@')
|
||||
@ -2919,7 +2921,7 @@ pe_find_cdecl_alias_match (struct bfd_link_info *linfo, char *name)
|
||||
{
|
||||
h = bfd_link_hash_lookup (linfo->hash, kv->oname, FALSE, FALSE, FALSE);
|
||||
if (h->type == bfd_link_hash_undefined)
|
||||
return h;
|
||||
goto return_h;
|
||||
}
|
||||
}
|
||||
if (at)
|
||||
@ -2931,9 +2933,9 @@ pe_find_cdecl_alias_match (struct bfd_link_info *linfo, char *name)
|
||||
{
|
||||
h = bfd_link_hash_lookup (linfo->hash, kv->oname, FALSE, FALSE, FALSE);
|
||||
if (h->type == bfd_link_hash_undefined)
|
||||
return h;
|
||||
goto return_h;
|
||||
}
|
||||
return NULL;
|
||||
goto return_NULL;
|
||||
}
|
||||
|
||||
strcat (lname, "@");
|
||||
@ -2945,7 +2947,7 @@ pe_find_cdecl_alias_match (struct bfd_link_info *linfo, char *name)
|
||||
{
|
||||
h = bfd_link_hash_lookup (linfo->hash, kv->oname, FALSE, FALSE, FALSE);
|
||||
if (h->type == bfd_link_hash_undefined)
|
||||
return h;
|
||||
goto return_h;
|
||||
}
|
||||
|
||||
if (lname[0] == '_' && pe_details->underscored)
|
||||
@ -2964,10 +2966,14 @@ pe_find_cdecl_alias_match (struct bfd_link_info *linfo, char *name)
|
||||
{
|
||||
h = bfd_link_hash_lookup (linfo->hash, kv->oname, FALSE, FALSE, FALSE);
|
||||
if (h->type == bfd_link_hash_undefined)
|
||||
return h;
|
||||
goto return_h;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return_NULL:
|
||||
h = NULL;
|
||||
return_h:
|
||||
free (lname);
|
||||
return h;
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
|
12
ld/plugin.c
12
ld/plugin.c
@ -825,21 +825,23 @@ message (int level, const char *format, ...)
|
||||
break;
|
||||
case LDPL_WARNING:
|
||||
{
|
||||
char *newfmt = ACONCAT (("%P: warning: ", format, "\n",
|
||||
(const char *) NULL));
|
||||
char *newfmt = concat ("%P: warning: ", format, "\n",
|
||||
(const char *) NULL);
|
||||
vfinfo (stdout, newfmt, args, TRUE);
|
||||
free (newfmt);
|
||||
}
|
||||
break;
|
||||
case LDPL_FATAL:
|
||||
case LDPL_ERROR:
|
||||
default:
|
||||
{
|
||||
char *newfmt = ACONCAT ((level == LDPL_FATAL ? "%P%F" : "%P%X",
|
||||
": error: ", format, "\n",
|
||||
(const char *) NULL));
|
||||
char *newfmt = concat (level == LDPL_FATAL ? "%P%F" : "%P%X",
|
||||
": error: ", format, "\n",
|
||||
(const char *) NULL);
|
||||
fflush (stdout);
|
||||
vfinfo (stderr, newfmt, args, TRUE);
|
||||
fflush (stderr);
|
||||
free (newfmt);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -460,9 +460,10 @@ cgen_lookup_insn (CGEN_CPU_DESC cd,
|
||||
if (cd->int_insn_p)
|
||||
{
|
||||
info = NULL;
|
||||
buf = (unsigned char *) alloca (cd->max_insn_bitsize / 8);
|
||||
buf = (unsigned char *) xmalloc (cd->max_insn_bitsize / 8);
|
||||
cgen_put_insn_value (cd, buf, length, insn_int_value);
|
||||
base_insn = insn_int_value;
|
||||
free (buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
2
opcodes/configure
vendored
2
opcodes/configure
vendored
@ -11545,7 +11545,7 @@ fi
|
||||
|
||||
NO_WERROR=
|
||||
if test "${ERROR_ON_WARNING}" = yes ; then
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror -Wstack-usage=262144"
|
||||
NO_WERROR="-Wno-error"
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user