X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Fcoff-tic30.c;h=abb8f8f01c2a2b82e3be6cd3cc5e15b83132e090;hb=e46d79a76ea748165a3ecd1102dd10498d089a49;hp=de0870afcbd9fc596f21e4d5d26d4c78e5f33f9b;hpb=53e09e0aaf3d13e4b893744e2fe79edde7edfd20;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/coff-tic30.c b/bfd/coff-tic30.c index de0870afcb..abb8f8f01c 100644 --- a/bfd/coff-tic30.c +++ b/bfd/coff-tic30.c @@ -1,12 +1,12 @@ /* BFD back-end for TMS320C30 coff binaries. - Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1998-2019 Free Software Foundation, Inc. Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au) 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, @@ -16,23 +16,17 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "libbfd.h" #include "bfdlink.h" #include "coff/tic30.h" #include "coff/internal.h" #include "libcoff.h" -static int coff_tic30_select_reloc PARAMS ((reloc_howto_type *)); -static void rtype2howto PARAMS ((arelent *, struct internal_reloc *)); -static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); - -reloc_howto_type * tic30_coff_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); - #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1) reloc_howto_type tic30_coff_howto_table[] = @@ -52,15 +46,15 @@ reloc_howto_type tic30_coff_howto_table[] = #ifndef coff_bfd_reloc_type_lookup #define coff_bfd_reloc_type_lookup tic30_coff_reloc_type_lookup +#define coff_bfd_reloc_name_lookup tic30_coff_reloc_name_lookup /* For the case statement use the code values used in tc_gen_reloc to map to the howto table entries that match those in both the aout and coff implementations. */ -reloc_howto_type * -tic30_coff_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; +static reloc_howto_type * +tic30_coff_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) { switch (code) { @@ -80,13 +74,29 @@ tic30_coff_reloc_type_lookup (abfd, code) } } +static reloc_howto_type * +tic30_coff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (tic30_coff_howto_table) + / sizeof (tic30_coff_howto_table[0])); + i++) + if (tic30_coff_howto_table[i].name != NULL + && strcasecmp (tic30_coff_howto_table[i].name, r_name) == 0) + return &tic30_coff_howto_table[i]; + + return NULL; +} + #endif /* Turn a howto into a reloc number. */ static int -coff_tic30_select_reloc (howto) - reloc_howto_type *howto; +coff_tic30_select_reloc (reloc_howto_type *howto) { return howto->type; } @@ -106,9 +116,7 @@ dst->r_stuff[1] = 'C'; /* Code to turn a r_type into a howto ptr, uses the above howto table. */ static void -rtype2howto (internal, dst) - arelent *internal; - struct internal_reloc *dst; +rtype2howto (arelent *internal, struct internal_reloc *dst) { switch (dst->r_type) { @@ -128,7 +136,7 @@ rtype2howto (internal, dst) internal->howto = &tic30_coff_howto_table[4]; break; default: - abort (); + internal->howto = NULL; break; } } @@ -144,12 +152,11 @@ rtype2howto (internal, dst) reloc_processing(relent, reloc, symbols, abfd, section) static void -reloc_processing (relent, reloc, symbols, abfd, section) - arelent *relent; - struct internal_reloc *reloc; - asymbol **symbols; - bfd *abfd; - asection *section; +reloc_processing (arelent *relent, + struct internal_reloc *reloc, + asymbol **symbols, + bfd *abfd, + asection *section) { relent->address = reloc->r_vaddr; rtype2howto (relent, reloc); @@ -163,6 +170,10 @@ reloc_processing (relent, reloc, symbols, abfd, section) relent->address -= section->vma; } +#ifndef bfd_pe_print_pdata +#define bfd_pe_print_pdata NULL +#endif + #include "coffcode.h" const bfd_target tic30_coff_vec = @@ -172,14 +183,15 @@ const bfd_target tic30_coff_vec = BFD_ENDIAN_BIG, /* data byte order is big */ BFD_ENDIAN_LITTLE, /* header byte order is little */ - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT), + (HAS_RELOC | EXEC_P /* object flags */ + | HAS_LINENO | HAS_DEBUG + | HAS_SYMS | HAS_LOCALS | WP_TEXT), (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ '_', /* leading symbol underscore */ '/', /* ar_pad_char */ 15, /* ar_max_namelen */ + 0, /* match priority. */ bfd_getb64, bfd_getb_signed_64, bfd_putb64, bfd_getb32, bfd_getb_signed_32, bfd_putb32, bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ @@ -187,12 +199,24 @@ const bfd_target tic30_coff_vec = bfd_getl32, bfd_getl_signed_32, bfd_putl32, bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ - {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ - bfd_generic_archive_p, _bfd_dummy_target}, - {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ - bfd_false}, - {bfd_false, coff_write_object_contents, /* bfd_write_contents */ - _bfd_write_archive_contents, bfd_false}, + { /* bfd_check_format */ + _bfd_dummy_target, + coff_object_p, + bfd_generic_archive_p, + _bfd_dummy_target + }, + { /* bfd_set_format */ + _bfd_bool_bfd_false_error, + coff_mkobject, + _bfd_generic_mkarchive, + _bfd_bool_bfd_false_error + }, + { /* bfd_write_contents */ + _bfd_bool_bfd_false_error, + coff_write_object_contents, + _bfd_write_archive_contents, + _bfd_bool_bfd_false_error + }, BFD_JUMP_TABLE_GENERIC (coff), BFD_JUMP_TABLE_COPY (coff),