Coverage Report

Created: 2026-03-10 08:46

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