/* BFD back-end for Renesas Super-H COFF binaries.
- Copyright (C) 1993-2014 Free Software Foundation, Inc.
+ Copyright (C) 1993-2017 Free Software Foundation, Inc.
Contributed by Cygnus Support.
Written by Steve Chamberlain, <sac@cygnus.com>.
Relaxing code written by Ian Lance Taylor, <ian@cygnus.com>.
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;
}
&& 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)
*again = FALSE;
- if (link_info->relocatable
+ if (bfd_link_relocatable (link_info)
|| (sec->flags & SEC_RELOC) == 0
|| sec->reloc_count == 0)
return TRUE;
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: 0x%lx: warning: bad R_SH_USES offset"),
+ abfd, (unsigned long) irel->r_vaddr);
continue;
}
insn = bfd_get_16 (abfd, contents + laddr);
/* 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: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x"),
+ abfd, (unsigned long) irel->r_vaddr, insn);
continue;
}
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: 0x%lx: warning: bad R_SH_USES load offset"),
+ abfd, (unsigned long) irel->r_vaddr);
continue;
}
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: 0x%lx: warning: could not find expected reloc"),
+ abfd, (unsigned long) paddr);
continue;
}
&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: 0x%lx: warning: symbol in unexpected section"),
+ abfd, (unsigned long) paddr);
continue;
}
/* 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: 0x%lx: warning: could not find expected COUNT reloc"),
+ abfd, (unsigned long) paddr);
continue;
}
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: 0x%lx: warning: bad count"),
+ abfd, (unsigned long) paddr);
continue;
}
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: 0x%lx: fatal: reloc overflow while relaxing"),
+ abfd, (unsigned long) irel->r_vaddr);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
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;
}
if (dsp)
{
sh_opcodes[0xf].minor_opcodes = sh_dsp_opcodef;
- sh_opcodes[0xf].count = sizeof sh_dsp_opcodef / sizeof sh_dsp_opcodef;
+ sh_opcodes[0xf].count = sizeof sh_dsp_opcodef / sizeof sh_dsp_opcodef [0];
}
/* Instructions should be aligned on 2 byte boundaries. */
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: 0x%lx: fatal: reloc overflow while relaxing"),
+ abfd, (unsigned long) irel->r_vaddr);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
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;
+ sec->output_section->vma
+ sec->output_offset);
}
- else if (! info->relocatable)
- {
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd, input_section,
- rel->r_vaddr - input_section->vma, TRUE)))
- return FALSE;
- }
+ else if (! bfd_link_relocatable (info))
+ (*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,
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);
}
}
}