1 /* BFD back-end for Texas Instruments TMS320C80 Multimedia Video Processor (MVP).
2 Copyright 1996, 1997 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. */
28 #include "coff/tic80.h"
29 #include "coff/internal.h"
32 #define NAMES_HAVE_UNDERSCORE
34 #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
36 #define coff_relocate_section _bfd_coff_generic_relocate_section
38 static void rtype2howto PARAMS ((arelent *cache_ptr, struct internal_reloc *dst));
40 static reloc_howto_type tic80_howto_table[] =
43 HOWTO (R_RELLONG, /* type */
45 2, /* size (0 = byte, 1 = short, 2 = long) */
47 false, /* pc_relative */
49 complain_overflow_bitfield, /* complain_on_overflow */
50 NULL, /* special_function */
52 true, /* partial_inplace */
53 0xffffffff, /* src_mask */
54 0xffffffff, /* dst_mask */
55 false), /* pcrel_offset */
57 HOWTO (R_MPPCR, /* type */
59 2, /* size (0 = byte, 1 = short, 2 = long) */
61 true, /* pc_relative */
63 complain_overflow_dont, /* complain_on_overflow */
64 NULL, /* special_function */
66 true, /* partial_inplace */
67 0xffffffff, /* src_mask */
68 0xffffffff, /* dst_mask */
69 true), /* pcrel_offset */
71 HOWTO (R_ABS, /* type */
73 2, /* size (0 = byte, 1 = short, 2 = long) */
75 false, /* pc_relative */
77 complain_overflow_bitfield, /* complain_on_overflow */
78 NULL, /* special_function */
80 true, /* partial_inplace */
81 0xffffffff, /* src_mask */
82 0xffffffff, /* dst_mask */
83 false), /* pcrel_offset */
86 /* Code to turn an external r_type into a pointer to an entry in the howto_table.
87 If passed an r_type we don't recognize the abort rather than silently failing
88 to generate an output file. */
91 rtype2howto (cache_ptr, dst)
93 struct internal_reloc *dst;
95 switch (dst -> r_type)
97 default: abort (); break;
98 case R_RELLONG: cache_ptr -> howto = tic80_howto_table + 0; break;
99 case R_MPPCR: cache_ptr -> howto = tic80_howto_table + 1; break;
100 case R_ABS: cache_ptr -> howto = tic80_howto_table + 2; break;
104 #define RTYPE2HOWTO(cache_ptr, dst) rtype2howto (cache_ptr, dst)
105 #define coff_rtype_to_howto coff_tic80_rtype_to_howto
107 static reloc_howto_type *
108 coff_tic80_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
111 struct internal_reloc *rel;
112 struct coff_link_hash_entry *h;
113 struct internal_syment *sym;
118 if (rel -> r_symndx == -1 && addendp != NULL)
120 /* This is a TI "internal relocation", which means that the relocation
121 amount is the amount by which the current section is being relocated
122 in the output section. */
123 *addendp = (sec -> output_section -> vma + sec -> output_offset) - sec -> vma;
125 RTYPE2HOWTO (&genrel, rel);
130 #define BADMAG(x) TIC80BADMAG(x)
133 #define TIC80 1 /* Customize coffcode.h */
134 #include "coffcode.h"
146 "coff-tic80", /* name */
148 bfd_target_coff_flavour,
149 BFD_ENDIAN_LITTLE, /* data byte order is little (arch supports both) */
150 BFD_ENDIAN_LITTLE, /* header byte order is little */
152 (HAS_RELOC | EXEC_P | /* object flags */
153 HAS_LINENO | HAS_DEBUG |
154 HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
156 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
157 #ifdef NAMES_HAVE_UNDERSCORE
160 0, /* leading underscore */
162 '/', /* ar_pad_char */
163 15, /* ar_max_namelen */
164 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
165 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
166 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
167 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
168 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
169 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
171 {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
172 bfd_generic_archive_p, _bfd_dummy_target},
173 {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
175 {bfd_false, coff_write_object_contents, /* bfd_write_contents */
176 _bfd_write_archive_contents, bfd_false},
178 BFD_JUMP_TABLE_GENERIC (coff),
179 BFD_JUMP_TABLE_COPY (coff),
180 BFD_JUMP_TABLE_CORE (_bfd_nocore),
181 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
182 BFD_JUMP_TABLE_SYMBOLS (coff),
183 BFD_JUMP_TABLE_RELOCS (coff),
184 BFD_JUMP_TABLE_WRITE (coff),
185 BFD_JUMP_TABLE_LINK (coff),
186 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),