diff options
author | Nick Clifton <nickc@redhat.com> | 2016-03-21 16:31:46 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2016-03-21 16:31:46 +0000 |
commit | e1fa0163505af867009ea73fc5f705162120e795 (patch) | |
tree | fd2c95bc22a2dc813c4ab7e70200701f1854d144 /bfd/elf32-m68hc1x.c | |
parent | c55978a67a2e23999c3359a13bb807b665fcb33e (diff) | |
download | gdb-e1fa0163505af867009ea73fc5f705162120e795.zip gdb-e1fa0163505af867009ea73fc5f705162120e795.tar.gz gdb-e1fa0163505af867009ea73fc5f705162120e795.tar.bz2 |
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.
Diffstat (limited to 'bfd/elf32-m68hc1x.c')
-rw-r--r-- | bfd/elf32-m68hc1x.c | 64 |
1 files changed, 28 insertions, 36 deletions
diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c index 76c9783..912efdf 100644 --- a/bfd/elf32-m68hc1x.c +++ b/bfd/elf32-m68hc1x.c @@ -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: |