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