diff options
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: |