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 COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
34 #define coff_relocate_section _bfd_coff_generic_relocate_section
36 static void rtype2howto PARAMS ((arelent *cache_ptr, struct internal_reloc *dst));
38 static reloc_howto_type tic80_howto_table[] =
41 HOWTO (R_RELLONG, /* type */
43 2, /* size (0 = byte, 1 = short, 2 = long) */
45 false, /* pc_relative */
47 complain_overflow_bitfield, /* complain_on_overflow */
48 NULL, /* special_function */
50 true, /* partial_inplace */
51 0xffffffff, /* src_mask */
52 0xffffffff, /* dst_mask */
53 false), /* pcrel_offset */
55 HOWTO (R_MPPCR, /* type */
57 2, /* size (0 = byte, 1 = short, 2 = long) */
59 true, /* pc_relative */
61 complain_overflow_dont, /* complain_on_overflow */
62 NULL, /* special_function */
64 true, /* partial_inplace */
65 0xffffffff, /* src_mask */
66 0xffffffff, /* dst_mask */
67 true), /* pcrel_offset */
69 HOWTO (R_ABS, /* type */
71 2, /* size (0 = byte, 1 = short, 2 = long) */
73 false, /* pc_relative */
75 complain_overflow_bitfield, /* complain_on_overflow */
76 NULL, /* special_function */
78 true, /* partial_inplace */
79 0xffffffff, /* src_mask */
80 0xffffffff, /* dst_mask */
81 false), /* pcrel_offset */
84 /* Code to turn an external r_type into a pointer to an entry in the howto_table.
85 If passed an r_type we don't recognize the abort rather than silently failing
86 to generate an output file. */
89 rtype2howto (cache_ptr, dst)
91 struct internal_reloc *dst;
93 switch (dst -> r_type)
95 default: abort (); break;
96 case R_RELLONG: cache_ptr -> howto = tic80_howto_table + 0; break;
97 case R_MPPCR: cache_ptr -> howto = tic80_howto_table + 1; break;
98 case R_ABS: cache_ptr -> howto = tic80_howto_table + 2; break;
102 #define RTYPE2HOWTO(cache_ptr, dst) rtype2howto (cache_ptr, dst)
103 #define coff_rtype_to_howto coff_tic80_rtype_to_howto
105 static reloc_howto_type *
106 coff_tic80_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
109 struct internal_reloc *rel;
110 struct coff_link_hash_entry *h;
111 struct internal_syment *sym;
116 if (rel -> r_symndx == -1 && addendp != NULL)
118 /* This is a TI "internal relocation", which means that the relocation
119 amount is the amount by which the current section is being relocated
120 in the output section. */
121 *addendp = (sec -> output_section -> vma + sec -> output_offset) - sec -> vma;
123 RTYPE2HOWTO (&genrel, rel);
128 #define BADMAG(x) TIC80BADMAG(x)
131 #define TIC80 1 /* Customize coffcode.h */
132 #include "coffcode.h"
137 "coff-tic80", /* name */
138 bfd_target_coff_flavour,
139 BFD_ENDIAN_LITTLE, /* data byte order is little (arch supports both) */
140 BFD_ENDIAN_LITTLE, /* header byte order is little */
142 (HAS_RELOC | EXEC_P | /* object flags */
143 HAS_LINENO | HAS_DEBUG |
144 HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
146 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
147 '_', /* leading underscore */
148 '/', /* ar_pad_char */
149 15, /* ar_max_namelen */
150 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
151 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
152 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
153 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
154 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
155 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
157 {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
158 bfd_generic_archive_p, _bfd_dummy_target},
159 {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
161 {bfd_false, coff_write_object_contents, /* bfd_write_contents */
162 _bfd_write_archive_contents, bfd_false},
164 BFD_JUMP_TABLE_GENERIC (coff),
165 BFD_JUMP_TABLE_COPY (coff),
166 BFD_JUMP_TABLE_CORE (_bfd_nocore),
167 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
168 BFD_JUMP_TABLE_SYMBOLS (coff),
169 BFD_JUMP_TABLE_RELOCS (coff),
170 BFD_JUMP_TABLE_WRITE (coff),
171 BFD_JUMP_TABLE_LINK (coff),
172 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),