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