X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Felf32-v850.c;h=fa9dedf445644057334efafaa495cd26e477994e;hb=a590713d048e9d3df9227cf98c1fe75b95aa3060;hp=327edfa74b12bfc6c3f51ff6f2968756964f25aa;hpb=ab96bf03fd98b6f68cd213ac81f52be3aca9c435;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index 327edfa74b..fa9dedf445 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -1,12 +1,12 @@ /* V850-specific support for 32-bit ELF Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007 Free Software Foundation, Inc. + 2006, 2007, 2008 Free Software Foundation, Inc. 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, @@ -19,11 +19,12 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + /* XXX FIXME: This code is littered with 32bit int, 16bit short, 8bit char dependencies. As is the gas & simulator code for the v850. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" #include "elf-bfd.h" @@ -51,7 +52,6 @@ v850_elf_check_relocs (bfd *abfd, struct elf_link_hash_entry **sym_hashes; const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; - asection *sreloc; enum v850_reloc_type r_type; int other = 0; const char *common = NULL; @@ -67,7 +67,6 @@ v850_elf_check_relocs (bfd *abfd, dynobj = elf_hash_table (info)->dynobj; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); - sreloc = NULL; rel_end = relocs + sec->reloc_count; for (rel = relocs; rel < rel_end; rel++) @@ -115,7 +114,9 @@ v850_elf_check_relocs (bfd *abfd, /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_V850_GNU_VTENTRY: - if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + BFD_ASSERT (h != NULL); + if (h != NULL + && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; @@ -1339,6 +1340,22 @@ v850_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } + +static reloc_howto_type * +v850_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (v850_elf_howto_table) / sizeof (v850_elf_howto_table[0]); + i++) + if (v850_elf_howto_table[i].name != NULL + && strcasecmp (v850_elf_howto_table[i].name, r_name) == 0) + return &v850_elf_howto_table[i]; + + return NULL; +} /* Set the howto pointer for an V850 ELF reloc. */ @@ -1663,7 +1680,7 @@ v850_elf_relocate_section (bfd *output_bfd, name = bfd_section_name (input_bfd, sec); } - switch (r) + switch ((int) r) { case bfd_reloc_overflow: if (! ((*info->callbacks->reloc_overflow) @@ -2078,7 +2095,7 @@ v850_elf_add_symbol_hook (bfd *abfd, return TRUE; } -static bfd_boolean +static int v850_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED, const char *name ATTRIBUTE_UNUSED, Elf_Internal_Sym *sym, @@ -2099,7 +2116,13 @@ v850_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED, sym->st_shndx = SHN_V850_ZCOMMON; } - return TRUE; + /* The price we pay for using h->other unused bits as flags in the + linker is cleaning up after ourselves. */ + + sym->st_other &= ~(V850_OTHER_SDA | V850_OTHER_ZDA | V850_OTHER_TDA + | V850_OTHER_ERROR); + + return 1; } static bfd_boolean @@ -3067,6 +3090,7 @@ static const struct bfd_elf_special_section v850_elf_special_sections[] = #define bfd_elf32_bfd_is_local_label_name v850_elf_is_local_label_name #define bfd_elf32_bfd_reloc_type_lookup v850_elf_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup v850_elf_reloc_name_lookup #define bfd_elf32_bfd_merge_private_bfd_data v850_elf_merge_private_bfd_data #define bfd_elf32_bfd_set_private_flags v850_elf_set_private_flags #define bfd_elf32_bfd_print_private_bfd_data v850_elf_print_private_bfd_data