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