X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Felf32-d10v.c;h=5c0dd95af82a587d03bcc72184b9a0ca7b05f3cb;hb=ec892a0718dc47c2d009532865c353daa749eaa1;hp=a5e5395163c50cd73d9de576622a07c54ed2a01c;hpb=5582a088529adbefbcf65cfa3e6f47fa087153a2;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c index a5e5395163..5c0dd95af8 100644 --- a/bfd/elf32-d10v.c +++ b/bfd/elf32-d10v.c @@ -1,6 +1,5 @@ /* D10V-specific support for 32-bit ELF - Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007 Free Software Foundation, Inc. + Copyright (C) 1996-2015 Free Software Foundation, Inc. Contributed by Martin Hunt (hunt@cygnus.com). This file is part of BFD, the Binary File Descriptor library. @@ -34,8 +33,8 @@ static reloc_howto_type elf_d10v_howto_table[] = /* This reloc does nothing. */ HOWTO (R_D10V_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_dont,/* Complain_on_overflow. */ @@ -229,7 +228,11 @@ d10v_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, unsigned int r_type; r_type = ELF32_R_TYPE (dst->r_info); - BFD_ASSERT (r_type < (unsigned int) R_D10V_max); + if (r_type >= (unsigned int) R_D10V_max) + { + _bfd_error_handler (_("%B: invalid D10V reloc number: %d"), abfd, r_type); + r_type = 0; + } cache_ptr->howto = &elf_d10v_howto_table[r_type]; } @@ -266,7 +269,7 @@ elf32_d10v_check_relocs (bfd *abfd, const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; - if (info->relocatable) + if (bfd_link_relocatable (info)) return TRUE; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; @@ -287,6 +290,10 @@ elf32_d10v_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)) @@ -432,7 +439,7 @@ elf32_d10v_relocate_section (bfd *output_bfd, + sym->st_value); if (ELF_ST_TYPE (sym->st_info) == STT_SECTION && ((sec->flags & SEC_MERGE) != 0 - || (info->relocatable + || (bfd_link_relocatable (info) && sec->output_offset != 0))) { bfd_vma addend; @@ -440,7 +447,7 @@ elf32_d10v_relocate_section (bfd *output_bfd, addend = extract_rel_addend (input_bfd, where, howto); - if (info->relocatable) + if (bfd_link_relocatable (info)) addend += sec->output_offset; else { @@ -455,26 +462,19 @@ elf32_d10v_relocate_section (bfd *output_bfd, } else { - bfd_boolean unresolved_reloc, warned; + bfd_boolean unresolved_reloc, warned, ignored; RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, r_symndx, symtab_hdr, sym_hashes, h, sec, relocation, - unresolved_reloc, warned); + unresolved_reloc, warned, ignored); } - if (sec != NULL && elf_discarded_section (sec)) - { - /* For relocs against symbols from removed linkonce sections, - or sections discarded by a linker script, we just want the - section contents zeroed. Avoid any special processing. */ - _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset); - rel->r_info = 0; - rel->r_addend = 0; - continue; - } + if (sec != NULL && discarded_section (sec)) + RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, + rel, 1, relend, howto, 0, contents); - if (info->relocatable) + if (bfd_link_relocatable (info)) continue; if (h != NULL) @@ -545,7 +545,7 @@ elf32_d10v_relocate_section (bfd *output_bfd, #define ELF_MACHINE_ALT1 EM_CYGNUS_D10V #define ELF_MAXPAGESIZE 0x1000 -#define TARGET_BIG_SYM bfd_elf32_d10v_vec +#define TARGET_BIG_SYM d10v_elf32_vec #define TARGET_BIG_NAME "elf32-d10v" #define elf_info_to_howto 0