1 /* BFD back-end for Texas Instruments TMS320C80 Multimedia Video Processor (MVP).
2 Copyright 1996 Free Software Foundation, Inc.
4 Written by Fred Fish (fnf@cygnus.com)
6 There is nothing new under the sun. This file draws a lot on other
9 This file is part of BFD, the Binary File Descriptor library.
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
29 #include "coff/tic80.h"
30 #include "coff/internal.h"
33 #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
35 #define coff_relocate_section _bfd_coff_generic_relocate_section
37 static void rtype2howto PARAMS ((arelent *cache_ptr, struct internal_reloc *dst));
39 static reloc_howto_type tic80_howto_table[] =
42 HOWTO (R_RELLONG, /* type */
44 2, /* size (0 = byte, 1 = short, 2 = long) */
46 false, /* pc_relative */
48 complain_overflow_bitfield, /* complain_on_overflow */
49 NULL, /* special_function */
51 true, /* partial_inplace */
52 0xffffffff, /* src_mask */
53 0xffffffff, /* dst_mask */
54 false), /* pcrel_offset */
56 HOWTO (R_MPPCR, /* type */
58 2, /* size (0 = byte, 1 = short, 2 = long) */
60 true, /* pc_relative */
62 complain_overflow_dont, /* complain_on_overflow */
63 NULL, /* special_function */
65 true, /* partial_inplace */
66 0xffffffff, /* src_mask */
67 0xffffffff, /* dst_mask */
68 true), /* pcrel_offset */
71 /* Code to turn an external r_type into a pointer to an entry in the howto_table.
72 If passed an r_type we don't recognize, just set the howto field to NULL and
73 the caller will print an appropriate error message. */
76 rtype2howto (cache_ptr, dst)
78 struct internal_reloc *dst;
80 switch (dst -> r_type)
82 default: cache_ptr -> howto = NULL; break;
83 case R_RELLONG: cache_ptr -> howto = tic80_howto_table + 0; break;
84 case R_MPPCR: cache_ptr -> howto = tic80_howto_table + 1; break;
88 #define RTYPE2HOWTO(cache_ptr, dst) rtype2howto (cache_ptr, dst)
89 #define coff_rtype_to_howto coff_tic80_rtype_to_howto
91 static reloc_howto_type *
92 coff_tic80_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
95 struct internal_reloc *rel;
96 struct coff_link_hash_entry *h;
97 struct internal_syment *sym;
102 if (rel -> r_symndx == -1 && addendp != NULL)
104 /* This is a TI "internal relocation", which means that the relocation
105 amount is the amount by which the current section is being relocated
106 in the output section. */
107 *addendp = (sec -> output_section -> vma + sec -> output_offset) - sec -> vma;
109 RTYPE2HOWTO (&genrel, rel);
114 #define BADMAG(x) TIC80BADMAG(x)
117 #define TIC80 1 /* Customize coffcode.h */
118 #include "coffcode.h"
130 "coff-tic80", /* name */
132 bfd_target_coff_flavour,
133 BFD_ENDIAN_LITTLE, /* data byte order is little (arch supports both) */
134 BFD_ENDIAN_LITTLE, /* header byte order is little */
136 (HAS_RELOC | EXEC_P | /* object flags */
137 HAS_LINENO | HAS_DEBUG |
138 HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
140 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
141 #ifdef NAMES_HAVE_UNDERSCORE
144 0, /* leading underscore */
146 '/', /* ar_pad_char */
147 15, /* ar_max_namelen */
148 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
149 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
150 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
151 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
152 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
153 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
155 {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
156 bfd_generic_archive_p, _bfd_dummy_target},
157 {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
159 {bfd_false, coff_write_object_contents, /* bfd_write_contents */
160 _bfd_write_archive_contents, bfd_false},
162 BFD_JUMP_TABLE_GENERIC (coff),
163 BFD_JUMP_TABLE_COPY (coff),
164 BFD_JUMP_TABLE_CORE (_bfd_nocore),
165 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
166 BFD_JUMP_TABLE_SYMBOLS (coff),
167 BFD_JUMP_TABLE_RELOCS (coff),
168 BFD_JUMP_TABLE_WRITE (coff),
169 BFD_JUMP_TABLE_LINK (coff),
170 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),