X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=bfd%2Felf32-iq2000.c;h=6e470272929a7085f63a45a4dae2fc11bc689a97;hb=refs%2Fheads%2Fsandbox%2Fvbarinov%2Ftizen_6_base;hp=a6bf8d2e658e6a3dc379d3f0958b4e6c2cb1c65f;hpb=6d00b590316c0b08de21a264893b0fd627c54686;p=external%2Fbinutils.git diff --git a/bfd/elf32-iq2000.c b/bfd/elf32-iq2000.c index a6bf8d2..6e47027 100644 --- a/bfd/elf32-iq2000.c +++ b/bfd/elf32-iq2000.c @@ -1,5 +1,5 @@ /* IQ2000-specific support for 32-bit ELF. - Copyright (C) 2003-2014 Free Software Foundation, Inc. + Copyright (C) 2003-2019 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -22,6 +22,7 @@ #include "libbfd.h" #include "elf-bfd.h" #include "elf/iq2000.h" +#include "libiberty.h" /* Forward declarations. */ @@ -34,11 +35,11 @@ static reloc_howto_type iq2000_elf_howto_table [] = HOWTO (R_IQ2000_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_IQ2000_NONE", /* name */ FALSE, /* partial_inplace */ @@ -416,7 +417,7 @@ iq2000_final_link_relocate (reloc_howto_type * howto, /* Set the howto pointer for a IQ2000 ELF reloc. */ -static void +static bfd_boolean iq2000_info_to_howto_rela (bfd * abfd ATTRIBUTE_UNUSED, arelent * cache_ptr, Elf_Internal_Rela * dst) @@ -435,9 +436,18 @@ iq2000_info_to_howto_rela (bfd * abfd ATTRIBUTE_UNUSED, break; default: + if (r_type >= ARRAY_SIZE (iq2000_elf_howto_table)) + { + /* 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 = & iq2000_elf_howto_table [r_type]; break; } + return TRUE; } /* Look through the relocs for a section during the first phase. @@ -456,7 +466,7 @@ iq2000_elf_check_relocs (bfd *abfd, const Elf_Internal_Rela *rel_end; bfd_boolean changed = FALSE; - if (info->relocatable) + if (bfd_link_relocatable (info)) return TRUE; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; @@ -477,10 +487,6 @@ iq2000_elf_check_relocs (bfd *abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; - - /* PR15323, ref flags aren't set for references in the same - object. */ - h->root.non_ir_ref = 1; } switch (ELF32_R_TYPE (rel->r_info)) @@ -495,9 +501,7 @@ iq2000_elf_check_relocs (bfd *abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_IQ2000_GNU_VTENTRY: - BFD_ASSERT (h != NULL); - if (h != NULL - && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; @@ -640,7 +644,7 @@ iq2000_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, rel, 1, relend, howto, 0, contents); - if (info->relocatable) + if (bfd_link_relocatable (info)) continue; switch (r_type) @@ -673,13 +677,13 @@ iq2000_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, switch (r) { case bfd_reloc_overflow: - r = info->callbacks->reloc_overflow + (*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: - r = info->callbacks->undefined_symbol + (*info->callbacks->undefined_symbol) (info, name, input_bfd, input_section, rel->r_offset, TRUE); break; @@ -701,11 +705,8 @@ iq2000_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, } if (msg) - r = info->callbacks->warning - (info, msg, name, input_bfd, input_section, rel->r_offset); - - if (! r) - return FALSE; + (*info->callbacks->warning) (info, msg, name, input_bfd, + input_section, rel->r_offset); } } @@ -766,8 +767,9 @@ iq2000_elf_set_private_flags (bfd *abfd, flagword flags) file to the output object file when linking. */ static bfd_boolean -iq2000_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) +iq2000_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info) { + bfd *obfd = info->output_bfd; flagword old_flags, old_partial; flagword new_flags, new_partial; bfd_boolean error = FALSE; @@ -824,8 +826,9 @@ iq2000_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) { error = TRUE; _bfd_error_handler - (_("%s: compiled with %s and linked with modules compiled with %s"), - bfd_get_filename (ibfd), new_opt, old_opt); + /* xgettext:c-format */ + (_("%pB: compiled with %s and linked with modules compiled with %s"), + ibfd, new_opt, old_opt); } new_flags &= ~ EF_IQ2000_ALL_FLAGS; @@ -837,8 +840,9 @@ iq2000_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) error = TRUE; _bfd_error_handler - (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), - bfd_get_filename (ibfd), (long)new_flags, (long)old_flags); + /* xgettext:c-format */ + (_("%pB: uses different e_flags (%#x) fields than previous modules (%#x)"), + ibfd, new_flags, old_flags); } }