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 /* Clear the r_reserved field in relocs. */ 327 #define SWAP_OUT_RELOC_EXTRA(abfd,src,dst) \ 328 do \ 329 { \ 330 dst->r_reserved[0] = 0; \ 331 dst->r_reserved[1] = 0; \ 332 } \ 333 while (0) 334 335 /* Customize coffcode.h; the default coff_ functions are set up to use COFF2; 336 coff_bad_format_hook uses BADMAG, so set that for COFF2. The COFF1 337 and COFF0 vectors use custom _bad_format_hook procs instead of setting 338 BADMAG. */ 339 #define BADMAG(x) COFF2_BADMAG(x) 340 341 #ifndef bfd_pe_print_pdata 342 #define bfd_pe_print_pdata NULL 343 #endif 344 345 #include "coffcode.h" 346 347 static bfd_boolean 348 tic54x_set_section_contents (bfd *abfd, 349 sec_ptr section, 350 const void * location, 351 file_ptr offset, 352 bfd_size_type bytes_to_do) 353 { 354 return coff_set_section_contents (abfd, section, location, 355 offset, bytes_to_do); 356 } 357 358 static void 359 tic54x_reloc_processing (arelent *relent, 360 struct internal_reloc *reloc, 361 asymbol **symbols, 362 bfd *abfd, 363 asection *section) 364 { 365 asymbol *ptr; 366 367 relent->address = reloc->r_vaddr; 368 369 if (reloc->r_symndx != -1) 370 { 371 if (reloc->r_symndx < 0 || reloc->r_symndx >= obj_conv_table_size (abfd)) 372 { 373 (*_bfd_error_handler) 374 (_("%B: warning: illegal symbol index %ld in relocs"), 375 abfd, reloc->r_symndx); 376 relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; 377 ptr = NULL; 378 } 379 else 380 { 381 relent->sym_ptr_ptr = (symbols 382 + obj_convert (abfd)[reloc->r_symndx]); 383 ptr = *(relent->sym_ptr_ptr); 384 } 385 } 386 else 387 { 388 relent->sym_ptr_ptr = section->symbol_ptr_ptr; 389 ptr = *(relent->sym_ptr_ptr); 390 } 391 392 /* The symbols definitions that we have read in have been 393 relocated as if their sections started at 0. But the offsets 394 refering to the symbols in the raw data have not been 395 modified, so we have to have a negative addend to compensate. 396 397 Note that symbols which used to be common must be left alone. */ 398 399 /* Calculate any reloc addend by looking at the symbol. */ 400 CALC_ADDEND (abfd, ptr, *reloc, relent); 401 402 relent->address -= section->vma; 403 /* !! relent->section = (asection *) NULL;*/ 404 405 /* Fill in the relent->howto field from reloc->r_type. */ 406 tic54x_lookup_howto (relent, reloc); 407 } 408 409 /* TI COFF v0, DOS tools (little-endian headers). */ 410 const bfd_target tic54x_coff0_vec = 411 { 412 "coff0-c54x", /* name */ 413 bfd_target_coff_flavour, 414 BFD_ENDIAN_LITTLE, /* data byte order is little */ 415 BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */ 416 417 (HAS_RELOC | EXEC_P | /* object flags */ 418 HAS_LINENO | HAS_DEBUG | 419 HAS_SYMS | HAS_LOCALS | WP_TEXT ), 420 421 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ 422 '_', /* leading symbol underscore */ 423 '/', /* ar_pad_char */ 424 15, /* ar_max_namelen */ 425 0, /* match priority. */ 426 bfd_getl64, bfd_getl_signed_64, bfd_putl64, 427 tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32, 428 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ 429 bfd_getl64, bfd_getl_signed_64, bfd_putl64, 430 bfd_getl32, bfd_getl_signed_32, bfd_putl32, 431 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ 432 433 {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ 434 bfd_generic_archive_p, _bfd_dummy_target}, 435 {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ 436 bfd_false}, 437 {bfd_false, coff_write_object_contents, /* bfd_write_contents */ 438 _bfd_write_archive_contents, bfd_false}, 439 440 BFD_JUMP_TABLE_GENERIC (coff), 441 BFD_JUMP_TABLE_COPY (coff), 442 BFD_JUMP_TABLE_CORE (_bfd_nocore), 443 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), 444 BFD_JUMP_TABLE_SYMBOLS (coff), 445 BFD_JUMP_TABLE_RELOCS (coff), 446 BFD_JUMP_TABLE_WRITE (tic54x), 447 BFD_JUMP_TABLE_LINK (coff), 448 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), 449 NULL, 450 451 & ticoff0_swap_table 452 }; 453 454 /* TI COFF v0, SPARC tools (big-endian headers). */ 455 const bfd_target tic54x_coff0_beh_vec = 456 { 457 "coff0-beh-c54x", /* name */ 458 bfd_target_coff_flavour, 459 BFD_ENDIAN_LITTLE, /* data byte order is little */ 460 BFD_ENDIAN_BIG, /* header byte order is big */ 461 462 (HAS_RELOC | EXEC_P | /* object flags */ 463 HAS_LINENO | HAS_DEBUG | 464 HAS_SYMS | HAS_LOCALS | WP_TEXT ), 465 466 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ 467 '_', /* leading symbol underscore */ 468 '/', /* ar_pad_char */ 469 15, /* ar_max_namelen */ 470 0, /* match priority. */ 471 bfd_getl64, bfd_getl_signed_64, bfd_putl64, 472 tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32, 473 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ 474 bfd_getb64, bfd_getb_signed_64, bfd_putb64, 475 bfd_getb32, bfd_getb_signed_32, bfd_putb32, 476 bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ 477 478 {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ 479 bfd_generic_archive_p, _bfd_dummy_target}, 480 {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ 481 bfd_false}, 482 {bfd_false, coff_write_object_contents, /* bfd_write_contents */ 483 _bfd_write_archive_contents, bfd_false}, 484 485 BFD_JUMP_TABLE_GENERIC (coff), 486 BFD_JUMP_TABLE_COPY (coff), 487 BFD_JUMP_TABLE_CORE (_bfd_nocore), 488 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), 489 BFD_JUMP_TABLE_SYMBOLS (coff), 490 BFD_JUMP_TABLE_RELOCS (coff), 491 BFD_JUMP_TABLE_WRITE (tic54x), 492 BFD_JUMP_TABLE_LINK (coff), 493 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), 494 495 & tic54x_coff0_vec, 496 497 & ticoff0_swap_table 498 }; 499 500 /* TI COFF v1, DOS tools (little-endian headers). */ 501 const bfd_target tic54x_coff1_vec = 502 { 503 "coff1-c54x", /* name */ 504 bfd_target_coff_flavour, 505 BFD_ENDIAN_LITTLE, /* data byte order is little */ 506 BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */ 507 508 (HAS_RELOC | EXEC_P | /* object flags */ 509 HAS_LINENO | HAS_DEBUG | 510 HAS_SYMS | HAS_LOCALS | WP_TEXT ), 511 512 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ 513 '_', /* leading symbol underscore */ 514 '/', /* ar_pad_char */ 515 15, /* ar_max_namelen */ 516 0, /* match priority. */ 517 bfd_getl64, bfd_getl_signed_64, bfd_putl64, 518 tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32, 519 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ 520 bfd_getl64, bfd_getl_signed_64, bfd_putl64, 521 bfd_getl32, bfd_getl_signed_32, bfd_putl32, 522 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ 523 524 {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ 525 bfd_generic_archive_p, _bfd_dummy_target}, 526 {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ 527 bfd_false}, 528 {bfd_false, coff_write_object_contents, /* bfd_write_contents */ 529 _bfd_write_archive_contents, bfd_false}, 530 531 BFD_JUMP_TABLE_GENERIC (coff), 532 BFD_JUMP_TABLE_COPY (coff), 533 BFD_JUMP_TABLE_CORE (_bfd_nocore), 534 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), 535 BFD_JUMP_TABLE_SYMBOLS (coff), 536 BFD_JUMP_TABLE_RELOCS (coff), 537 BFD_JUMP_TABLE_WRITE (tic54x), 538 BFD_JUMP_TABLE_LINK (coff), 539 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), 540 541 & tic54x_coff0_beh_vec, 542 543 & ticoff1_swap_table 544 }; 545 546 /* TI COFF v1, SPARC tools (big-endian headers). */ 547 const bfd_target tic54x_coff1_beh_vec = 548 { 549 "coff1-beh-c54x", /* name */ 550 bfd_target_coff_flavour, 551 BFD_ENDIAN_LITTLE, /* data byte order is little */ 552 BFD_ENDIAN_BIG, /* header byte order is big */ 553 554 (HAS_RELOC | EXEC_P | /* object flags */ 555 HAS_LINENO | HAS_DEBUG | 556 HAS_SYMS | HAS_LOCALS | WP_TEXT ), 557 558 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ 559 '_', /* leading symbol underscore */ 560 '/', /* ar_pad_char */ 561 15, /* ar_max_namelen */ 562 0, /* match priority. */ 563 bfd_getl64, bfd_getl_signed_64, bfd_putl64, 564 tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32, 565 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ 566 bfd_getb64, bfd_getb_signed_64, bfd_putb64, 567 bfd_getb32, bfd_getb_signed_32, bfd_putb32, 568 bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ 569 570 {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ 571 bfd_generic_archive_p, _bfd_dummy_target}, 572 {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ 573 bfd_false}, 574 {bfd_false, coff_write_object_contents, /* bfd_write_contents */ 575 _bfd_write_archive_contents, bfd_false}, 576 577 BFD_JUMP_TABLE_GENERIC (coff), 578 BFD_JUMP_TABLE_COPY (coff), 579 BFD_JUMP_TABLE_CORE (_bfd_nocore), 580 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), 581 BFD_JUMP_TABLE_SYMBOLS (coff), 582 BFD_JUMP_TABLE_RELOCS (coff), 583 BFD_JUMP_TABLE_WRITE (tic54x), 584 BFD_JUMP_TABLE_LINK (coff), 585 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), 586 587 & tic54x_coff1_vec, 588 589 & ticoff1_swap_table 590 }; 591 592 /* TI COFF v2, TI DOS tools output (little-endian headers). */ 593 const bfd_target tic54x_coff2_vec = 594 { 595 "coff2-c54x", /* name */ 596 bfd_target_coff_flavour, 597 BFD_ENDIAN_LITTLE, /* data byte order is little */ 598 BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */ 599 600 (HAS_RELOC | EXEC_P | /* object flags */ 601 HAS_LINENO | HAS_DEBUG | 602 HAS_SYMS | HAS_LOCALS | WP_TEXT ), 603 604 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ 605 '_', /* leading symbol underscore */ 606 '/', /* ar_pad_char */ 607 15, /* ar_max_namelen */ 608 0, /* match priority. */ 609 bfd_getl64, bfd_getl_signed_64, bfd_putl64, 610 tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32, 611 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ 612 bfd_getl64, bfd_getl_signed_64, bfd_putl64, 613 bfd_getl32, bfd_getl_signed_32, bfd_putl32, 614 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ 615 616 {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ 617 bfd_generic_archive_p, _bfd_dummy_target}, 618 {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ 619 bfd_false}, 620 {bfd_false, coff_write_object_contents, /* bfd_write_contents */ 621 _bfd_write_archive_contents, bfd_false}, 622 623 BFD_JUMP_TABLE_GENERIC (coff), 624 BFD_JUMP_TABLE_COPY (coff), 625 BFD_JUMP_TABLE_CORE (_bfd_nocore), 626 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), 627 BFD_JUMP_TABLE_SYMBOLS (coff), 628 BFD_JUMP_TABLE_RELOCS (coff), 629 BFD_JUMP_TABLE_WRITE (tic54x), 630 BFD_JUMP_TABLE_LINK (coff), 631 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), 632 633 & tic54x_coff1_beh_vec, 634 635 COFF_SWAP_TABLE 636 }; 637 638 /* TI COFF v2, TI SPARC tools output (big-endian headers). */ 639 const bfd_target tic54x_coff2_beh_vec = 640 { 641 "coff2-beh-c54x", /* name */ 642 bfd_target_coff_flavour, 643 BFD_ENDIAN_LITTLE, /* data byte order is little */ 644 BFD_ENDIAN_BIG, /* header byte order is big */ 645 646 (HAS_RELOC | EXEC_P | /* object flags */ 647 HAS_LINENO | HAS_DEBUG | 648 HAS_SYMS | HAS_LOCALS | WP_TEXT ), 649 650 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ 651 '_', /* leading symbol underscore */ 652 '/', /* ar_pad_char */ 653 15, /* ar_max_namelen */ 654 0, /* match priority. */ 655 bfd_getl64, bfd_getl_signed_64, bfd_putl64, 656 tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32, 657 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ 658 bfd_getb64, bfd_getb_signed_64, bfd_putb64, 659 bfd_getb32, bfd_getb_signed_32, bfd_putb32, 660 bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ 661 662 {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ 663 bfd_generic_archive_p, _bfd_dummy_target}, 664 {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ 665 bfd_false}, 666 {bfd_false, coff_write_object_contents, /* bfd_write_contents */ 667 _bfd_write_archive_contents, bfd_false}, 668 669 BFD_JUMP_TABLE_GENERIC (coff), 670 BFD_JUMP_TABLE_COPY (coff), 671 BFD_JUMP_TABLE_CORE (_bfd_nocore), 672 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), 673 BFD_JUMP_TABLE_SYMBOLS (coff), 674 BFD_JUMP_TABLE_RELOCS (coff), 675 BFD_JUMP_TABLE_WRITE (tic54x), 676 BFD_JUMP_TABLE_LINK (coff), 677 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), 678 679 & tic54x_coff2_vec, 680 681 COFF_SWAP_TABLE 682 }; 683