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