]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - bfd/coff-tic54x.c
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / bfd / coff-tic54x.c
CommitLineData
81635ce4 1/* BFD back-end for TMS320C54X coff binaries.
d87bef3a 2 Copyright (C) 1999-2023 Free Software Foundation, Inc.
a44f2895 3 Contributed by Timothy Wall (twall@cygnus.com)
81635ce4
TW
4
5 This file is part of BFD, the Binary File Descriptor library.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
cd123cb7 9 the Free Software Foundation; either version 3 of the License, or
81635ce4
TW
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
3e110533 19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
53e09e0a 20 02110-1301, USA. */
81635ce4 21
81635ce4 22#include "sysdep.h"
3db64b00 23#include "bfd.h"
81635ce4
TW
24#include "libbfd.h"
25#include "bfdlink.h"
26#include "coff/tic54x.h"
27#include "coff/internal.h"
28#include "libcoff.h"
29
f4ffd778 30#undef F_LSYMS
81635ce4
TW
31#define F_LSYMS F_LSYMS_TICOFF
32
2c3fc389
NC
33static void
34tic54x_reloc_processing (arelent *, struct internal_reloc *,
35 asymbol **, bfd *, asection *);
f4ffd778
NC
36
37/* 32-bit operations
38 The octet order is screwy. words are LSB first (LS octet, actually), but
39 longwords are MSW first. For example, 0x12345678 is encoded 0x5678 in the
40 first word and 0x1234 in the second. When looking at the data as stored in
41 the COFF file, you would see the octets ordered as 0x78, 0x56, 0x34, 0x12.
42 Don't bother with 64-bits, as there aren't any. */
43
81635ce4 44static bfd_vma
edeb6e24 45tic54x_getl32 (const void *p)
81635ce4 46{
edeb6e24 47 const bfd_byte *addr = p;
81635ce4 48 unsigned long v;
f4ffd778
NC
49
50 v = (unsigned long) addr[2];
81635ce4
TW
51 v |= (unsigned long) addr[3] << 8;
52 v |= (unsigned long) addr[0] << 16;
53 v |= (unsigned long) addr[1] << 24;
edeb6e24 54 return v;
81635ce4
TW
55}
56
57static void
edeb6e24 58tic54x_putl32 (bfd_vma data, void *p)
81635ce4 59{
edeb6e24
AM
60 bfd_byte *addr = p;
61 addr[2] = data & 0xff;
62 addr[3] = (data >> 8) & 0xff;
63 addr[0] = (data >> 16) & 0xff;
64 addr[1] = (data >> 24) & 0xff;
81635ce4
TW
65}
66
edeb6e24
AM
67static bfd_signed_vma
68tic54x_getl_signed_32 (const void *p)
81635ce4 69{
edeb6e24 70 const bfd_byte *addr = p;
81635ce4
TW
71 unsigned long v;
72
f4ffd778 73 v = (unsigned long) addr[2];
81635ce4
TW
74 v |= (unsigned long) addr[3] << 8;
75 v |= (unsigned long) addr[0] << 16;
76 v |= (unsigned long) addr[1] << 24;
77#define COERCE32(x) \
78 ((bfd_signed_vma) (long) (((unsigned long) (x) ^ 0x80000000) - 0x80000000))
79 return COERCE32 (v);
80}
81
b9af77f5
TW
82#define coff_get_section_load_page bfd_ticoff_get_section_load_page
83#define coff_set_section_load_page bfd_ticoff_set_section_load_page
84
c348479d 85static void
2c3fc389
NC
86bfd_ticoff_set_section_load_page (asection *sect,
87 int page)
b9af77f5
TW
88{
89 sect->lma = (sect->lma & ADDR_MASK) | PG_TO_FLAG(page);
90}
91
c348479d 92static int
2c3fc389 93bfd_ticoff_get_section_load_page (asection *sect)
b9af77f5
TW
94{
95 int page;
96
cbfe05c4 97 /* Provide meaningful defaults for predefined sections. */
45dfa85a 98 if (sect == bfd_com_section_ptr)
b9af77f5
TW
99 page = PG_DATA;
100
45dfa85a
AM
101 else if (bfd_is_und_section (sect)
102 || bfd_is_abs_section (sect)
103 || bfd_is_ind_section (sect))
b9af77f5
TW
104 page = PG_PROG;
105
106 else
107 page = FLAG_TO_PG (sect->lma);
108
109 return page;
110}
111
112/* Set the architecture appropriately. Allow unkown architectures
cbfe05c4 113 (e.g. binary). */
f4ffd778 114
0a1b45a2 115static bool
2c3fc389
NC
116tic54x_set_arch_mach (bfd *abfd,
117 enum bfd_architecture arch,
118 unsigned long machine)
b9af77f5
TW
119{
120 if (arch == bfd_arch_unknown)
121 arch = bfd_arch_tic54x;
122
123 else if (arch != bfd_arch_tic54x)
0a1b45a2 124 return false;
b9af77f5
TW
125
126 return bfd_default_set_arch_mach (abfd, arch, machine);
127}
128
81635ce4 129static bfd_reloc_status_type
2c3fc389
NC
130tic54x_relocation (bfd *abfd ATTRIBUTE_UNUSED,
131 arelent *reloc_entry,
132 asymbol *symbol ATTRIBUTE_UNUSED,
133 void * data ATTRIBUTE_UNUSED,
134 asection *input_section,
135 bfd *output_bfd,
136 char **error_message ATTRIBUTE_UNUSED)
81635ce4 137{
81635ce4
TW
138 if (output_bfd != (bfd *) NULL)
139 {
140 /* This is a partial relocation, and we want to apply the
07d6d2b8
AM
141 relocation to the reloc entry rather than the raw data.
142 Modify the reloc inplace to reflect what we now know. */
81635ce4
TW
143 reloc_entry->address += input_section->output_offset;
144 return bfd_reloc_ok;
145 }
146 return bfd_reloc_continue;
147}
148
149reloc_howto_type tic54x_howto_table[] =
f4ffd778 150 {
c94cb026 151 /* type,rightshift,size,
f4ffd778
NC
152 bit size, pc_relative, bitpos, dont complain_on_overflow,
153 special_function, name, partial_inplace, src_mask, dst_mask, pcrel_offset. */
154
155 /* NORMAL BANK */
156 /* 16-bit direct reference to symbol's address. */
c94cb026 157 HOWTO (R_RELWORD,0,2,16,false,0,complain_overflow_dont,
0a1b45a2 158 tic54x_relocation,"REL16",false,0xFFFF,0xFFFF,false),
f4ffd778
NC
159
160 /* 7 LSBs of an address */
c94cb026 161 HOWTO (R_PARTLS7,0,2,7,false,0,complain_overflow_dont,
0a1b45a2 162 tic54x_relocation,"LS7",false,0x007F,0x007F,false),
f4ffd778
NC
163
164 /* 9 MSBs of an address */
165 /* TI assembler doesn't shift its encoding, and is thus incompatible */
c94cb026 166 HOWTO (R_PARTMS9,7,2,9,false,0,complain_overflow_dont,
0a1b45a2 167 tic54x_relocation,"MS9",false,0x01FF,0x01FF,false),
f4ffd778
NC
168
169 /* 23-bit relocation */
c94cb026 170 HOWTO (R_EXTWORD,0,4,23,false,0,complain_overflow_dont,
0a1b45a2 171 tic54x_relocation,"RELEXT",false,0x7FFFFF,0x7FFFFF,false),
f4ffd778
NC
172
173 /* 16 bits of 23-bit extended address */
c94cb026 174 HOWTO (R_EXTWORD16,0,2,16,false,0,complain_overflow_dont,
0a1b45a2 175 tic54x_relocation,"RELEXT16",false,0x7FFFFF,0x7FFFFF,false),
f4ffd778
NC
176
177 /* upper 7 bits of 23-bit extended address */
c94cb026 178 HOWTO (R_EXTWORDMS7,16,2,7,false,0,complain_overflow_dont,
0a1b45a2 179 tic54x_relocation,"RELEXTMS7",false,0x7F,0x7F,false),
f4ffd778
NC
180
181 /* ABSOLUTE BANK */
182 /* 16-bit direct reference to symbol's address, absolute */
c94cb026 183 HOWTO (R_RELWORD,0,2,16,false,0,complain_overflow_dont,
0a1b45a2 184 tic54x_relocation,"AREL16",false,0xFFFF,0xFFFF,false),
f4ffd778
NC
185
186 /* 7 LSBs of an address, absolute */
c94cb026 187 HOWTO (R_PARTLS7,0,2,7,false,0,complain_overflow_dont,
0a1b45a2 188 tic54x_relocation,"ALS7",false,0x007F,0x007F,false),
f4ffd778
NC
189
190 /* 9 MSBs of an address, absolute */
191 /* TI assembler doesn't shift its encoding, and is thus incompatible */
c94cb026 192 HOWTO (R_PARTMS9,7,2,9,false,0,complain_overflow_dont,
0a1b45a2 193 tic54x_relocation,"AMS9",false,0x01FF,0x01FF,false),
f4ffd778
NC
194
195 /* 23-bit direct reference, absolute */
c94cb026 196 HOWTO (R_EXTWORD,0,4,23,false,0,complain_overflow_dont,
0a1b45a2 197 tic54x_relocation,"ARELEXT",false,0x7FFFFF,0x7FFFFF,false),
f4ffd778
NC
198
199 /* 16 bits of 23-bit extended address, absolute */
c94cb026 200 HOWTO (R_EXTWORD16,0,2,16,false,0,complain_overflow_dont,
0a1b45a2 201 tic54x_relocation,"ARELEXT16",false,0x7FFFFF,0x7FFFFF,false),
f4ffd778
NC
202
203 /* upper 7 bits of 23-bit extended address, absolute */
c94cb026 204 HOWTO (R_EXTWORDMS7,16,2,7,false,0,complain_overflow_dont,
0a1b45a2 205 tic54x_relocation,"ARELEXTMS7",false,0x7F,0x7F,false),
f4ffd778
NC
206
207 /* 32-bit relocation exclusively for stabs */
c94cb026 208 HOWTO (R_RELLONG,0,4,32,false,0,complain_overflow_dont,
0a1b45a2 209 tic54x_relocation,"STAB",false,0xFFFFFFFF,0xFFFFFFFF,false),
f4ffd778 210 };
81635ce4
TW
211
212#define coff_bfd_reloc_type_lookup tic54x_coff_reloc_type_lookup
157090f7 213#define coff_bfd_reloc_name_lookup tic54x_coff_reloc_name_lookup
81635ce4
TW
214
215/* For the case statement use the code values used tc_gen_reloc (defined in
f4ffd778
NC
216 bfd/reloc.c) to map to the howto table entries. */
217
2c3fc389
NC
218static reloc_howto_type *
219tic54x_coff_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
220 bfd_reloc_code_real_type code)
81635ce4
TW
221{
222 switch (code)
223 {
224 case BFD_RELOC_16:
225 return &tic54x_howto_table[0];
226 case BFD_RELOC_TIC54X_PARTLS7:
227 return &tic54x_howto_table[1];
228 case BFD_RELOC_TIC54X_PARTMS9:
229 return &tic54x_howto_table[2];
230 case BFD_RELOC_TIC54X_23:
231 return &tic54x_howto_table[3];
232 case BFD_RELOC_TIC54X_16_OF_23:
233 return &tic54x_howto_table[4];
234 case BFD_RELOC_TIC54X_MS7_OF_23:
235 return &tic54x_howto_table[5];
236 case BFD_RELOC_32:
237 return &tic54x_howto_table[12];
238 default:
239 return (reloc_howto_type *) NULL;
240 }
241}
242
157090f7
AM
243static reloc_howto_type *
244tic54x_coff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
245 const char *r_name)
246{
247 unsigned int i;
248
249 for (i = 0;
250 i < sizeof (tic54x_howto_table) / sizeof (tic54x_howto_table[0]);
251 i++)
252 if (tic54x_howto_table[i].name != NULL
253 && strcasecmp (tic54x_howto_table[i].name, r_name) == 0)
254 return &tic54x_howto_table[i];
255
256 return NULL;
257}
258
cbfe05c4 259/* Code to turn a r_type into a howto ptr, uses the above howto table.
f4ffd778
NC
260 Called after some initial checking by the tic54x_rtype_to_howto fn below. */
261
81635ce4 262static void
0aa13fee
AM
263tic54x_lookup_howto (bfd *abfd,
264 arelent *internal,
2c3fc389 265 struct internal_reloc *dst)
81635ce4
TW
266{
267 unsigned i;
268 int bank = (dst->r_symndx == -1) ? HOWTO_BANK : 0;
f4ffd778 269
81635ce4
TW
270 for (i = 0; i < sizeof tic54x_howto_table/sizeof tic54x_howto_table[0]; i++)
271 {
272 if (tic54x_howto_table[i].type == dst->r_type)
273 {
274 internal->howto = tic54x_howto_table + i + bank;
275 return;
276 }
277 }
278
0aa13fee
AM
279 _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
280 abfd, (unsigned int) dst->r_type);
1ed0032b 281 internal->howto = NULL;
81635ce4
TW
282}
283
284#define RELOC_PROCESSING(RELENT,RELOC,SYMS,ABFD,SECT)\
285 tic54x_reloc_processing(RELENT,RELOC,SYMS,ABFD,SECT)
286
81635ce4
TW
287#define coff_rtype_to_howto coff_tic54x_rtype_to_howto
288
289static reloc_howto_type *
0aa13fee 290coff_tic54x_rtype_to_howto (bfd *abfd,
2c3fc389
NC
291 asection *sec,
292 struct internal_reloc *rel,
293 struct coff_link_hash_entry *h ATTRIBUTE_UNUSED,
294 struct internal_syment *sym ATTRIBUTE_UNUSED,
295 bfd_vma *addendp)
81635ce4
TW
296{
297 arelent genrel;
298
299 if (rel->r_symndx == -1 && addendp != NULL)
300 {
301 /* This is a TI "internal relocation", which means that the relocation
302 amount is the amount by which the current section is being relocated
cbfe05c4 303 in the output section. */
81635ce4
TW
304 *addendp = (sec->output_section->vma + sec->output_offset) - sec->vma;
305 }
306
0aa13fee 307 tic54x_lookup_howto (abfd, &genrel, rel);
81635ce4
TW
308
309 return genrel.howto;
310}
311
f4ffd778
NC
312/* Replace the stock _bfd_coff_is_local_label_name to recognize TI COFF local
313 labels. */
314
0a1b45a2 315static bool
2c3fc389
NC
316ticoff_bfd_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED,
317 const char *name)
81635ce4
TW
318{
319 if (TICOFF_LOCAL_LABEL_P(name))
0a1b45a2
AM
320 return true;
321 return false;
81635ce4
TW
322}
323
324#define coff_bfd_is_local_label_name ticoff_bfd_is_local_label_name
325
cbfe05c4 326/* Customize coffcode.h; the default coff_ functions are set up to use COFF2;
81635ce4
TW
327 coff_bad_format_hook uses BADMAG, so set that for COFF2. The COFF1
328 and COFF0 vectors use custom _bad_format_hook procs instead of setting
f4ffd778 329 BADMAG. */
81635ce4 330#define BADMAG(x) COFF2_BADMAG(x)
2b5c217d
NC
331
332#ifndef bfd_pe_print_pdata
333#define bfd_pe_print_pdata NULL
334#endif
335
81635ce4
TW
336#include "coffcode.h"
337
0a1b45a2 338static bool
2c3fc389
NC
339tic54x_set_section_contents (bfd *abfd,
340 sec_ptr section,
341 const void * location,
342 file_ptr offset,
343 bfd_size_type bytes_to_do)
b9af77f5 344{
cbfe05c4 345 return coff_set_section_contents (abfd, section, location,
07d6d2b8 346 offset, bytes_to_do);
b9af77f5
TW
347}
348
81635ce4 349static void
2c3fc389
NC
350tic54x_reloc_processing (arelent *relent,
351 struct internal_reloc *reloc,
352 asymbol **symbols,
353 bfd *abfd,
354 asection *section)
81635ce4
TW
355{
356 asymbol *ptr;
357
358 relent->address = reloc->r_vaddr;
cbfe05c4 359
e6b6fad2 360 if (reloc->r_symndx != -1 && symbols != NULL)
81635ce4
TW
361 {
362 if (reloc->r_symndx < 0 || reloc->r_symndx >= obj_conv_table_size (abfd))
07d6d2b8
AM
363 {
364 _bfd_error_handler
695344c0 365 /* xgettext: c-format */
871b3ab2 366 (_("%pB: warning: illegal symbol index %ld in relocs"),
07d6d2b8
AM
367 abfd, reloc->r_symndx);
368 relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
369 ptr = NULL;
370 }
81635ce4 371 else
07d6d2b8
AM
372 {
373 relent->sym_ptr_ptr = (symbols
374 + obj_convert (abfd)[reloc->r_symndx]);
375 ptr = *(relent->sym_ptr_ptr);
376 }
81635ce4
TW
377 }
378 else
379 {
380 relent->sym_ptr_ptr = section->symbol_ptr_ptr;
381 ptr = *(relent->sym_ptr_ptr);
382 }
cbfe05c4 383
81635ce4
TW
384 /* The symbols definitions that we have read in have been
385 relocated as if their sections started at 0. But the offsets
386 refering to the symbols in the raw data have not been
387 modified, so we have to have a negative addend to compensate.
cbfe05c4 388
f4ffd778 389 Note that symbols which used to be common must be left alone. */
cbfe05c4 390
f4ffd778 391 /* Calculate any reloc addend by looking at the symbol. */
81635ce4 392 CALC_ADDEND (abfd, ptr, *reloc, relent);
cbfe05c4 393
81635ce4
TW
394 relent->address -= section->vma;
395 /* !! relent->section = (asection *) NULL;*/
cbfe05c4 396
f4ffd778 397 /* Fill in the relent->howto field from reloc->r_type. */
0aa13fee 398 tic54x_lookup_howto (abfd, relent, reloc);
81635ce4
TW
399}
400
f4ffd778 401/* TI COFF v0, DOS tools (little-endian headers). */
81635ce4 402const bfd_target tic54x_coff0_vec =
f4ffd778 403 {
d00dd7dc 404 "coff0-c54x", /* name */
f4ffd778
NC
405 bfd_target_coff_flavour,
406 BFD_ENDIAN_LITTLE, /* data byte order is little */
407 BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */
408
d00dd7dc
AM
409 (HAS_RELOC | EXEC_P /* object flags */
410 | HAS_LINENO | HAS_DEBUG
411 | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
f4ffd778
NC
412
413 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
d00dd7dc
AM
414 '_', /* leading symbol underscore */
415 '/', /* ar_pad_char */
f4ffd778 416 15, /* ar_max_namelen */
0aabe54e 417 0, /* match priority. */
d1bcae83 418 TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
f4ffd778
NC
419 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
420 tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
421 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
422 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
423 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
424 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
425
d00dd7dc
AM
426 { /* bfd_check_format */
427 _bfd_dummy_target,
428 coff_object_p,
429 bfd_generic_archive_p,
430 _bfd_dummy_target
431 },
432 { /* bfd_set_format */
433 _bfd_bool_bfd_false_error,
434 coff_mkobject,
435 _bfd_generic_mkarchive,
436 _bfd_bool_bfd_false_error
437 },
438 { /* bfd_write_contents */
439 _bfd_bool_bfd_false_error,
440 coff_write_object_contents,
441 _bfd_write_archive_contents,
442 _bfd_bool_bfd_false_error
443 },
f4ffd778
NC
444
445 BFD_JUMP_TABLE_GENERIC (coff),
446 BFD_JUMP_TABLE_COPY (coff),
447 BFD_JUMP_TABLE_CORE (_bfd_nocore),
448 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
449 BFD_JUMP_TABLE_SYMBOLS (coff),
450 BFD_JUMP_TABLE_RELOCS (coff),
451 BFD_JUMP_TABLE_WRITE (tic54x),
452 BFD_JUMP_TABLE_LINK (coff),
453 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
454 NULL,
455
d00dd7dc 456 &ticoff0_swap_table
f4ffd778
NC
457 };
458
459/* TI COFF v0, SPARC tools (big-endian headers). */
81635ce4 460const bfd_target tic54x_coff0_beh_vec =
f4ffd778 461 {
d00dd7dc 462 "coff0-beh-c54x", /* name */
f4ffd778
NC
463 bfd_target_coff_flavour,
464 BFD_ENDIAN_LITTLE, /* data byte order is little */
465 BFD_ENDIAN_BIG, /* header byte order is big */
466
d00dd7dc
AM
467 (HAS_RELOC | EXEC_P /* object flags */
468 | HAS_LINENO | HAS_DEBUG
469 | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
f4ffd778
NC
470
471 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
d00dd7dc
AM
472 '_', /* leading symbol underscore */
473 '/', /* ar_pad_char */
f4ffd778 474 15, /* ar_max_namelen */
0aabe54e 475 0, /* match priority. */
d1bcae83 476#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
0a1b45a2 477 true, /* keep unused section symbols. */
d1bcae83 478#else
0a1b45a2 479 false, /* keep unused section symbols. */
d1bcae83 480#endif
f4ffd778
NC
481 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
482 tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
483 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
484 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
485 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
486 bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
487
d00dd7dc
AM
488 { /* bfd_check_format */
489 _bfd_dummy_target,
490 coff_object_p,
491 bfd_generic_archive_p,
492 _bfd_dummy_target
493 },
494 { /* bfd_set_format */
495 _bfd_bool_bfd_false_error,
496 coff_mkobject,
497 _bfd_generic_mkarchive,
498 _bfd_bool_bfd_false_error
499 },
500 { /* bfd_write_contents */
501 _bfd_bool_bfd_false_error,
502 coff_write_object_contents,
503 _bfd_write_archive_contents,
504 _bfd_bool_bfd_false_error
505 },
f4ffd778
NC
506
507 BFD_JUMP_TABLE_GENERIC (coff),
508 BFD_JUMP_TABLE_COPY (coff),
509 BFD_JUMP_TABLE_CORE (_bfd_nocore),
510 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
511 BFD_JUMP_TABLE_SYMBOLS (coff),
512 BFD_JUMP_TABLE_RELOCS (coff),
513 BFD_JUMP_TABLE_WRITE (tic54x),
514 BFD_JUMP_TABLE_LINK (coff),
515 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
516
d00dd7dc 517 &tic54x_coff0_vec,
f4ffd778 518
d00dd7dc 519 &ticoff0_swap_table
f4ffd778
NC
520 };
521
522/* TI COFF v1, DOS tools (little-endian headers). */
81635ce4 523const bfd_target tic54x_coff1_vec =
f4ffd778 524 {
d00dd7dc 525 "coff1-c54x", /* name */
f4ffd778
NC
526 bfd_target_coff_flavour,
527 BFD_ENDIAN_LITTLE, /* data byte order is little */
528 BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */
529
d00dd7dc
AM
530 (HAS_RELOC | EXEC_P /* object flags */
531 | HAS_LINENO | HAS_DEBUG
532 | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
f4ffd778
NC
533
534 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
d00dd7dc
AM
535 '_', /* leading symbol underscore */
536 '/', /* ar_pad_char */
f4ffd778 537 15, /* ar_max_namelen */
0aabe54e 538 0, /* match priority. */
d1bcae83 539#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
0a1b45a2 540 true, /* keep unused section symbols. */
d1bcae83 541#else
0a1b45a2 542 false, /* keep unused section symbols. */
d1bcae83 543#endif
f4ffd778
NC
544 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
545 tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
546 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
547 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
548 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
549 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
550
d00dd7dc
AM
551 { /* bfd_check_format */
552 _bfd_dummy_target,
553 coff_object_p,
554 bfd_generic_archive_p,
555 _bfd_dummy_target
556 },
557 { /* bfd_set_format */
558 _bfd_bool_bfd_false_error,
559 coff_mkobject,
560 _bfd_generic_mkarchive,
561 _bfd_bool_bfd_false_error
562 },
563 { /* bfd_write_contents */
564 _bfd_bool_bfd_false_error,
565 coff_write_object_contents,
566 _bfd_write_archive_contents,
567 _bfd_bool_bfd_false_error
568 },
f4ffd778
NC
569
570 BFD_JUMP_TABLE_GENERIC (coff),
571 BFD_JUMP_TABLE_COPY (coff),
572 BFD_JUMP_TABLE_CORE (_bfd_nocore),
573 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
574 BFD_JUMP_TABLE_SYMBOLS (coff),
575 BFD_JUMP_TABLE_RELOCS (coff),
576 BFD_JUMP_TABLE_WRITE (tic54x),
577 BFD_JUMP_TABLE_LINK (coff),
578 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
579
d00dd7dc 580 &tic54x_coff0_beh_vec,
f4ffd778 581
d00dd7dc 582 &ticoff1_swap_table
81635ce4
TW
583};
584
f4ffd778 585/* TI COFF v1, SPARC tools (big-endian headers). */
81635ce4 586const bfd_target tic54x_coff1_beh_vec =
f4ffd778 587 {
d00dd7dc 588 "coff1-beh-c54x", /* name */
f4ffd778
NC
589 bfd_target_coff_flavour,
590 BFD_ENDIAN_LITTLE, /* data byte order is little */
591 BFD_ENDIAN_BIG, /* header byte order is big */
592
d00dd7dc
AM
593 (HAS_RELOC | EXEC_P /* object flags */
594 | HAS_LINENO | HAS_DEBUG
595 | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
f4ffd778
NC
596
597 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
d00dd7dc
AM
598 '_', /* leading symbol underscore */
599 '/', /* ar_pad_char */
f4ffd778 600 15, /* ar_max_namelen */
0aabe54e 601 0, /* match priority. */
d1bcae83 602#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
0a1b45a2 603 true, /* keep unused section symbols. */
d1bcae83 604#else
0a1b45a2 605 false, /* keep unused section symbols. */
d1bcae83 606#endif
f4ffd778
NC
607 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
608 tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
609 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
610 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
611 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
612 bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
613
d00dd7dc
AM
614 { /* bfd_check_format */
615 _bfd_dummy_target,
616 coff_object_p,
617 bfd_generic_archive_p,
618 _bfd_dummy_target
619 },
620 { /* bfd_set_format */
621 _bfd_bool_bfd_false_error,
622 coff_mkobject,
623 _bfd_generic_mkarchive,
624 _bfd_bool_bfd_false_error
625 },
626 { /* bfd_write_contents */
627 _bfd_bool_bfd_false_error,
628 coff_write_object_contents,
629 _bfd_write_archive_contents,
630 _bfd_bool_bfd_false_error
631 },
f4ffd778
NC
632
633 BFD_JUMP_TABLE_GENERIC (coff),
634 BFD_JUMP_TABLE_COPY (coff),
635 BFD_JUMP_TABLE_CORE (_bfd_nocore),
636 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
637 BFD_JUMP_TABLE_SYMBOLS (coff),
638 BFD_JUMP_TABLE_RELOCS (coff),
639 BFD_JUMP_TABLE_WRITE (tic54x),
640 BFD_JUMP_TABLE_LINK (coff),
641 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
642
d00dd7dc 643 &tic54x_coff1_vec,
f4ffd778 644
d00dd7dc 645 &ticoff1_swap_table
f4ffd778
NC
646 };
647
648/* TI COFF v2, TI DOS tools output (little-endian headers). */
81635ce4 649const bfd_target tic54x_coff2_vec =
f4ffd778 650 {
d00dd7dc 651 "coff2-c54x", /* name */
f4ffd778
NC
652 bfd_target_coff_flavour,
653 BFD_ENDIAN_LITTLE, /* data byte order is little */
654 BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */
655
d00dd7dc
AM
656 (HAS_RELOC | EXEC_P /* object flags */
657 | HAS_LINENO | HAS_DEBUG
658 | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
f4ffd778
NC
659
660 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
d00dd7dc
AM
661 '_', /* leading symbol underscore */
662 '/', /* ar_pad_char */
f4ffd778 663 15, /* ar_max_namelen */
0aabe54e 664 0, /* match priority. */
d1bcae83 665#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
0a1b45a2 666 true, /* keep unused section symbols. */
d1bcae83 667#else
0a1b45a2 668 false, /* keep unused section symbols. */
d1bcae83 669#endif
f4ffd778
NC
670 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
671 tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
672 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
673 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
674 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
675 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
676
d00dd7dc
AM
677 { /* bfd_check_format */
678 _bfd_dummy_target,
679 coff_object_p,
680 bfd_generic_archive_p,
681 _bfd_dummy_target
682 },
683 { /* bfd_set_format */
684 _bfd_bool_bfd_false_error,
685 coff_mkobject,
686 _bfd_generic_mkarchive,
687 _bfd_bool_bfd_false_error
688 },
689 { /* bfd_write_contents */
690 _bfd_bool_bfd_false_error,
691 coff_write_object_contents,
692 _bfd_write_archive_contents,
693 _bfd_bool_bfd_false_error
694 },
f4ffd778
NC
695
696 BFD_JUMP_TABLE_GENERIC (coff),
697 BFD_JUMP_TABLE_COPY (coff),
698 BFD_JUMP_TABLE_CORE (_bfd_nocore),
699 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
700 BFD_JUMP_TABLE_SYMBOLS (coff),
701 BFD_JUMP_TABLE_RELOCS (coff),
702 BFD_JUMP_TABLE_WRITE (tic54x),
703 BFD_JUMP_TABLE_LINK (coff),
704 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
705
d00dd7dc 706 &tic54x_coff1_beh_vec,
f4ffd778
NC
707
708 COFF_SWAP_TABLE
709 };
710
711/* TI COFF v2, TI SPARC tools output (big-endian headers). */
81635ce4 712const bfd_target tic54x_coff2_beh_vec =
f4ffd778 713 {
d00dd7dc 714 "coff2-beh-c54x", /* name */
f4ffd778
NC
715 bfd_target_coff_flavour,
716 BFD_ENDIAN_LITTLE, /* data byte order is little */
717 BFD_ENDIAN_BIG, /* header byte order is big */
718
d00dd7dc
AM
719 (HAS_RELOC | EXEC_P /* object flags */
720 | HAS_LINENO | HAS_DEBUG
721 | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
f4ffd778
NC
722
723 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
d00dd7dc
AM
724 '_', /* leading symbol underscore */
725 '/', /* ar_pad_char */
f4ffd778 726 15, /* ar_max_namelen */
0aabe54e 727 0, /* match priority. */
d1bcae83 728#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
0a1b45a2 729 true, /* keep unused section symbols. */
d1bcae83 730#else
0a1b45a2 731 false, /* keep unused section symbols. */
d1bcae83 732#endif
f4ffd778
NC
733 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
734 tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
735 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
736 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
737 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
738 bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
739
d00dd7dc
AM
740 { /* bfd_check_format */
741 _bfd_dummy_target,
742 coff_object_p,
743 bfd_generic_archive_p,
744 _bfd_dummy_target
745 },
746 { /* bfd_set_format */
747 _bfd_bool_bfd_false_error,
748 coff_mkobject,
749 _bfd_generic_mkarchive,
750 _bfd_bool_bfd_false_error
751 },
752 { /* bfd_write_contents */
753 _bfd_bool_bfd_false_error,
754 coff_write_object_contents,
755 _bfd_write_archive_contents,
756 _bfd_bool_bfd_false_error
757 },
f4ffd778
NC
758
759 BFD_JUMP_TABLE_GENERIC (coff),
760 BFD_JUMP_TABLE_COPY (coff),
761 BFD_JUMP_TABLE_CORE (_bfd_nocore),
762 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
763 BFD_JUMP_TABLE_SYMBOLS (coff),
764 BFD_JUMP_TABLE_RELOCS (coff),
765 BFD_JUMP_TABLE_WRITE (tic54x),
766 BFD_JUMP_TABLE_LINK (coff),
767 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
768
d00dd7dc 769 &tic54x_coff2_vec,
f4ffd778
NC
770
771 COFF_SWAP_TABLE
772 };