Coverage Report

Created: 2025-06-24 06:45

/src/binutils-gdb/bfd/coff-tic54x.c
Line
Count
Source (jump to first uncovered line)
1
/* BFD back-end for TMS320C54X coff binaries.
2
   Copyright (C) 1999-2025 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
0
#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
46.8k
{
47
46.8k
  const bfd_byte *addr = p;
48
46.8k
  unsigned long v;
49
50
46.8k
  v  = (unsigned long) addr[2];
51
46.8k
  v |= (unsigned long) addr[3] << 8;
52
46.8k
  v |= (unsigned long) addr[0] << 16;
53
46.8k
  v |= (unsigned long) addr[1] << 24;
54
46.8k
  return v;
55
46.8k
}
56
57
static void
58
tic54x_putl32 (bfd_vma data, void *p)
59
0
{
60
0
  bfd_byte *addr = p;
61
0
  addr[2] = data & 0xff;
62
0
  addr[3] = (data >>  8) & 0xff;
63
0
  addr[0] = (data >> 16) & 0xff;
64
0
  addr[1] = (data >> 24) & 0xff;
65
0
}
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
0
#define coff_get_section_load_page bfd_ticoff_get_section_load_page
83
13.0M
#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
13.0M
{
89
13.0M
  sect->lma = (sect->lma & ADDR_MASK) | PG_TO_FLAG(page);
90
13.0M
}
91
92
static int
93
bfd_ticoff_get_section_load_page (asection *sect)
94
0
{
95
0
  int page;
96
97
  /* Provide meaningful defaults for predefined sections.  */
98
0
  if (sect == bfd_com_section_ptr)
99
0
    page = PG_DATA;
100
101
0
  else if (bfd_is_und_section (sect)
102
0
     || bfd_is_abs_section (sect)
103
0
     || bfd_is_ind_section (sect))
104
0
    page = PG_PROG;
105
106
0
  else
107
0
    page = FLAG_TO_PG (sect->lma);
108
109
0
  return page;
110
0
}
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
1
{
121
1
  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
1
  return bfd_reloc_continue;
130
1
}
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
365
{
250
365
  unsigned i;
251
365
  int bank = (dst->r_symndx == -1) ? HOWTO_BANK : 0;
252
253
4.15k
  for (i = 0; i < sizeof tic54x_howto_table/sizeof tic54x_howto_table[0]; i++)
254
3.88k
    {
255
3.88k
      if (tic54x_howto_table[i].type == dst->r_type)
256
91
  {
257
91
    internal->howto = tic54x_howto_table + i + bank;
258
91
    return;
259
91
  }
260
3.88k
    }
261
262
274
  _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
263
274
          abfd, (unsigned int) dst->r_type);
264
274
  internal->howto = NULL;
265
274
}
266
267
#define RELOC_PROCESSING(RELENT,RELOC,SYMS,ABFD,SECT)\
268
365
 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
6.66M
#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
365
{
328
365
  asymbol *ptr;
329
330
365
  relent->address = reloc->r_vaddr;
331
332
365
  if (reloc->r_symndx != -1 && symbols != NULL)
333
153
    {
334
153
      if (reloc->r_symndx < 0 || reloc->r_symndx >= obj_conv_table_size (abfd))
335
79
  {
336
79
    _bfd_error_handler
337
      /* xgettext: c-format */
338
79
      (_("%pB: warning: illegal symbol index %ld in relocs"),
339
79
       abfd, reloc->r_symndx);
340
79
    relent->sym_ptr_ptr = &bfd_abs_section_ptr->symbol;
341
79
    ptr = NULL;
342
79
  }
343
74
      else
344
74
  {
345
74
    relent->sym_ptr_ptr = (symbols
346
74
         + obj_convert (abfd)[reloc->r_symndx]);
347
74
    ptr = *(relent->sym_ptr_ptr);
348
74
  }
349
153
    }
350
212
  else
351
212
    {
352
212
      relent->sym_ptr_ptr = &section->symbol;
353
212
      ptr = *(relent->sym_ptr_ptr);
354
212
    }
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
365
  CALC_ADDEND (abfd, ptr, *reloc, relent);
365
366
365
  relent->address -= section->vma;
367
  /* !!     relent->section = (asection *) NULL;*/
368
369
  /* Fill in the relent->howto field from reloc->r_type.  */
370
365
  tic54x_lookup_howto (abfd, relent, reloc);
371
365
}
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
    bfd_getl64, bfd_getl_signed_64, bfd_putl64,
392
    tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
393
    bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
