X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;ds=sidebyside;f=bfd%2Fcoff-sh.c;h=8170152b73991dc32850fb8faaa9676d14fafdb9;hb=de194d8575765da6c7905d09b8675c59fad035e9;hp=044fc04304e6b3ac0fb202bb0d57ff426c20ad08;hpb=0e1862bb401f47716446aef143b2bf7a4563f541;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c index 044fc04304..8170152b73 100644 --- a/bfd/coff-sh.c +++ b/bfd/coff-sh.c @@ -1,5 +1,5 @@ /* BFD back-end for Renesas Super-H COFF binaries. - Copyright (C) 1993-2015 Free Software Foundation, Inc. + Copyright (C) 1993-2017 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Steve Chamberlain, . Relaxing code written by Ian Lance Taylor, . @@ -501,7 +501,7 @@ sh_coff_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, if (sh_reloc_map[i].bfd_reloc_val == code) return &sh_coff_howtos[(int) sh_reloc_map[i].shcoff_reloc_val]; - (*_bfd_error_handler) (_("SH Error: unknown reloc type %d"), code); + _bfd_error_handler (_("SH Error: unknown reloc type %d"), code); return NULL; } @@ -596,6 +596,9 @@ sh_reloc (bfd * abfd, && bfd_is_und_section (symbol_in->section)) return bfd_reloc_undefined; + if (addr > input_section->size) + return bfd_reloc_outofrange; + sym_value = get_symbol_value (symbol_in); switch (r_type) @@ -771,8 +774,9 @@ sh_relax_section (bfd *abfd, laddr += ((irel->r_offset & 0xffffffff) ^ 0x80000000) - 0x80000000; if (laddr >= sec->size) { - (*_bfd_error_handler) ("%B: 0x%lx: warning: bad R_SH_USES offset", - abfd, (unsigned long) irel->r_vaddr); + /* xgettext: c-format */ + _bfd_error_handler (_("%B: %#Lx: warning: bad R_SH_USES offset"), + abfd, irel->r_vaddr); continue; } insn = bfd_get_16 (abfd, contents + laddr); @@ -780,9 +784,10 @@ sh_relax_section (bfd *abfd, /* If the instruction is not mov.l NN,rN, we don't know what to do. */ if ((insn & 0xf000) != 0xd000) { - ((*_bfd_error_handler) - ("%B: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x", - abfd, (unsigned long) irel->r_vaddr, insn)); + _bfd_error_handler + /* xgettext: c-format */ + (_("%B: %#Lx: warning: R_SH_USES points to unrecognized insn %#x"), + abfd, irel->r_vaddr, insn); continue; } @@ -797,9 +802,10 @@ sh_relax_section (bfd *abfd, paddr += (laddr + 4) &~ (bfd_vma) 3; if (paddr >= sec->size) { - ((*_bfd_error_handler) - ("%B: 0x%lx: warning: bad R_SH_USES load offset", - abfd, (unsigned long) irel->r_vaddr)); + _bfd_error_handler + /* xgettext: c-format */ + (_("%B: %#Lx: warning: bad R_SH_USES load offset"), + abfd, irel->r_vaddr); continue; } @@ -821,9 +827,10 @@ sh_relax_section (bfd *abfd, break; if (irelfn >= irelend) { - ((*_bfd_error_handler) - ("%B: 0x%lx: warning: could not find expected reloc", - abfd, (unsigned long) paddr)); + _bfd_error_handler + /* xgettext: c-format */ + (_("%B: %#Lx: warning: could not find expected reloc"), + abfd, paddr); continue; } @@ -837,9 +844,10 @@ sh_relax_section (bfd *abfd, &sym); if (sym.n_scnum != 0 && sym.n_scnum != sec->target_index) { - ((*_bfd_error_handler) - ("%B: 0x%lx: warning: symbol in unexpected section", - abfd, (unsigned long) paddr)); + _bfd_error_handler + /* xgettext: c-format */ + (_("%B: %#Lx: warning: symbol in unexpected section"), + abfd, paddr); continue; } @@ -962,9 +970,10 @@ sh_relax_section (bfd *abfd, /* Now check whether we got a COUNT reloc. */ if (irelcount >= irelend) { - ((*_bfd_error_handler) - ("%B: 0x%lx: warning: could not find expected COUNT reloc", - abfd, (unsigned long) paddr)); + _bfd_error_handler + /* xgettext: c-format */ + (_("%B: %#Lx: warning: could not find expected COUNT reloc"), + abfd, paddr); continue; } @@ -972,8 +981,9 @@ sh_relax_section (bfd *abfd, just deleted one. */ if (irelcount->r_offset == 0) { - ((*_bfd_error_handler) ("%B: 0x%lx: warning: bad count", - abfd, (unsigned long) paddr)); + /* xgettext: c-format */ + _bfd_error_handler (_("%B: %#Lx: warning: bad count"), + abfd, paddr); continue; } @@ -1073,7 +1083,7 @@ sh_relax_delete_bytes (bfd *abfd, contents = coff_section_data (abfd, sec)->contents; - /* The deletion must stop at the next ALIGN reloc for an aligment + /* The deletion must stop at the next ALIGN reloc for an alignment power larger than the number of bytes we are deleting. */ irelalign = NULL; @@ -1342,9 +1352,10 @@ sh_relax_delete_bytes (bfd *abfd, if (overflow) { - ((*_bfd_error_handler) - ("%B: 0x%lx: fatal: reloc overflow while relaxing", - abfd, (unsigned long) irel->r_vaddr)); + _bfd_error_handler + /* xgettext: c-format */ + (_("%B: %#Lx: fatal: reloc overflow while relaxing"), + abfd, irel->r_vaddr); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -1437,8 +1448,8 @@ sh_relax_delete_bytes (bfd *abfd, if (obj_symbols (abfd) != NULL || obj_raw_syments (abfd) != NULL) { - ((*_bfd_error_handler) - ("%B: fatal: generic symbols retrieved before relaxing", abfd)); + _bfd_error_handler + (_("%B: fatal: generic symbols retrieved before relaxing"), abfd); bfd_set_error (bfd_error_invalid_operation); return FALSE; } @@ -2629,9 +2640,10 @@ sh_swap_insns (bfd * abfd, if (overflow) { - ((*_bfd_error_handler) - ("%B: 0x%lx: fatal: reloc overflow while relaxing", - abfd, (unsigned long) irel->r_vaddr)); + _bfd_error_handler + /* xgettext: c-format */ + (_("%B: %#Lx: fatal: reloc overflow while relaxing"), + abfd, irel->r_vaddr); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -2766,8 +2778,9 @@ sh_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, if (symndx < 0 || (unsigned long) symndx >= obj_raw_syment_count (input_bfd)) { - (*_bfd_error_handler) - ("%B: illegal symbol index %ld in relocs", + _bfd_error_handler + /* xgettext: c-format */ + (_("%B: illegal symbol index %ld in relocs"), input_bfd, symndx); bfd_set_error (bfd_error_bad_value); return FALSE; @@ -2837,12 +2850,9 @@ sh_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, + sec->output_offset); } else if (! bfd_link_relocatable (info)) - { - if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, input_section, - rel->r_vaddr - input_section->vma, TRUE))) - return FALSE; - } + (*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, input_section, + rel->r_vaddr - input_section->vma, TRUE); } rstat = _bfd_final_link_relocate (howto, input_bfd, input_section, @@ -2875,11 +2885,10 @@ sh_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, name = buf; } - if (! ((*info->callbacks->reloc_overflow) - (info, (h ? &h->root : NULL), name, howto->name, - (bfd_vma) 0, input_bfd, input_section, - rel->r_vaddr - input_section->vma))) - return FALSE; + (*info->callbacks->reloc_overflow) + (info, (h ? &h->root : NULL), name, howto->name, + (bfd_vma) 0, input_bfd, input_section, + rel->r_vaddr - input_section->vma); } } }