X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Felf32-d30v.c;h=f006b669faefc1178ab575427fe1f066a524e4b0;hb=54f73dad3b74cdba860b2031f414ba628534a45e;hp=6bcec43990f418b482a1f8d9bbb8b1c75c0a5fe9;hpb=3db64b009284dda3a1ce10a91beb1297475e60a7;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf32-d30v.c b/bfd/elf32-d30v.c index 6bcec43990..f006b669fa 100644 --- a/bfd/elf32-d30v.c +++ b/bfd/elf32-d30v.c @@ -1,13 +1,12 @@ /* D30V-specific support for 32-bit ELF - Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 - Free Software Foundation, Inc. + Copyright (C) 1997-2019 Free Software Foundation, Inc. Contributed by Martin Hunt (hunt@cygnus.com). This file is part of BFD, the Binary File Descriptor library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -57,7 +56,7 @@ bfd_elf_d30v_reloc (bfd *abfd, } r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); + input_section, output_bfd, error_message); if (r != bfd_reloc_continue) return r; @@ -124,7 +123,7 @@ bfd_elf_d30v_reloc (bfd *abfd, } in1 |= (relocation >> 26) & 0x3F; /* Top 6 bits. */ - in2 |= ((relocation & 0x03FC0000) << 2); /* Next 8 bits. */ + in2 |= ((relocation & 0x03FC0000) << 2); /* Next 8 bits. */ in2 |= relocation & 0x0003FFFF; /* Bottom 18 bits. */ /* Change a PC-relative instruction to its @@ -165,7 +164,7 @@ bfd_elf_d30v_reloc_21 (bfd *abfd, } r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); + input_section, output_bfd, error_message); if (r != bfd_reloc_continue) return r; @@ -255,11 +254,11 @@ static reloc_howto_type elf_d30v_howto_table[] = /* This reloc does nothing. */ HOWTO (R_D30V_NONE, /* Type. */ 0, /* Rightshift. */ - 2, /* Size (0 = byte, 1 = short, 2 = long). */ - 32, /* Bitsize. */ + 3, /* Size (0 = byte, 1 = short, 2 = long). */ + 0, /* Bitsize. */ FALSE, /* PC_relative. */ 0, /* Bitpos. */ - complain_overflow_bitfield, /* Complain_on_overflow. */ + complain_overflow_dont, /* Complain_on_overflow. */ bfd_elf_generic_reloc, /* Special_function. */ "R_D30V_NONE", /* Name. */ FALSE, /* Partial_inplace. */ @@ -509,30 +508,46 @@ bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, /* Set the howto pointer for an D30V ELF reloc (type REL). */ -static void -d30v_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, +static bfd_boolean +d30v_info_to_howto_rel (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst) { unsigned int r_type; r_type = ELF32_R_TYPE (dst->r_info); - BFD_ASSERT (r_type < (unsigned int) R_D30V_max); + if (r_type >= (unsigned int) R_D30V_max) + { + /* xgettext:c-format */ + _bfd_error_handler (_("%pB: unsupported relocation type %#x"), + abfd, r_type); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } cache_ptr->howto = &elf_d30v_howto_table[r_type]; + return TRUE; } /* Set the howto pointer for an D30V ELF reloc (type RELA). */ -static void -d30v_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED, +static bfd_boolean +d30v_info_to_howto_rela (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst) { unsigned int r_type; r_type = ELF32_R_TYPE (dst->r_info); - BFD_ASSERT (r_type < (unsigned int) R_D30V_max); + if (r_type >= (unsigned int) R_D30V_max) + { + /* xgettext:c-format */ + _bfd_error_handler (_("%pB: unsupported relocation type %#x"), + abfd, r_type); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } cache_ptr->howto = &elf_d30v_howto_table[r_type]; + return TRUE; } #define ELF_ARCH bfd_arch_d30v @@ -540,12 +555,11 @@ d30v_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED, #define ELF_MACHINE_ALT1 EM_CYGNUS_D30V #define ELF_MAXPAGESIZE 0x1000 -#define TARGET_BIG_SYM bfd_elf32_d30v_vec +#define TARGET_BIG_SYM d30v_elf32_vec #define TARGET_BIG_NAME "elf32-d30v" #define elf_info_to_howto d30v_info_to_howto_rela #define elf_info_to_howto_rel d30v_info_to_howto_rel #define elf_backend_object_p 0 -#define elf_backend_final_write_processing 0 #include "elf32-target.h"