Back to index

cell-binutils  2.17cvs20070401
coff-tic54x.c
Go to the documentation of this file.
00001 /* BFD back-end for TMS320C54X coff binaries.
00002    Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
00003    Free Software Foundation, Inc.
00004    Contributed by Timothy Wall (twall@cygnus.com)
00005 
00006    This file is part of BFD, the Binary File Descriptor library.
00007 
00008    This program is free software; you can redistribute it and/or modify
00009    it under the terms of the GNU General Public License as published by
00010    the Free Software Foundation; either version 2 of the License, or
00011    (at your option) any later version.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
00021    02110-1301, USA.  */
00022 
00023 #include "bfd.h"
00024 #include "sysdep.h"
00025 #include "libbfd.h"
00026 #include "bfdlink.h"
00027 #include "coff/tic54x.h"
00028 #include "coff/internal.h"
00029 #include "libcoff.h"
00030 
00031 #undef  F_LSYMS
00032 #define       F_LSYMS              F_LSYMS_TICOFF
00033 
00034 static void tic54x_reloc_processing
00035   PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *));
00036 static bfd_reloc_status_type tic54x_relocation
00037   PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
00038 static bfd_boolean tic54x_set_section_contents
00039   PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type));
00040 static reloc_howto_type *coff_tic54x_rtype_to_howto
00041   PARAMS ((bfd *, asection *, struct internal_reloc *, struct coff_link_hash_entry *, struct internal_syment *, bfd_vma *));
00042 static bfd_boolean tic54x_set_arch_mach
00043   PARAMS ((bfd *, enum bfd_architecture, unsigned long));
00044 static reloc_howto_type * tic54x_coff_reloc_type_lookup
00045   PARAMS ((bfd *, bfd_reloc_code_real_type));
00046 static void tic54x_lookup_howto
00047   PARAMS ((arelent *, struct internal_reloc *));
00048 static bfd_boolean ticoff_bfd_is_local_label_name
00049   PARAMS ((bfd *, const char *));
00050 
00051 /* 32-bit operations
00052    The octet order is screwy.  words are LSB first (LS octet, actually), but
00053    longwords are MSW first.  For example, 0x12345678 is encoded 0x5678 in the
00054    first word and 0x1234 in the second.  When looking at the data as stored in
00055    the COFF file, you would see the octets ordered as 0x78, 0x56, 0x34, 0x12.
00056    Don't bother with 64-bits, as there aren't any.  */
00057 
00058 static bfd_vma
00059 tic54x_getl32 (const void *p)
00060 {
00061   const bfd_byte *addr = p;
00062   unsigned long v;
00063 
00064   v  = (unsigned long) addr[2];
00065   v |= (unsigned long) addr[3] << 8;
00066   v |= (unsigned long) addr[0] << 16;
00067   v |= (unsigned long) addr[1] << 24;
00068   return v;
00069 }
00070 
00071 static void
00072 tic54x_putl32 (bfd_vma data, void *p)
00073 {
00074   bfd_byte *addr = p;
00075   addr[2] = data & 0xff;
00076   addr[3] = (data >>  8) & 0xff;
00077   addr[0] = (data >> 16) & 0xff;
00078   addr[1] = (data >> 24) & 0xff;
00079 }
00080 
00081 static bfd_signed_vma
00082 tic54x_getl_signed_32 (const void *p)
00083 {
00084   const bfd_byte *addr = p;
00085   unsigned long v;
00086 
00087   v  = (unsigned long) addr[2];
00088   v |= (unsigned long) addr[3] << 8;
00089   v |= (unsigned long) addr[0] << 16;
00090   v |= (unsigned long) addr[1] << 24;
00091 #define COERCE32(x) \
00092   ((bfd_signed_vma) (long) (((unsigned long) (x) ^ 0x80000000) - 0x80000000))
00093   return COERCE32 (v);
00094 }
00095 
00096 #define coff_get_section_load_page bfd_ticoff_get_section_load_page
00097 #define coff_set_section_load_page bfd_ticoff_set_section_load_page
00098 
00099 void
00100 bfd_ticoff_set_section_load_page (sect, page)
00101   asection *sect;
00102   int page;
00103 {
00104   sect->lma = (sect->lma & ADDR_MASK) | PG_TO_FLAG(page);
00105 }
00106 
00107 int
00108 bfd_ticoff_get_section_load_page (sect)
00109   asection *sect;
00110 {
00111   int page;
00112 
00113   /* Provide meaningful defaults for predefined sections.  */
00114   if (sect == &bfd_com_section)
00115     page = PG_DATA;
00116 
00117   else if (sect == &bfd_und_section
00118       || sect == &bfd_abs_section
00119       || sect == &bfd_ind_section)
00120     page = PG_PROG;
00121 
00122   else
00123     page = FLAG_TO_PG (sect->lma);
00124 
00125   return page;
00126 }
00127 
00128 /* Set the architecture appropriately.  Allow unkown architectures
00129    (e.g. binary).  */
00130 
00131 static bfd_boolean
00132 tic54x_set_arch_mach (abfd, arch, machine)
00133      bfd *abfd;
00134      enum bfd_architecture arch;
00135      unsigned long machine;
00136 {
00137   if (arch == bfd_arch_unknown)
00138     arch = bfd_arch_tic54x;
00139 
00140   else if (arch != bfd_arch_tic54x)
00141     return FALSE;
00142 
00143   return bfd_default_set_arch_mach (abfd, arch, machine);
00144 }
00145 
00146 static bfd_reloc_status_type
00147 tic54x_relocation (abfd, reloc_entry, symbol, data, input_section,
00148                    output_bfd, error_message)
00149   bfd *abfd ATTRIBUTE_UNUSED;
00150   arelent *reloc_entry;
00151   asymbol *symbol ATTRIBUTE_UNUSED;
00152   PTR data ATTRIBUTE_UNUSED;
00153   asection *input_section;
00154   bfd *output_bfd;
00155   char **error_message ATTRIBUTE_UNUSED;
00156 {
00157   if (output_bfd != (bfd *) NULL)
00158     {
00159       /* This is a partial relocation, and we want to apply the
00160         relocation to the reloc entry rather than the raw data.
00161         Modify the reloc inplace to reflect what we now know.  */
00162       reloc_entry->address += input_section->output_offset;
00163       return bfd_reloc_ok;
00164     }
00165   return bfd_reloc_continue;
00166 }
00167 
00168 reloc_howto_type tic54x_howto_table[] =
00169   {
00170     /* type,rightshift,size (0=byte, 1=short, 2=long),
00171        bit size, pc_relative, bitpos, dont complain_on_overflow,
00172        special_function, name, partial_inplace, src_mask, dst_mask, pcrel_offset.  */
00173 
00174     /* NORMAL BANK */
00175     /* 16-bit direct reference to symbol's address.  */
00176     HOWTO (R_RELWORD,0,1,16,FALSE,0,complain_overflow_dont,
00177           tic54x_relocation,"REL16",FALSE,0xFFFF,0xFFFF,FALSE),
00178 
00179     /* 7 LSBs of an address */
00180     HOWTO (R_PARTLS7,0,1,7,FALSE,0,complain_overflow_dont,
00181           tic54x_relocation,"LS7",FALSE,0x007F,0x007F,FALSE),
00182 
00183     /* 9 MSBs of an address */
00184     /* TI assembler doesn't shift its encoding, and is thus incompatible */
00185     HOWTO (R_PARTMS9,7,1,9,FALSE,0,complain_overflow_dont,
00186           tic54x_relocation,"MS9",FALSE,0x01FF,0x01FF,FALSE),
00187 
00188     /* 23-bit relocation */
00189     HOWTO (R_EXTWORD,0,2,23,FALSE,0,complain_overflow_dont,
00190           tic54x_relocation,"RELEXT",FALSE,0x7FFFFF,0x7FFFFF,FALSE),
00191 
00192     /* 16 bits of 23-bit extended address */
00193     HOWTO (R_EXTWORD16,0,1,16,FALSE,0,complain_overflow_dont,
00194           tic54x_relocation,"RELEXT16",FALSE,0x7FFFFF,0x7FFFFF,FALSE),
00195 
00196     /* upper 7 bits of 23-bit extended address */
00197     HOWTO (R_EXTWORDMS7,16,1,7,FALSE,0,complain_overflow_dont,
00198           tic54x_relocation,"RELEXTMS7",FALSE,0x7F,0x7F,FALSE),
00199 
00200     /* ABSOLUTE BANK */
00201     /* 16-bit direct reference to symbol's address, absolute */
00202     HOWTO (R_RELWORD,0,1,16,FALSE,0,complain_overflow_dont,
00203           tic54x_relocation,"AREL16",FALSE,0xFFFF,0xFFFF,FALSE),
00204 
00205     /* 7 LSBs of an address, absolute */
00206     HOWTO (R_PARTLS7,0,1,7,FALSE,0,complain_overflow_dont,
00207           tic54x_relocation,"ALS7",FALSE,0x007F,0x007F,FALSE),
00208 
00209     /* 9 MSBs of an address, absolute */
00210     /* TI assembler doesn't shift its encoding, and is thus incompatible */
00211     HOWTO (R_PARTMS9,7,1,9,FALSE,0,complain_overflow_dont,
00212           tic54x_relocation,"AMS9",FALSE,0x01FF,0x01FF,FALSE),
00213 
00214     /* 23-bit direct reference, absolute */
00215     HOWTO (R_EXTWORD,0,2,23,FALSE,0,complain_overflow_dont,
00216           tic54x_relocation,"ARELEXT",FALSE,0x7FFFFF,0x7FFFFF,FALSE),
00217 
00218     /* 16 bits of 23-bit extended address, absolute */
00219     HOWTO (R_EXTWORD16,0,1,16,FALSE,0,complain_overflow_dont,
00220           tic54x_relocation,"ARELEXT16",FALSE,0x7FFFFF,0x7FFFFF,FALSE),
00221 
00222     /* upper 7 bits of 23-bit extended address, absolute */
00223     HOWTO (R_EXTWORDMS7,16,1,7,FALSE,0,complain_overflow_dont,
00224           tic54x_relocation,"ARELEXTMS7",FALSE,0x7F,0x7F,FALSE),
00225 
00226     /* 32-bit relocation exclusively for stabs */
00227     HOWTO (R_RELLONG,0,2,32,FALSE,0,complain_overflow_dont,
00228           tic54x_relocation,"STAB",FALSE,0xFFFFFFFF,0xFFFFFFFF,FALSE),
00229   };
00230 
00231 #define coff_bfd_reloc_type_lookup tic54x_coff_reloc_type_lookup
00232 #define coff_bfd_reloc_name_lookup tic54x_coff_reloc_name_lookup
00233 
00234 /* For the case statement use the code values used tc_gen_reloc (defined in
00235    bfd/reloc.c) to map to the howto table entries.  */
00236 
00237 reloc_howto_type *
00238 tic54x_coff_reloc_type_lookup (abfd, code)
00239      bfd *abfd ATTRIBUTE_UNUSED;
00240      bfd_reloc_code_real_type code;
00241 {
00242   switch (code)
00243     {
00244     case BFD_RELOC_16:
00245       return &tic54x_howto_table[0];
00246     case BFD_RELOC_TIC54X_PARTLS7:
00247       return &tic54x_howto_table[1];
00248     case BFD_RELOC_TIC54X_PARTMS9:
00249       return &tic54x_howto_table[2];
00250     case BFD_RELOC_TIC54X_23:
00251       return &tic54x_howto_table[3];
00252     case BFD_RELOC_TIC54X_16_OF_23:
00253       return &tic54x_howto_table[4];
00254     case BFD_RELOC_TIC54X_MS7_OF_23:
00255       return &tic54x_howto_table[5];
00256     case BFD_RELOC_32:
00257       return &tic54x_howto_table[12];
00258     default:
00259       return (reloc_howto_type *) NULL;
00260     }
00261 }
00262 
00263 static reloc_howto_type *
00264 tic54x_coff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
00265                             const char *r_name)
00266 {
00267   unsigned int i;
00268 
00269   for (i = 0;
00270        i < sizeof (tic54x_howto_table) / sizeof (tic54x_howto_table[0]);
00271        i++)
00272     if (tic54x_howto_table[i].name != NULL
00273        && strcasecmp (tic54x_howto_table[i].name, r_name) == 0)
00274       return &tic54x_howto_table[i];
00275 
00276   return NULL;
00277 }
00278 
00279 /* Code to turn a r_type into a howto ptr, uses the above howto table.
00280    Called after some initial checking by the tic54x_rtype_to_howto fn below.  */
00281 
00282 static void
00283 tic54x_lookup_howto (internal, dst)
00284      arelent *internal;
00285      struct internal_reloc *dst;
00286 {
00287   unsigned i;
00288   int bank = (dst->r_symndx == -1) ? HOWTO_BANK : 0;
00289 
00290   for (i = 0; i < sizeof tic54x_howto_table/sizeof tic54x_howto_table[0]; i++)
00291     {
00292       if (tic54x_howto_table[i].type == dst->r_type)
00293        {
00294          internal->howto = tic54x_howto_table + i + bank;
00295          return;
00296        }
00297     }
00298 
00299   (*_bfd_error_handler) (_("Unrecognized reloc type 0x%x"),
00300                       (unsigned int) dst->r_type);
00301   abort ();
00302 }
00303 
00304 #define RELOC_PROCESSING(RELENT,RELOC,SYMS,ABFD,SECT)\
00305  tic54x_reloc_processing(RELENT,RELOC,SYMS,ABFD,SECT)
00306 
00307 #define coff_rtype_to_howto coff_tic54x_rtype_to_howto
00308 
00309 static reloc_howto_type *
00310 coff_tic54x_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
00311      bfd *abfd ATTRIBUTE_UNUSED;
00312      asection *sec;
00313      struct internal_reloc *rel;
00314      struct coff_link_hash_entry *h ATTRIBUTE_UNUSED;
00315      struct internal_syment *sym ATTRIBUTE_UNUSED;
00316      bfd_vma *addendp;
00317 {
00318   arelent genrel;
00319 
00320   if (rel->r_symndx == -1 && addendp != NULL)
00321     {
00322       /* This is a TI "internal relocation", which means that the relocation
00323         amount is the amount by which the current section is being relocated
00324         in the output section.  */
00325       *addendp = (sec->output_section->vma + sec->output_offset) - sec->vma;
00326     }
00327 
00328   tic54x_lookup_howto (&genrel, rel);
00329 
00330   return genrel.howto;
00331 }
00332 
00333 /* Replace the stock _bfd_coff_is_local_label_name to recognize TI COFF local
00334    labels.  */
00335 
00336 static bfd_boolean
00337 ticoff_bfd_is_local_label_name (abfd, name)
00338   bfd *abfd ATTRIBUTE_UNUSED;
00339   const char *name;
00340 {
00341   if (TICOFF_LOCAL_LABEL_P(name))
00342     return TRUE;
00343   return FALSE;
00344 }
00345 
00346 #define coff_bfd_is_local_label_name ticoff_bfd_is_local_label_name
00347 
00348 /* Clear the r_reserved field in relocs.  */
00349 #define SWAP_OUT_RELOC_EXTRA(abfd,src,dst) \
00350   do \
00351     { \
00352       dst->r_reserved[0] = 0; \
00353       dst->r_reserved[1] = 0; \
00354     } \
00355   while (0)
00356 
00357 /* Customize coffcode.h; the default coff_ functions are set up to use COFF2;
00358    coff_bad_format_hook uses BADMAG, so set that for COFF2.  The COFF1
00359    and COFF0 vectors use custom _bad_format_hook procs instead of setting
00360    BADMAG.  */
00361 #define BADMAG(x) COFF2_BADMAG(x)
00362 #include "coffcode.h"
00363 
00364 static bfd_boolean
00365 tic54x_set_section_contents (abfd, section, location, offset, bytes_to_do)
00366      bfd *abfd;
00367      sec_ptr section;
00368      const PTR location;
00369      file_ptr offset;
00370      bfd_size_type bytes_to_do;
00371 {
00372   return coff_set_section_contents (abfd, section, location,
00373                                     offset, bytes_to_do);
00374 }
00375 
00376 static void
00377 tic54x_reloc_processing (relent, reloc, symbols, abfd, section)
00378      arelent *relent;
00379      struct internal_reloc *reloc;
00380      asymbol **symbols;
00381      bfd *abfd;
00382      asection *section;
00383 {
00384   asymbol *ptr;
00385 
00386   relent->address = reloc->r_vaddr;
00387 
00388   if (reloc->r_symndx != -1)
00389     {
00390       if (reloc->r_symndx < 0 || reloc->r_symndx >= obj_conv_table_size (abfd))
00391         {
00392           (*_bfd_error_handler)
00393             (_("%B: warning: illegal symbol index %ld in relocs"),
00394              abfd, reloc->r_symndx);
00395           relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
00396           ptr = NULL;
00397         }
00398       else
00399         {
00400           relent->sym_ptr_ptr = (symbols
00401                                  + obj_convert (abfd)[reloc->r_symndx]);
00402           ptr = *(relent->sym_ptr_ptr);
00403         }
00404     }
00405   else
00406     {
00407       relent->sym_ptr_ptr = section->symbol_ptr_ptr;
00408       ptr = *(relent->sym_ptr_ptr);
00409     }
00410 
00411   /* The symbols definitions that we have read in have been
00412      relocated as if their sections started at 0. But the offsets
00413      refering to the symbols in the raw data have not been
00414      modified, so we have to have a negative addend to compensate.
00415 
00416      Note that symbols which used to be common must be left alone.  */
00417 
00418   /* Calculate any reloc addend by looking at the symbol.  */
00419   CALC_ADDEND (abfd, ptr, *reloc, relent);
00420 
00421   relent->address -= section->vma;
00422   /* !!     relent->section = (asection *) NULL;*/
00423 
00424   /* Fill in the relent->howto field from reloc->r_type.  */
00425   tic54x_lookup_howto (relent, reloc);
00426 }
00427 
00428 /* TI COFF v0, DOS tools (little-endian headers).  */
00429 const bfd_target tic54x_coff0_vec =
00430   {
00431     "coff0-c54x",                  /* name */
00432     bfd_target_coff_flavour,
00433     BFD_ENDIAN_LITTLE,             /* data byte order is little */
00434     BFD_ENDIAN_LITTLE,             /* header byte order is little (DOS tools) */
00435 
00436     (HAS_RELOC | EXEC_P |          /* object flags */
00437      HAS_LINENO | HAS_DEBUG |
00438      HAS_SYMS | HAS_LOCALS | WP_TEXT ),
00439 
00440     (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
00441     '_',                           /* leading symbol underscore */
00442     '/',                           /* ar_pad_char */
00443     15,                            /* ar_max_namelen */
00444     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
00445     tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
00446     bfd_getl16, bfd_getl_signed_16, bfd_putl16,  /* data */
00447     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
00448     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
00449     bfd_getl16, bfd_getl_signed_16, bfd_putl16,  /* hdrs */
00450 
00451     {_bfd_dummy_target, coff_object_p,    /* bfd_check_format */
00452      bfd_generic_archive_p, _bfd_dummy_target},
00453     {bfd_false, coff_mkobject, _bfd_generic_mkarchive,  /* bfd_set_format */
00454      bfd_false},
00455     {bfd_false, coff_write_object_contents,      /* bfd_write_contents */
00456      _bfd_write_archive_contents, bfd_false},
00457 
00458     BFD_JUMP_TABLE_GENERIC (coff),
00459     BFD_JUMP_TABLE_COPY (coff),
00460     BFD_JUMP_TABLE_CORE (_bfd_nocore),
00461     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
00462     BFD_JUMP_TABLE_SYMBOLS (coff),
00463     BFD_JUMP_TABLE_RELOCS (coff),
00464     BFD_JUMP_TABLE_WRITE (tic54x),
00465     BFD_JUMP_TABLE_LINK (coff),
00466     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
00467     NULL,
00468 
00469     (PTR) & ticoff0_swap_table
00470   };
00471 
00472 /* TI COFF v0, SPARC tools (big-endian headers).  */
00473 const bfd_target tic54x_coff0_beh_vec =
00474   {
00475     "coff0-beh-c54x",                     /* name */
00476     bfd_target_coff_flavour,
00477     BFD_ENDIAN_LITTLE,             /* data byte order is little */
00478     BFD_ENDIAN_BIG,         /* header byte order is big */
00479 
00480     (HAS_RELOC | EXEC_P |          /* object flags */
00481      HAS_LINENO | HAS_DEBUG |
00482      HAS_SYMS | HAS_LOCALS | WP_TEXT ),
00483 
00484     (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
00485     '_',                           /* leading symbol underscore */
00486     '/',                           /* ar_pad_char */
00487     15,                            /* ar_max_namelen */
00488     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
00489     tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
00490     bfd_getl16, bfd_getl_signed_16, bfd_putl16,  /* data */
00491     bfd_getb64, bfd_getb_signed_64, bfd_putb64,
00492     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
00493     bfd_getb16, bfd_getb_signed_16, bfd_putb16,  /* hdrs */
00494 
00495     {_bfd_dummy_target, coff_object_p,    /* bfd_check_format */
00496      bfd_generic_archive_p, _bfd_dummy_target},
00497     {bfd_false, coff_mkobject, _bfd_generic_mkarchive,  /* bfd_set_format */
00498      bfd_false},
00499     {bfd_false, coff_write_object_contents,      /* bfd_write_contents */
00500      _bfd_write_archive_contents, bfd_false},
00501 
00502     BFD_JUMP_TABLE_GENERIC (coff),
00503     BFD_JUMP_TABLE_COPY (coff),
00504     BFD_JUMP_TABLE_CORE (_bfd_nocore),
00505     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
00506     BFD_JUMP_TABLE_SYMBOLS (coff),
00507     BFD_JUMP_TABLE_RELOCS (coff),
00508     BFD_JUMP_TABLE_WRITE (tic54x),
00509     BFD_JUMP_TABLE_LINK (coff),
00510     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
00511 
00512     & tic54x_coff0_vec,
00513 
00514     (PTR) & ticoff0_swap_table
00515   };
00516 
00517 /* TI COFF v1, DOS tools (little-endian headers).  */
00518 const bfd_target tic54x_coff1_vec =
00519   {
00520     "coff1-c54x",                  /* name */
00521     bfd_target_coff_flavour,
00522     BFD_ENDIAN_LITTLE,             /* data byte order is little */
00523     BFD_ENDIAN_LITTLE,             /* header byte order is little (DOS tools) */
00524 
00525     (HAS_RELOC | EXEC_P |          /* object flags */
00526      HAS_LINENO | HAS_DEBUG |
00527      HAS_SYMS | HAS_LOCALS | WP_TEXT ),
00528 
00529     (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
00530     '_',                           /* leading symbol underscore */
00531     '/',                           /* ar_pad_char */
00532     15,                            /* ar_max_namelen */
00533     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
00534     tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
00535     bfd_getl16, bfd_getl_signed_16, bfd_putl16,  /* data */
00536     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
00537     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
00538     bfd_getl16, bfd_getl_signed_16, bfd_putl16,  /* hdrs */
00539 
00540     {_bfd_dummy_target, coff_object_p,    /* bfd_check_format */
00541      bfd_generic_archive_p, _bfd_dummy_target},
00542     {bfd_false, coff_mkobject, _bfd_generic_mkarchive,  /* bfd_set_format */
00543      bfd_false},
00544     {bfd_false, coff_write_object_contents,      /* bfd_write_contents */
00545      _bfd_write_archive_contents, bfd_false},
00546 
00547     BFD_JUMP_TABLE_GENERIC (coff),
00548     BFD_JUMP_TABLE_COPY (coff),
00549     BFD_JUMP_TABLE_CORE (_bfd_nocore),
00550     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
00551     BFD_JUMP_TABLE_SYMBOLS (coff),
00552     BFD_JUMP_TABLE_RELOCS (coff),
00553     BFD_JUMP_TABLE_WRITE (tic54x),
00554     BFD_JUMP_TABLE_LINK (coff),
00555     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
00556 
00557     & tic54x_coff0_beh_vec,
00558 
00559     (PTR) & ticoff1_swap_table
00560 };
00561 
00562 /* TI COFF v1, SPARC tools (big-endian headers).  */
00563 const bfd_target tic54x_coff1_beh_vec =
00564   {
00565     "coff1-beh-c54x",                     /* name */
00566     bfd_target_coff_flavour,
00567     BFD_ENDIAN_LITTLE,             /* data byte order is little */
00568     BFD_ENDIAN_BIG,         /* header byte order is big */
00569 
00570     (HAS_RELOC | EXEC_P |          /* object flags */
00571      HAS_LINENO | HAS_DEBUG |
00572      HAS_SYMS | HAS_LOCALS | WP_TEXT ),
00573 
00574     (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
00575     '_',                           /* leading symbol underscore */
00576     '/',                           /* ar_pad_char */
00577     15,                            /* ar_max_namelen */
00578     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
00579     tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
00580     bfd_getl16, bfd_getl_signed_16, bfd_putl16,  /* data */
00581     bfd_getb64, bfd_getb_signed_64, bfd_putb64,
00582     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
00583     bfd_getb16, bfd_getb_signed_16, bfd_putb16,  /* hdrs */
00584 
00585     {_bfd_dummy_target, coff_object_p,    /* bfd_check_format */
00586      bfd_generic_archive_p, _bfd_dummy_target},
00587     {bfd_false, coff_mkobject, _bfd_generic_mkarchive,  /* bfd_set_format */
00588      bfd_false},
00589     {bfd_false, coff_write_object_contents,      /* bfd_write_contents */
00590      _bfd_write_archive_contents, bfd_false},
00591 
00592     BFD_JUMP_TABLE_GENERIC (coff),
00593     BFD_JUMP_TABLE_COPY (coff),
00594     BFD_JUMP_TABLE_CORE (_bfd_nocore),
00595     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
00596     BFD_JUMP_TABLE_SYMBOLS (coff),
00597     BFD_JUMP_TABLE_RELOCS (coff),
00598     BFD_JUMP_TABLE_WRITE (tic54x),
00599     BFD_JUMP_TABLE_LINK (coff),
00600     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
00601 
00602     & tic54x_coff1_vec,
00603 
00604     (PTR) & ticoff1_swap_table
00605   };
00606 
00607 /* TI COFF v2, TI DOS tools output (little-endian headers).  */
00608 const bfd_target tic54x_coff2_vec =
00609   {
00610     "coff2-c54x",                  /* name */
00611     bfd_target_coff_flavour,
00612     BFD_ENDIAN_LITTLE,             /* data byte order is little */
00613     BFD_ENDIAN_LITTLE,             /* header byte order is little (DOS tools) */
00614 
00615     (HAS_RELOC | EXEC_P |          /* object flags */
00616      HAS_LINENO | HAS_DEBUG |
00617      HAS_SYMS | HAS_LOCALS | WP_TEXT ),
00618 
00619     (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
00620     '_',                           /* leading symbol underscore */
00621     '/',                           /* ar_pad_char */
00622     15,                            /* ar_max_namelen */
00623     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
00624     tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
00625     bfd_getl16, bfd_getl_signed_16, bfd_putl16,  /* data */
00626     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
00627     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
00628     bfd_getl16, bfd_getl_signed_16, bfd_putl16,  /* hdrs */
00629 
00630     {_bfd_dummy_target, coff_object_p,    /* bfd_check_format */
00631      bfd_generic_archive_p, _bfd_dummy_target},
00632     {bfd_false, coff_mkobject, _bfd_generic_mkarchive,  /* bfd_set_format */
00633      bfd_false},
00634     {bfd_false, coff_write_object_contents,      /* bfd_write_contents */
00635      _bfd_write_archive_contents, bfd_false},
00636 
00637     BFD_JUMP_TABLE_GENERIC (coff),
00638     BFD_JUMP_TABLE_COPY (coff),
00639     BFD_JUMP_TABLE_CORE (_bfd_nocore),
00640     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
00641     BFD_JUMP_TABLE_SYMBOLS (coff),
00642     BFD_JUMP_TABLE_RELOCS (coff),
00643     BFD_JUMP_TABLE_WRITE (tic54x),
00644     BFD_JUMP_TABLE_LINK (coff),
00645     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
00646 
00647     & tic54x_coff1_beh_vec,
00648 
00649     COFF_SWAP_TABLE
00650   };
00651 
00652 /* TI COFF v2, TI SPARC tools output (big-endian headers).  */
00653 const bfd_target tic54x_coff2_beh_vec =
00654   {
00655     "coff2-beh-c54x",                     /* name */
00656     bfd_target_coff_flavour,
00657     BFD_ENDIAN_LITTLE,             /* data byte order is little */
00658     BFD_ENDIAN_BIG,         /* header byte order is big */
00659 
00660     (HAS_RELOC | EXEC_P |          /* object flags */
00661      HAS_LINENO | HAS_DEBUG |
00662      HAS_SYMS | HAS_LOCALS | WP_TEXT ),
00663 
00664     (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
00665     '_',                           /* leading symbol underscore */
00666     '/',                           /* ar_pad_char */
00667     15,                            /* ar_max_namelen */
00668     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
00669     tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
00670     bfd_getl16, bfd_getl_signed_16, bfd_putl16,  /* data */
00671     bfd_getb64, bfd_getb_signed_64, bfd_putb64,
00672     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
00673     bfd_getb16, bfd_getb_signed_16, bfd_putb16,  /* hdrs */
00674 
00675     {_bfd_dummy_target, coff_object_p,    /* bfd_check_format */
00676      bfd_generic_archive_p, _bfd_dummy_target},
00677     {bfd_false, coff_mkobject, _bfd_generic_mkarchive,  /* bfd_set_format */
00678      bfd_false},
00679     {bfd_false, coff_write_object_contents,      /* bfd_write_contents */
00680      _bfd_write_archive_contents, bfd_false},
00681 
00682     BFD_JUMP_TABLE_GENERIC (coff),
00683     BFD_JUMP_TABLE_COPY (coff),
00684     BFD_JUMP_TABLE_CORE (_bfd_nocore),
00685     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
00686     BFD_JUMP_TABLE_SYMBOLS (coff),
00687     BFD_JUMP_TABLE_RELOCS (coff),
00688     BFD_JUMP_TABLE_WRITE (tic54x),
00689     BFD_JUMP_TABLE_LINK (coff),
00690     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
00691 
00692     & tic54x_coff2_vec,
00693 
00694     COFF_SWAP_TABLE
00695   };