X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Felf32-xc16x.c;h=d000fd56c8544f62ec4e8f9e859ff05119b10070;hb=8493b6651af3d2130d5f5f050905cd3d6e8a9c27;hp=42a3dcaaf125283dd09576376022cd0332f8eea7;hpb=219d1afa89d0d53ca93a684cac341f16470f3ca0;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf32-xc16x.c b/bfd/elf32-xc16x.c index 42a3dcaaf1..d000fd56c8 100644 --- a/bfd/elf32-xc16x.c +++ b/bfd/elf32-xc16x.c @@ -1,5 +1,5 @@ /* Infineon XC16X-specific support for 16-bit ELF. - Copyright (C) 2006-2018 Free Software Foundation, Inc. + Copyright (C) 2006-2019 Free Software Foundation, Inc. Contributed by KPIT Cummins Infosystems This file is part of BFD, the Binary File Descriptor library. @@ -212,9 +212,7 @@ xc16x_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, { unsigned int i; - for (i = 0; - i < sizeof (xc16x_elf_howto_table) / sizeof (xc16x_elf_howto_table[0]); - i++) + for (i = 0; i < ARRAY_SIZE (xc16x_elf_howto_table); i++) if (xc16x_elf_howto_table[i].name != NULL && strcasecmp (xc16x_elf_howto_table[i].name, r_name) == 0) return &xc16x_elf_howto_table[i]; @@ -222,11 +220,20 @@ xc16x_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +elf32_xc16x_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, unsigned r_type) +{ + if (r_type < ARRAY_SIZE (xc16x_elf_howto_table)) + return & xc16x_elf_howto_table[r_type]; + + return NULL; +} + /* For a particular operand this function is called to finalise the type of relocation. */ -static void -elf32_xc16x_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *bfd_reloc, +static bfd_boolean +elf32_xc16x_info_to_howto (bfd *abfd, arelent *bfd_reloc, Elf_Internal_Rela *elf_reloc) { unsigned int r; @@ -237,9 +244,12 @@ elf32_xc16x_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *bfd_reloc, if (xc16x_elf_howto_table[i].type == r) { bfd_reloc->howto = &xc16x_elf_howto_table[i]; - return; + return TRUE; } - abort (); + /* xgettext:c-format */ + _bfd_error_handler (_("%pB: unsupported relocation type %#x"), abfd, r); + bfd_set_error (bfd_error_bad_value); + return FALSE; } static bfd_reloc_status_type @@ -387,7 +397,7 @@ elf32_xc16x_relocate_section (bfd *output_bfd, or sections discarded by a linker script, we just want the section contents cleared. Avoid any special processing. */ reloc_howto_type *howto; - howto = xc16x_reloc_type_lookup (input_bfd, r_type); + howto = elf32_xc16x_rtype_to_howto (input_bfd, r_type); RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, rel, 1, relend, howto, 0, contents); } @@ -406,9 +416,8 @@ elf32_xc16x_relocate_section (bfd *output_bfd, } -static void -elf32_xc16x_final_write_processing (bfd *abfd, - bfd_boolean linker ATTRIBUTE_UNUSED) +static bfd_boolean +elf32_xc16x_final_write_processing (bfd *abfd) { unsigned long val; @@ -429,6 +438,7 @@ elf32_xc16x_final_write_processing (bfd *abfd, } elf_elfheader (abfd)->e_flags |= val; + return _bfd_elf_final_write_processing (abfd); } static unsigned long