394
    bfd_getl64, bfd_getl_signed_64, bfd_putl64,
395
    bfd_getl32, bfd_getl_signed_32, bfd_putl32,
396
    bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
397
398
    {       /* bfd_check_format */
399
      _bfd_dummy_target,
400
      coff_object_p,
401
      bfd_generic_archive_p,
402
      _bfd_dummy_target
403
    },
404
    {       /* bfd_set_format */
405
      _bfd_bool_bfd_false_error,
406
      coff_mkobject,
407
      _bfd_generic_mkarchive,
408
      _bfd_bool_bfd_false_error
409
    },
410
    {       /* bfd_write_contents */
411
      _bfd_bool_bfd_false_error,
412
      coff_write_object_contents,
413
      _bfd_write_archive_contents,
414
      _bfd_bool_bfd_false_error
415
    },
416
417
    BFD_JUMP_TABLE_GENERIC (coff),
418
    BFD_JUMP_TABLE_COPY (coff),
419
    BFD_JUMP_TABLE_CORE (_bfd_nocore),
420
    BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
421
    BFD_JUMP_TABLE_SYMBOLS (coff),
422
    BFD_JUMP_TABLE_RELOCS (coff),
423
    BFD_JUMP_TABLE_WRITE (coff),
424
    BFD_JUMP_TABLE_LINK (coff),
425
    BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
426
    NULL,
427
428
    &ticoff0_swap_table
429
  };
