]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - bfd/coff-tic54x.c
readelf: Use section names for displaying RELR relocs
[thirdparty/binutils-gdb.git] / bfd / coff-tic54x.c
CommitLineData
81635ce4 1/* BFD back-end for TMS320C54X coff binaries.
fd67aa11 2 Copyright (C) 1999-2024 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
81635ce4 112static bfd_reloc_status_type
2c3fc389
NC
113tic54x_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)
81635ce4 120{
81635ce4
TW
121 if (output_bfd != (bfd *) NULL)
122 {
123 /* This is a partial relocation, and we want to apply the
07d6d2b8
AM
124 relocation to the reloc entry rather than the raw data.
125 Modify the reloc inplace to reflect what we now know. */
81635ce4
TW
126 reloc_entry->address += input_section->output_offset;
127 return bfd_reloc_ok;
128 }
129 return bfd_reloc_continue;
130}
131
132reloc_howto_type tic54x_howto_table[] =
f4ffd778 133 {
c94cb026 134 /* type,rightshift,size,
f4ffd778
NC
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. */
c94cb026 140 HOWTO (R_RELWORD,0,2,16,false,0,complain_overflow_dont,
0a1b45a2 141 tic54x_relocation,"REL16",false,0xFFFF,0xFFFF,false),
f4ffd778
NC
142
143 /* 7 LSBs of an address */
c94cb026 144 HOWTO (R_PARTLS7,0,2,7,false,0,complain_overflow_dont,
0a1b45a2 145 tic54x_relocation,"LS7",false,0x007F,0x007F,false),
f4ffd778
NC
146
147 /* 9 MSBs of an address */
148 /* TI assembler doesn't shift its encoding, and is thus incompatible */
c94cb026 149 HOWTO (R_PARTMS9,7,2,9,false,0,complain_overflow_dont,
0a1b45a2 150 tic54x_relocation,"MS9",false,0x01FF,0x01FF,false),
f4ffd778
NC
151
152 /* 23-bit relocation */
c94cb026 153 HOWTO (R_EXTWORD,0,4,23,false,0,complain_overflow_dont,
0a1b45a2 154 tic54x_relocation,"RELEXT",false,0x7FFFFF,0x7FFFFF,false),
f4ffd778
NC
155
156 /* 16 bits of 23-bit extended address */
c94cb026 157 HOWTO (R_EXTWORD16,0,2,16,false,0,complain_overflow_dont,
0a1b45a2 158 tic54x_relocation,"RELEXT16",false,0x7FFFFF,0x7FFFFF,false),
f4ffd778
NC
159
160 /* upper 7 bits of 23-bit extended address */
c94cb026 161 HOWTO (R_EXTWORDMS7,16,2,7,false,0,complain_overflow_dont,
0a1b45a2 162 tic54x_relocation,"RELEXTMS7",false,0x7F,0x7F,false),
f4ffd778
NC
163
164 /* ABSOLUTE BANK */
165 /* 16-bit direct reference to symbol's address, absolute */
c94cb026 166 HOWTO (R_RELWORD,0,2,16,false,0,complain_overflow_dont,
0a1b45a2 167 tic54x_relocation,"AREL16",false,0xFFFF,0xFFFF,false),
f4ffd778
NC
168
169 /* 7 LSBs of an address, absolute */
c94cb026 170 HOWTO (R_PARTLS7,0,2,7,false,0,complain_overflow_dont,
0a1b45a2 171 tic54x_relocation,"ALS7",false,0x007F,0x007F,false),
f4ffd778
NC
172
173 /* 9 MSBs of an address, absolute */
174 /* TI assembler doesn't shift its encoding, and is thus incompatible */
c94cb026 175 HOWTO (R_PARTMS9,7,2,9,false,0,complain_overflow_dont,
0a1b45a2 176 tic54x_relocation,"AMS9",false,0x01FF,0x01FF,false),
f4ffd778
NC
177
178 /* 23-bit direct reference, absolute */
c94cb026 179 HOWTO (R_EXTWORD,0,4,23,false,0,complain_overflow_dont,
0a1b45a2 180 tic54x_relocation,"ARELEXT",false,0x7FFFFF,0x7FFFFF,false),
f4ffd778
NC
181
182 /* 16 bits of 23-bit extended address, absolute */
c94cb026 183 HOWTO (R_EXTWORD16,0,2,16,false,0,complain_overflow_dont,
0a1b45a2 184 tic54x_relocation,"ARELEXT16",false,0x7FFFFF,0x7FFFFF,false),
f4ffd778
NC
185
186 /* upper 7 bits of 23-bit extended address, absolute */
c94cb026 187 HOWTO (R_EXTWORDMS7,16,2,7,false,0,complain_overflow_dont,
0a1b45a2 188 tic54x_relocation,"ARELEXTMS7",false,0x7F,0x7F,false),
f4ffd778
NC
189
190 /* 32-bit relocation exclusively for stabs */
c94cb026 191 HOWTO (R_RELLONG,0,4,32,false,0,complain_overflow_dont,
0a1b45a2 192 tic54x_relocation,"STAB",false,0xFFFFFFFF,0xFFFFFFFF,false),
f4ffd778 193 };
81635ce4
TW
194
195#define coff_bfd_reloc_type_lookup tic54x_coff_reloc_type_lookup
157090f7 196#define coff_bfd_reloc_name_lookup tic54x_coff_reloc_name_lookup
81635ce4
TW
197
198/* For the case statement use the code values used tc_gen_reloc (defined in
f4ffd778
NC
199 bfd/reloc.c) to map to the howto table entries. */
200
2c3fc389
NC
201static reloc_howto_type *
202tic54x_coff_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
203 bfd_reloc_code_real_type code)
81635ce4
TW
204{
205 switch (code)
206 {
207 case BFD_RELOC_16:
208 return &tic54x_howto_table[0];
209 case BFD_RELOC_TIC54X_PARTLS7:
210 return &tic54x_howto_table[1];
211 case BFD_RELOC_TIC54X_PARTMS9:
212 return &tic54x_howto_table[2];
213 case BFD_RELOC_TIC54X_23:
214 return &tic54x_howto_table[3];
215 case BFD_RELOC_TIC54X_16_OF_23:
216 return &tic54x_howto_table[4];
217 case BFD_RELOC_TIC54X_MS7_OF_23:
218 return &tic54x_howto_table[5];
219 case BFD_RELOC_32:
220 return &tic54x_howto_table[12];
221 default:
222 return (reloc_howto_type *) NULL;
223 }
224}
225
157090f7
AM
226static reloc_howto_type *
227tic54x_coff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
228 const char *r_name)
229{
230 unsigned int i;
231
232 for (i = 0;
233 i < sizeof (tic54x_howto_table) / sizeof (tic54x_howto_table[0]);
234 i++)
235 if (tic54x_howto_table[i].name != NULL
236 && strcasecmp (tic54x_howto_table[i].name, r_name) == 0)
237 return &tic54x_howto_table[i];
238
239 return NULL;
240}
241
cbfe05c4 242/* Code to turn a r_type into a howto ptr, uses the above howto table.
f4ffd778
NC
243 Called after some initial checking by the tic54x_rtype_to_howto fn below. */
244
81635ce4 245static void
0aa13fee
AM
246tic54x_lookup_howto (bfd *abfd,
247 arelent *internal,
2c3fc389 248 struct internal_reloc *dst)
81635ce4
TW
249{
250 unsigned i;
251 int bank = (dst->r_symndx == -1) ? HOWTO_BANK : 0;
f4ffd778 252
81635ce4
TW
253 for (i = 0; i < sizeof tic54x_howto_table/sizeof tic54x_howto_table[0]; i++)
254 {
255 if (tic54x_howto_table[i].type == dst->r_type)
256 {
257 internal->howto = tic54x_howto_table + i + bank;
258 return;
259 }
260 }
261
0aa13fee
AM
262 _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
263 abfd, (unsigned int) dst->r_type);
1ed0032b 264 internal->howto = NULL;
81635ce4
TW
265}
266
267#define RELOC_PROCESSING(RELENT,RELOC,SYMS,ABFD,SECT)\
268 tic54x_reloc_processing(RELENT,RELOC,SYMS,ABFD,SECT)
269
81635ce4
TW
270#define coff_rtype_to_howto coff_tic54x_rtype_to_howto
271
272static reloc_howto_type *
0aa13fee 273coff_tic54x_rtype_to_howto (bfd *abfd,
2c3fc389
NC
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)
81635ce4
TW
279{
280 arelent genrel;
281
282 if (rel->r_symndx == -1 && addendp != NULL)
283 {
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
cbfe05c4 286 in the output section. */
81635ce4
TW
287 *addendp = (sec->output_section->vma + sec->output_offset) - sec->vma;
288 }
289
0aa13fee 290 tic54x_lookup_howto (abfd, &genrel, rel);
81635ce4
TW
291
292 return genrel.howto;
293}
294
f4ffd778
NC
295/* Replace the stock _bfd_coff_is_local_label_name to recognize TI COFF local
296 labels. */
297
0a1b45a2 298static bool
2c3fc389
NC
299ticoff_bfd_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED,
300 const char *name)
81635ce4
TW
301{
302 if (TICOFF_LOCAL_LABEL_P(name))
0a1b45a2
AM
303 return true;
304 return false;
81635ce4
TW
305}
306
307#define coff_bfd_is_local_label_name ticoff_bfd_is_local_label_name
308
cbfe05c4 309/* Customize coffcode.h; the default coff_ functions are set up to use COFF2;
81635ce4
TW
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
f4ffd778 312 BADMAG. */
81635ce4 313#define BADMAG(x) COFF2_BADMAG(x)
2b5c217d
NC
314
315#ifndef bfd_pe_print_pdata
316#define bfd_pe_print_pdata NULL
317#endif
318
81635ce4
TW
319#include "coffcode.h"
320
321static void
2c3fc389
NC
322tic54x_reloc_processing (arelent *relent,
323 struct internal_reloc *reloc,
324 asymbol **symbols,
325 bfd *abfd,
326 asection *section)
81635ce4
TW
327{
328 asymbol *ptr;
329
330 relent->address = reloc->r_vaddr;
cbfe05c4 331
e6b6fad2 332 if (reloc->r_symndx != -1 && symbols != NULL)
81635ce4
TW
333 {
334 if (reloc->r_symndx < 0 || reloc->r_symndx >= obj_conv_table_size (abfd))
07d6d2b8
AM
335 {
336 _bfd_error_handler
695344c0 337 /* xgettext: c-format */
871b3ab2 338 (_("%pB: warning: illegal symbol index %ld in relocs"),
07d6d2b8
AM
339 abfd, reloc->r_symndx);
340 relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
341 ptr = NULL;
342 }
81635ce4 343 else
07d6d2b8
AM
344 {
345 relent->sym_ptr_ptr = (symbols
346 + obj_convert (abfd)[reloc->r_symndx]);
347 ptr = *(relent->sym_ptr_ptr);
348 }
81635ce4
TW
349 }
350 else
351 {
352 relent->sym_ptr_ptr = section->symbol_ptr_ptr;
353 ptr = *(relent->sym_ptr_ptr);
354 }
cbfe05c4 355
81635ce4
TW
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.
cbfe05c4 360
f4ffd778 361 Note that symbols which used to be common must be left alone. */
cbfe05c4 362
f4ffd778 363 /* Calculate any reloc addend by looking at the symbol. */
81635ce4 364 CALC_ADDEND (abfd, ptr, *reloc, relent);
cbfe05c4 365
81635ce4
TW
366 relent->address -= section->vma;
367 /* !! relent->section = (asection *) NULL;*/
cbfe05c4 368
f4ffd778 369 /* Fill in the relent->howto field from reloc->r_type. */
0aa13fee 370 tic54x_lookup_howto (abfd, relent, reloc);
81635ce4
TW
371}
372
f4ffd778 373/* TI COFF v0, DOS tools (little-endian headers). */
81635ce4 374const bfd_target tic54x_coff0_vec =
f4ffd778 375 {
d00dd7dc 376 "coff0-c54x", /* name */
f4ffd778
NC
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
d00dd7dc
AM
381 (HAS_RELOC | EXEC_P /* object flags */
382 | HAS_LINENO | HAS_DEBUG
383 | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
f4ffd778
NC
384
385 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
d00dd7dc
AM
386 '_', /* leading symbol underscore */
387 '/', /* ar_pad_char */
f4ffd778 388 15, /* ar_max_namelen */
0aabe54e 389 0, /* match priority. */
d1bcae83 390 TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
f4ffd778
NC
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
d00dd7dc
AM
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 },
f4ffd778
NC
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),
880853ed 423 BFD_JUMP_TABLE_WRITE (coff),
f4ffd778
NC
424 BFD_JUMP_TABLE_LINK (coff),
425 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
426 NULL,
427
d00dd7dc 428 &ticoff0_swap_table
f4ffd778
NC
429 };
430
431/* TI COFF v0, SPARC tools (big-endian headers). */
81635ce4 432const bfd_target tic54x_coff0_beh_vec =
f4ffd778 433 {
d00dd7dc 434 "coff0-beh-c54x", /* name */
f4ffd778
NC
435 bfd_target_coff_flavour,
436 BFD_ENDIAN_LITTLE, /* data byte order is little */
437 BFD_ENDIAN_BIG, /* header byte order is big */
438
d00dd7dc
AM
439 (HAS_RELOC | EXEC_P /* object flags */
440 | HAS_LINENO | HAS_DEBUG
441 | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
f4ffd778
NC
442
443 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
d00dd7dc
AM
444 '_', /* leading symbol underscore */
445 '/', /* ar_pad_char */
f4ffd778 446 15, /* ar_max_namelen */
0aabe54e 447 0, /* match priority. */
d1bcae83 448#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
0a1b45a2 449 true, /* keep unused section symbols. */
d1bcae83 450#else
0a1b45a2 451 false, /* keep unused section symbols. */
d1bcae83 452#endif
f4ffd778
NC
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
d00dd7dc
AM
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 },
f4ffd778
NC
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),
880853ed 485 BFD_JUMP_TABLE_WRITE (coff),
f4ffd778
NC
486 BFD_JUMP_TABLE_LINK (coff),
487 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
488
d00dd7dc 489 &tic54x_coff0_vec,
f4ffd778 490
d00dd7dc 491 &ticoff0_swap_table
f4ffd778
NC
492 };
493
494/* TI COFF v1, DOS tools (little-endian headers). */
81635ce4 495const bfd_target tic54x_coff1_vec =
f4ffd778 496 {
d00dd7dc 497 "coff1-c54x", /* name */
f4ffd778
NC
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
d00dd7dc
AM
502 (HAS_RELOC | EXEC_P /* object flags */
503 | HAS_LINENO | HAS_DEBUG
504 | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
f4ffd778
NC
505
506 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
d00dd7dc
AM
507 '_', /* leading symbol underscore */
508 '/', /* ar_pad_char */
f4ffd778 509 15, /* ar_max_namelen */
0aabe54e 510 0, /* match priority. */
d1bcae83 511#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
0a1b45a2 512 true, /* keep unused section symbols. */
d1bcae83 513#else
0a1b45a2 514 false, /* keep unused section symbols. */
d1bcae83 515#endif
f4ffd778
NC
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
d00dd7dc
AM
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 },
f4ffd778
NC
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),
880853ed 548 BFD_JUMP_TABLE_WRITE (coff),
f4ffd778
NC
549 BFD_JUMP_TABLE_LINK (coff),
550 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
551
d00dd7dc 552 &tic54x_coff0_beh_vec,
f4ffd778 553
d00dd7dc 554 &ticoff1_swap_table
81635ce4
TW
555};
556
f4ffd778 557/* TI COFF v1, SPARC tools (big-endian headers). */
81635ce4 558const bfd_target tic54x_coff1_beh_vec =
f4ffd778 559 {
d00dd7dc 560 "coff1-beh-c54x", /* name */
f4ffd778
NC
561 bfd_target_coff_flavour,
562 BFD_ENDIAN_LITTLE, /* data byte order is little */
563 BFD_ENDIAN_BIG, /* header byte order is big */
564
d00dd7dc
AM
565 (HAS_RELOC | EXEC_P /* object flags */
566 | HAS_LINENO | HAS_DEBUG
567 | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
f4ffd778
NC
568
569 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
d00dd7dc
AM
570 '_', /* leading symbol underscore */
571 '/', /* ar_pad_char */
f4ffd778 572 15, /* ar_max_namelen */
0aabe54e 573 0, /* match priority. */
d1bcae83 574#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
0a1b45a2 575 true, /* keep unused section symbols. */
d1bcae83 576#else
0a1b45a2 577 false, /* keep unused section symbols. */
d1bcae83 578#endif
f4ffd778
NC
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
d00dd7dc
AM
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 },
f4ffd778
NC
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),
880853ed 611 BFD_JUMP_TABLE_WRITE (coff),
f4ffd778
NC
612 BFD_JUMP_TABLE_LINK (coff),
613 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
614
d00dd7dc 615 &tic54x_coff1_vec,
f4ffd778 616
d00dd7dc 617 &ticoff1_swap_table
f4ffd778
NC
618 };
619
620/* TI COFF v2, TI DOS tools output (little-endian headers). */
81635ce4 621const bfd_target tic54x_coff2_vec =
f4ffd778 622 {
d00dd7dc 623 "coff2-c54x", /* name */
f4ffd778
NC
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
d00dd7dc
AM
628 (HAS_RELOC | EXEC_P /* object flags */
629 | HAS_LINENO | HAS_DEBUG
630 | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
f4ffd778
NC
631
632 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
d00dd7dc
AM
633 '_', /* leading symbol underscore */
634 '/', /* ar_pad_char */
f4ffd778 635 15, /* ar_max_namelen */
0aabe54e 636 0, /* match priority. */
d1bcae83 637#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
0a1b45a2 638 true, /* keep unused section symbols. */
d1bcae83 639#else
0a1b45a2 640 false, /* keep unused section symbols. */
d1bcae83 641#endif
f4ffd778
NC
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
d00dd7dc
AM
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 },
f4ffd778
NC
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),
880853ed 674 BFD_JUMP_TABLE_WRITE (coff),
f4ffd778
NC
675 BFD_JUMP_TABLE_LINK (coff),
676 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
677
d00dd7dc 678 &tic54x_coff1_beh_vec,
f4ffd778
NC
679
680 COFF_SWAP_TABLE
681 };
682
683/* TI COFF v2, TI SPARC tools output (big-endian headers). */
81635ce4 684const bfd_target tic54x_coff2_beh_vec =
f4ffd778 685 {
d00dd7dc 686 "coff2-beh-c54x", /* name */
f4ffd778
NC
687 bfd_target_coff_flavour,
688 BFD_ENDIAN_LITTLE, /* data byte order is little */
689 BFD_ENDIAN_BIG, /* header byte order is big */
690
d00dd7dc
AM
691 (HAS_RELOC | EXEC_P /* object flags */
692 | HAS_LINENO | HAS_DEBUG
693 | HAS_SYMS | HAS_LOCALS | WP_TEXT ),
f4ffd778
NC
694
695 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
d00dd7dc
AM
696 '_', /* leading symbol underscore */
697 '/', /* ar_pad_char */
f4ffd778 698 15, /* ar_max_namelen */
0aabe54e 699 0, /* match priority. */
d1bcae83 700#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
0a1b45a2 701 true, /* keep unused section symbols. */
d1bcae83 702#else
0a1b45a2 703 false, /* keep unused section symbols. */
d1bcae83 704#endif
f4ffd778
NC
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
d00dd7dc
AM
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 },
f4ffd778
NC
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),
880853ed 737 BFD_JUMP_TABLE_WRITE (coff),
f4ffd778
NC
738 BFD_JUMP_TABLE_LINK (coff),
739 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
740
d00dd7dc 741 &tic54x_coff2_vec,
f4ffd778
NC
742
743 COFF_SWAP_TABLE
744 };