X-Git-Url: http://drtracing.org/?a=blobdiff_plain;ds=sidebyside;f=bfd%2Fcoff-h8300.c;h=c258306b0bc286b91aa202f7f9e642204fe0eecf;hb=1fe0971e41a4097610862acabf54a896695fe834;hp=0f8dbda1ea02badf01d5679cc48f109eb991e495;hpb=cd123cb70c845b890eed231a84e6e84c92c2ef92;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c index 0f8dbda1ea..c258306b0b 100644 --- a/bfd/coff-h8300.c +++ b/bfd/coff-h8300.c @@ -1,7 +1,5 @@ /* BFD back-end for Renesas H8/300 COFF binaries. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 - Free Software Foundation, Inc. + Copyright (C) 1990-2016 Free Software Foundation, Inc. Written by Steve Chamberlain, . This file is part of BFD, the Binary File Descriptor library. @@ -60,28 +58,6 @@ struct funcvec_hash_table unsigned int offset; }; -static struct bfd_hash_entry * -funcvec_hash_newfunc - (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); - -static bfd_reloc_status_type special - (bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **); -static int select_reloc - (reloc_howto_type *); -static void rtype2howto - (arelent *, struct internal_reloc *); -static void reloc_processing - (arelent *, struct internal_reloc *, asymbol **, bfd *, asection *); -static bfd_boolean h8300_symbol_address_p - (bfd *, asection *, bfd_vma); -static int h8300_reloc16_estimate - (bfd *, asection *, arelent *, unsigned int, - struct bfd_link_info *); -static void h8300_reloc16_extra_cases - (bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, - bfd_byte *, unsigned int *, unsigned int *); -static bfd_boolean h8300_bfd_link_add_symbols - (bfd *, struct bfd_link_info *); /* To lookup a value in the function vector hash table. */ #define funcvec_hash_lookup(table, string, create, copy) \ @@ -195,7 +171,7 @@ h8300_coff_link_hash_table_create (bfd *abfd) struct h8300_coff_link_hash_table *ret; bfd_size_type amt = sizeof (struct h8300_coff_link_hash_table); - ret = (struct h8300_coff_link_hash_table *) bfd_malloc (amt); + ret = (struct h8300_coff_link_hash_table *) bfd_zmalloc (amt); if (ret == NULL) return NULL; if (!_bfd_link_hash_table_init (&ret->root.root, abfd, @@ -206,11 +182,6 @@ h8300_coff_link_hash_table_create (bfd *abfd) return NULL; } - /* Initialize our data. */ - ret->vectors_sec = NULL; - ret->funcvec_hash_table = NULL; - - /* OK. Everything's initialized, return the base pointer. */ return &ret->root.root; } @@ -224,13 +195,13 @@ h8300_coff_link_hash_table_create (bfd *abfd) the addend until the final link. */ static bfd_reloc_status_type -special (bfd *abfd ATTRIBUTE_UNUSED, - arelent *reloc_entry ATTRIBUTE_UNUSED, - asymbol *symbol ATTRIBUTE_UNUSED, - PTR data ATTRIBUTE_UNUSED, - asection *input_section ATTRIBUTE_UNUSED, - bfd *output_bfd, - char **error_message ATTRIBUTE_UNUSED) +special (bfd * abfd ATTRIBUTE_UNUSED, + arelent * reloc_entry ATTRIBUTE_UNUSED, + asymbol * symbol ATTRIBUTE_UNUSED, + void * data ATTRIBUTE_UNUSED, + asection * input_section ATTRIBUTE_UNUSED, + bfd * output_bfd, + char ** error_message ATTRIBUTE_UNUSED) { if (output_bfd == (bfd *) NULL) return bfd_reloc_continue; @@ -240,7 +211,8 @@ special (bfd *abfd ATTRIBUTE_UNUSED, return bfd_reloc_ok; } -static reloc_howto_type howto_table[] = { +static reloc_howto_type howto_table[] = +{ HOWTO (R_RELBYTE, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, special, "8", FALSE, 0x000000ff, 0x000000ff, FALSE), HOWTO (R_RELWORD, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, special, "16", FALSE, 0x0000ffff, 0x0000ffff, FALSE), HOWTO (R_RELLONG, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, special, "32", FALSE, 0xffffffff, 0xffffffff, FALSE), @@ -365,7 +337,7 @@ rtype2howto (arelent *internal, struct internal_reloc *dst) internal->howto = howto_table + 19; break; default: - abort (); + internal->howto = NULL; break; } } @@ -675,14 +647,10 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info, /* Sanity check. */ if (gap < -128 || gap > 126) - { - if (! ((*link_info->callbacks->reloc_overflow) - (link_info, NULL, - bfd_asymbol_name (*reloc->sym_ptr_ptr), - reloc->howto->name, reloc->addend, input_section->owner, - input_section, reloc->address))) - abort (); - } + (*link_info->callbacks->reloc_overflow) + (link_info, NULL, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address); /* Everything looks OK. Apply the relocation and update the src/dst address appropriately. */ @@ -707,14 +675,10 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info, /* Sanity check. */ if (gap > 32766 || gap < -32768) - { - if (! ((*link_info->callbacks->reloc_overflow) - (link_info, NULL, - bfd_asymbol_name (*reloc->sym_ptr_ptr), - reloc->howto->name, reloc->addend, input_section->owner, - input_section, reloc->address))) - abort (); - } + (*link_info->callbacks->reloc_overflow) + (link_info, NULL, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address); /* Everything looks OK. Apply the relocation and update the src/dst address appropriately. */ @@ -797,14 +761,10 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info, src_address += 4; } else - { - if (! ((*link_info->callbacks->reloc_overflow) - (link_info, NULL, - bfd_asymbol_name (*reloc->sym_ptr_ptr), - reloc->howto->name, reloc->addend, input_section->owner, - input_section, reloc->address))) - abort (); - } + (*link_info->callbacks->reloc_overflow) + (link_info, NULL, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address); break; /* A 16-bit absolute branch that is now an 8-bit pc-relative branch. */ @@ -821,14 +781,10 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info, /* Sanity check. */ if (gap < -128 || gap > 126) - { - if (! ((*link_info->callbacks->reloc_overflow) - (link_info, NULL, - bfd_asymbol_name (*reloc->sym_ptr_ptr), - reloc->howto->name, reloc->addend, input_section->owner, - input_section, reloc->address))) - abort (); - } + (*link_info->callbacks->reloc_overflow) + (link_info, NULL, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address); /* Now fix the instruction itself. */ switch (data[dst_address - 1]) @@ -868,14 +824,10 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info, /* Sanity check. */ if (gap < -128 || gap > 126) - { - if (! ((*link_info->callbacks->reloc_overflow) - (link_info, NULL, - bfd_asymbol_name (*reloc->sym_ptr_ptr), - reloc->howto->name, reloc->addend, input_section->owner, - input_section, reloc->address))) - abort (); - } + (*link_info->callbacks->reloc_overflow) + (link_info, NULL, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address); /* Now fix the instruction. */ switch (data[dst_address - 2]) @@ -1068,14 +1020,10 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info, /* Sanity check. */ if (gap < -128 || gap > 126) - { - if (! ((*link_info->callbacks->reloc_overflow) - (link_info, NULL, - bfd_asymbol_name (*reloc->sym_ptr_ptr), - reloc->howto->name, reloc->addend, input_section->owner, - input_section, reloc->address))) - abort (); - } + (*link_info->callbacks->reloc_overflow) + (link_info, NULL, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address); /* Everything looks OK. Fix the condition in the instruction, apply the relocation, and update the src/dst address appropriately. */ @@ -1116,11 +1064,11 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info, struct h8300_coff_link_hash_table *htab; asection *vectors_sec; - if (link_info->hash->creator != abfd->xvec) + if (link_info->output_bfd->xvec != abfd->xvec) { (*_bfd_error_handler) (_("cannot handle R_MEM_INDIRECT reloc when using %s output"), - link_info->hash->creator->name); + link_info->output_bfd->xvec->name); /* What else can we do? This function doesn't allow return of an error, and we don't want to call abort as that @@ -1151,14 +1099,10 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info, src_address += 1; } else - { - if (! ((*link_info->callbacks->reloc_overflow) - (link_info, NULL, - bfd_asymbol_name (*reloc->sym_ptr_ptr), - reloc->howto->name, reloc->addend, input_section->owner, - input_section, reloc->address))) - abort (); - } + (*link_info->callbacks->reloc_overflow) + (link_info, NULL, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address); break; } @@ -1264,7 +1208,7 @@ h8300_bfd_link_add_symbols (bfd *abfd, struct bfd_link_info *info) /* Add the symbols using the generic code. */ _bfd_generic_link_add_symbols (abfd, info); - if (info->hash->creator != abfd->xvec) + if (info->output_bfd->xvec != abfd->xvec) return TRUE; htab = h8300_coff_hash_table (info); @@ -1429,6 +1373,11 @@ h8300_bfd_link_add_symbols (bfd *abfd, struct bfd_link_info *info) #define coff_bfd_link_hash_table_create h8300_coff_link_hash_table_create #define COFF_LONG_FILENAMES + +#ifndef bfd_pe_print_pdata +#define bfd_pe_print_pdata NULL +#endif + #include "coffcode.h" #undef coff_bfd_get_relocated_section_contents @@ -1437,4 +1386,4 @@ h8300_bfd_link_add_symbols (bfd *abfd, struct bfd_link_info *info) bfd_coff_reloc16_get_relocated_section_contents #define coff_bfd_relax_section bfd_coff_reloc16_relax_section -CREATE_BIG_COFF_TARGET_VEC (h8300coff_vec, "coff-h8300", BFD_IS_RELAXABLE, 0, '_', NULL, COFF_SWAP_TABLE) +CREATE_BIG_COFF_TARGET_VEC (h8300_coff_vec, "coff-h8300", BFD_IS_RELAXABLE, 0, '_', NULL, COFF_SWAP_TABLE)