430
431
/* TI COFF v0, SPARC tools (big-endian headers).  */
432
const bfd_target tic54x_coff0_beh_vec =
433
  {
434
    "coff0-beh-c54x",   /* name */
435
    bfd_target_coff_flavour,
436
    BFD_ENDIAN_LITTLE,    /* data byte order is little */
437
    BFD_ENDIAN_BIG,   /* header byte order is big */
438
439
    (HAS_RELOC | EXEC_P   /* object flags */
440
     | HAS_LINENO | HAS_DEBUG
441
     | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
442
443
    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
444
    '_',      /* leading symbol underscore */
445
    '/',      /* ar_pad_char */
446
    15,       /* ar_max_namelen */
447
    0,        /* match priority.  */
448
#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
449
    true,     /* keep unused section symbols.  */
450
#else
451
    false,      /* keep unused section symbols.  */
452
#endif
453
    bfd_getl64, bfd_getl_signed_64, bfd_putl64,
454
    tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
455
    bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
456
    bfd_getb64, bfd_getb_signed_64, bfd_putb64,
457
    bfd_getb32, bfd_getb_signed_32, bfd_putb32,
458
    bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
459
460
    {       /* bfd_check_format */
461
      _bfd_dummy_target,
462
      coff_object_p,
463
      bfd_generic_archive_p,
464
      _bfd_dummy_target
465
    },
466
    {       /* bfd_set_format */
467
      _bfd_bool_bfd_false_error,
468
      coff_mkobject,
469
      _bfd_generic_mkarchive,
470
      _bfd_bool_bfd_false_error
471
    },
472
    {       /* bfd_write_contents */
473
      _bfd_bool_bfd_false_error,
474
      coff_write_object_contents,
475
      _bfd_write_archive_contents,
476
      _bfd_bool_bfd_false_error
477
    },
478
479
    BFD_JUMP_TABLE_GENERIC (coff),
480
    BFD_JUMP_TABLE_COPY (coff),
481
    BFD_JUMP_TABLE_CORE (_bfd_nocore),
482
    BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
483
    BFD_JUMP_TABLE_SYMBOLS (coff),
484
    BFD_JUMP_TABLE_RELOCS (coff),
485
    BFD_JUMP_TABLE_WRITE (coff),
486
    BFD_JUMP_TABLE_LINK (coff),
487
    BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
488
489
    &tic54x_coff0_vec,
490
491
    &ticoff0_swap_table
492
  };
493
494
/* TI COFF v1, DOS tools (little-endian headers).  */
495
const bfd_target tic54x_coff1_vec =
496
  {
497
    "coff1-c54x",   /* name */
498
    bfd_target_coff_flavour,
499
    BFD_ENDIAN_LITTLE,    /* data byte order is little */
500
    BFD_ENDIAN_LITTLE,    /* header byte order is little (DOS tools) */
501
502
    (HAS_RELOC | EXEC_P   /* object flags */
503
     | HAS_LINENO | HAS_DEBUG
504
     | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
505
506
    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
507
    '_',      /* leading symbol underscore */
508
    '/',      /* ar_pad_char */
509
    15,       /* ar_max_namelen */
510
    0,        /* match priority.  */
511
#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
512
    true,     /* keep unused section symbols.  */
513
#else
514
    false,      /* keep unused section symbols.  */
515
#endif
516
    bfd_getl64, bfd_getl_signed_64, bfd_putl64,
517
    tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
518
    bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
519
    bfd_getl64, bfd_getl_signed_64, bfd_putl64,
520
    bfd_getl32, bfd_getl_signed_32, bfd_putl32,
521
    bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
522
523
    {       /* bfd_check_format */
524
      _bfd_dummy_target,
525
      coff_object_p,
526
      bfd_generic_archive_p,
527
      _bfd_dummy_target
528
    },
529
    {       /* bfd_set_format */
530
      _bfd_bool_bfd_false_error,
531
      coff_mkobject,
532
      _bfd_generic_mkarchive,
533
      _bfd_bool_bfd_false_error
534
    },
535
    {       /* bfd_write_contents */
536
      _bfd_bool_bfd_false_error,
537
      coff_write_object_contents,
538
      _bfd_write_archive_contents,
539
      _bfd_bool_bfd_false_error
540
    },
541
542
    BFD_JUMP_TABLE_GENERIC (coff),
543
    BFD_JUMP_TABLE_COPY (coff),
544
    BFD_JUMP_TABLE_CORE (_bfd_nocore),
545
    BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
546
    BFD_JUMP_TABLE_SYMBOLS (coff),
547
    BFD_JUMP_TABLE_RELOCS (coff),
548
    BFD_JUMP_TABLE_WRITE (coff),
549
    BFD_JUMP_TABLE_LINK (coff),
550
    BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
551
552
    &tic54x_coff0_beh_vec,
553
554
    &ticoff1_swap_table
555
};
556
557
/* TI COFF v1, SPARC tools (big-endian headers).  */
558
const bfd_target tic54x_coff1_beh_vec =
559
  {
560
    "coff1-beh-c54x",   /* name */
561
    bfd_target_coff_flavour,
562
    BFD_ENDIAN_LITTLE,    /* data byte order is little */
563
    BFD_ENDIAN_BIG,   /* header byte order is big */
564
565
    (HAS_RELOC | EXEC_P   /* object flags */
566
     | HAS_LINENO | HAS_DEBUG
567
     | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
568
569
    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
570
    '_',      /* leading symbol underscore */
571
    '/',      /* ar_pad_char */
572
    15,       /* ar_max_namelen */
573
    0,        /* match priority.  */
574
#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
575
    true,     /* keep unused section symbols.  */
576
#else
577
    false,      /* keep unused section symbols.  */
578
#endif
579
    bfd_getl64, bfd_getl_signed_64, bfd_putl64,
580
    tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
581
    bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
582
    bfd_getb64, bfd_getb_signed_64, bfd_putb64,
583
    bfd_getb32, bfd_getb_signed_32, bfd_putb32,
584
    bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
585
586
    {       /* bfd_check_format */
587
      _bfd_dummy_target,
588
      coff_object_p,
589
      bfd_generic_archive_p,
590
      _bfd_dummy_target
591
    },
592
    {       /* bfd_set_format */
593
      _bfd_bool_bfd_false_error,
594
      coff_mkobject,
595
      _bfd_generic_mkarchive,
596
      _bfd_bool_bfd_false_error
597
    },
598
    {       /* bfd_write_contents */
599
      _bfd_bool_bfd_false_error,
600
      coff_write_object_contents,
601
      _bfd_write_archive_contents,
602
      _bfd_bool_bfd_false_error
603
    },
604
605
    BFD_JUMP_TABLE_GENERIC (coff),
606
    BFD_JUMP_TABLE_COPY (coff),
607
    BFD_JUMP_TABLE_CORE (_bfd_nocore),
608
    BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
609
    BFD_JUMP_TABLE_SYMBOLS (coff),
610
    BFD_JUMP_TABLE_RELOCS (coff),
611
    BFD_JUMP_TABLE_WRITE (coff),
612
    BFD_JUMP_TABLE_LINK (coff),
613
    BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
614
615
    &tic54x_coff1_vec,
616
617
    &ticoff1_swap_table
618
  };
619
620
/* TI COFF v2, TI DOS tools output (little-endian headers).  */
621
const bfd_target tic54x_coff2_vec =
622
  {
623
    "coff2-c54x",   /* name */
624
    bfd_target_coff_flavour,
625
    BFD_ENDIAN_LITTLE,    /* data byte order is little */
626
    BFD_ENDIAN_LITTLE,    /* header byte order is little (DOS tools) */
627
628
    (HAS_RELOC | EXEC_P   /* object flags */
629
     | HAS_LINENO | HAS_DEBUG
630
     | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
631
632
    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
633
    '_',      /* leading symbol underscore */
634
    '/',      /* ar_pad_char */
635
    15,       /* ar_max_namelen */
636
    0,        /* match priority.  */
637
#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
638
    true,     /* keep unused section symbols.  */
639
#else
640
    false,      /* keep unused section symbols.  */
641
#endif
642
    bfd_getl64, bfd_getl_signed_64, bfd_putl64,
643
    tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
644
    bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
645
    bfd_getl64, bfd_getl_signed_64, bfd_putl64,
646
    bfd_getl32, bfd_getl_signed_32, bfd_putl32,
647
    bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
648
649
    {       /* bfd_check_format */
650
      _bfd_dummy_target,
651
      coff_object_p,
652
      bfd_generic_archive_p,
653
      _bfd_dummy_target
654
    },
655
    {       /* bfd_set_format */
656
      _bfd_bool_bfd_false_error,
657
      coff_mkobject,
658
      _bfd_generic_mkarchive,
659
      _bfd_bool_bfd_false_error
660
    },
661
    {       /* bfd_write_contents */
662
      _bfd_bool_bfd_false_error,
663
      coff_write_object_contents,
664
      _bfd_write_archive_contents,
665
      _bfd_bool_bfd_false_error
666
    },
667
668
    BFD_JUMP_TABLE_GENERIC (coff),
669
    BFD_JUMP_TABLE_COPY (coff),
670
    BFD_JUMP_TABLE_CORE (_bfd_nocore),
671
    BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
672
    BFD_JUMP_TABLE_SYMBOLS (coff),
673
    BFD_JUMP_TABLE_RELOCS (coff),
674
    BFD_JUMP_TABLE_WRITE (coff),
675
    BFD_JUMP_TABLE_LINK (coff),
676
    BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
677
678
    &tic54x_coff1_beh_vec,
679
680
    COFF_SWAP_TABLE
681
  };
682
683
/* TI COFF v2, TI SPARC tools output (big-endian headers).  */
684
const bfd_target tic54x_coff2_beh_vec =
685
  {
686
    "coff2-beh-c54x",   /* name */
687
    bfd_target_coff_flavour,
688
    BFD_ENDIAN_LITTLE,    /* data byte order is little */
689
    BFD_ENDIAN_BIG,   /* header byte order is big */
690
691
    (HAS_RELOC | EXEC_P   /* object flags */
692
     | HAS_LINENO | HAS_DEBUG
693
     | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
694
695
    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
696
    '_',      /* leading symbol underscore */
697
    '/',      /* ar_pad_char */
698
    15,       /* ar_max_namelen */
699
    0,        /* match priority.  */
700
#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
701
    true,     /* keep unused section symbols.  */
702
#else
703
    false,      /* keep unused section symbols.  */
704
#endif
705
    bfd_getl64, bfd_getl_signed_64, bfd_putl64,
706
    tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
707
    bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
708
    bfd_getb64, bfd_getb_signed_64, bfd_putb64,
709
    bfd_getb32, bfd_getb_signed_32, bfd_putb32,
710
    bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
711
712
    {       /* bfd_check_format */
713
      _bfd_dummy_target,
714
      coff_object_p,
715
      bfd_generic_archive_p,
716
      _bfd_dummy_target
717
    },
718
    {       /* bfd_set_format */
719
      _bfd_bool_bfd_false_error,
720
      coff_mkobject,
721
      _bfd_generic_mkarchive,
722
      _bfd_bool_bfd_false_error
723
    },
724
    {       /* bfd_write_contents */
725
      _bfd_bool_bfd_false_error,
726
      coff_write_object_contents,
727
      _bfd_write_archive_contents,
728
      _bfd_bool_bfd_false_error
729
    },
730
731
    BFD_JUMP_TABLE_GENERIC (coff),
732
    BFD_JUMP_TABLE_COPY (coff),
733
    BFD_JUMP_TABLE_CORE (_bfd_nocore),
734
    BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
735
    BFD_JUMP_TABLE_SYMBOLS (coff),
736
    BFD_JUMP_TABLE_RELOCS (coff),
737
    BFD_JUMP_TABLE_WRITE (coff),
738
    BFD_JUMP_TABLE_LINK (coff),
739
    BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
740
741
    &tic54x_coff2_vec,
742
743
    COFF_SWAP_TABLE
744
  };