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