X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Felf32-cr16c.c;h=d3f56f18b12a179cec2ec8b5cde05ec48a5adda2;hb=4f90d84b2f2995829d6af475077598d45ef1d127;hp=27d8f801537fca0aef105fa0797f9c2bfa2a5c88;hpb=62d887d4067efbc5b757e03b0fa54f2a4c81befa;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf32-cr16c.c b/bfd/elf32-cr16c.c index 27d8f80153..d3f56f18b1 100644 --- a/bfd/elf32-cr16c.c +++ b/bfd/elf32-cr16c.c @@ -1,6 +1,5 @@ /* BFD back-end for National Semiconductor's CR16C ELF - Copyright 2004, 2005, 2006, 2007, 2009, 2010, 2012 - Free Software Foundation, Inc. + Copyright (C) 2004-2016 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -181,7 +180,11 @@ elf_cr16c_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, { unsigned int r_type = ELF32_R_TYPE (dst->r_info); - BFD_ASSERT (r_type < (unsigned int) RINDEX_16C_MAX); + if (r_type >= RINDEX_16C_MAX) + { + _bfd_error_handler (_("%B: invalid CR16C reloc number: %d"), abfd, r_type); + r_type = 0; + } cache_ptr->howto = &elf_howto_table[r_type]; } @@ -727,7 +730,7 @@ elf32_cr16c_relocate_section (bfd *output_bfd, RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, rel, 1, relend, howto, 0, contents); - if (info->relocatable) + if (bfd_link_relocatable (info)) { /* This is a relocatable link. We don't have to change anything, unless the reloc is against a section symbol, @@ -762,18 +765,14 @@ elf32_cr16c_relocate_section (bfd *output_bfd, switch (r) { case bfd_reloc_overflow: - if (!((*info->callbacks->reloc_overflow) - (info, (h ? &h->root : NULL), name, howto->name, - (bfd_vma) 0, input_bfd, input_section, - rel->r_offset))) - return FALSE; + (*info->callbacks->reloc_overflow) + (info, (h ? &h->root : NULL), name, howto->name, + (bfd_vma) 0, input_bfd, input_section, rel->r_offset); break; case bfd_reloc_undefined: - if (!((*info->callbacks->undefined_symbol) - (info, name, input_bfd, input_section, - rel->r_offset, TRUE))) - return FALSE; + (*info->callbacks->undefined_symbol) + (info, name, input_bfd, input_section, rel->r_offset, TRUE); break; case bfd_reloc_outofrange: @@ -793,10 +792,8 @@ elf32_cr16c_relocate_section (bfd *output_bfd, /* fall through */ common_error: - if (!((*info->callbacks->warning) - (info, msg, name, input_bfd, input_section, - rel->r_offset))) - return FALSE; + (*info->callbacks->warning) (info, msg, name, input_bfd, + input_section, rel->r_offset); break; } } @@ -940,7 +937,7 @@ elf32_cr16c_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED } /* Definitions for setting CR16C target vector. */ -#define TARGET_LITTLE_SYM bfd_elf32_cr16c_vec +#define TARGET_LITTLE_SYM cr16c_elf32_vec #define TARGET_LITTLE_NAME "elf32-cr16c" #define ELF_ARCH bfd_arch_cr16c #define ELF_MACHINE_CODE EM_CR