Back to index

cell-binutils  2.17cvs20070401
tic80.h
Go to the documentation of this file.
00001 /* coff information for TI TMS320C80 (MVP)
00002    
00003    Copyright 2001 Free Software Foundation, Inc.
00004 
00005    This program is free software; you can redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; either version 2 of the License, or
00008    (at your option) any later version.
00009    
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014    
00015    You should have received a copy of the GNU General Public License
00016    along with this program; if not, write to the Free Software
00017    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00018 
00019 #define DO_NOT_DEFINE_FILHDR
00020 #define DO_NOT_DEFINE_SCNHDR
00021 #define L_LNNO_SIZE 2
00022 #include "coff/external.h"
00023 
00024 /********************** FILE HEADER **********************/
00025 
00026 struct external_filehdr
00027   {
00028     char f_magic[2]; /* magic number                    */
00029     char f_nscns[2]; /* number of sections              */
00030     char f_timdat[4];       /* time & date stamp        */
00031     char f_symptr[4];       /* file pointer to symtab   */
00032     char f_nsyms[4]; /* number of symtab entries */
00033     char f_opthdr[2];       /* sizeof(optional hdr)            */
00034     char f_flags[2]; /* flags                    */
00035     char f_target_id[2];/* target id (TIc80 specific)   */
00036 };
00037 
00038 #define       TIC80_ARCH_MAGIC     0x0C1  /* Goes in the file header magic number field */
00039 #define TIC80_TARGET_ID            0x95   /* Goes in the target id field */
00040 
00041 #define TIC80BADMAG(x) ((x).f_magic != TIC80_ARCH_MAGIC)
00042 
00043 #define       FILHDR struct external_filehdr
00044 #define       FILHSZ 22
00045 
00046 #define TIC80_AOUTHDR_MAGIC 0x108  /* Goes in the optional file header magic number field */
00047 
00048 /********************** SECTION HEADER **********************/
00049 
00050 struct external_scnhdr
00051 {
00052        char          s_name[8];    /* section name                    */
00053        char          s_paddr[4];   /* physical address, aliased s_nlib */
00054        char          s_vaddr[4];   /* virtual address          */
00055        char          s_size[4];    /* section size                    */
00056        char          s_scnptr[4];  /* file ptr to raw data for section */
00057        char          s_relptr[4];  /* file ptr to relocation   */
00058        char          s_lnnoptr[4]; /* file ptr to line numbers */
00059        char          s_nreloc[2];  /* number of relocation entries    */
00060        char          s_nlnno[2];   /* number of line number entries*/
00061        char          s_flags[2];   /* flags                    */
00062        char          s_reserved[1];       /* reserved (TIc80 specific)       */
00063        char          s_mempage[1]; /* memory page number (TIc80)      */
00064 };
00065 
00066 /* Names of "special" sections.  */
00067 #define _TEXT ".text"
00068 #define _DATA ".data"
00069 #define _BSS  ".bss"
00070 #define _CINIT       ".cinit"
00071 #define _CONST       ".const"
00072 #define _SWITCH      ".switch"
00073 #define _STACK       ".stack"
00074 #define _SYSMEM      ".sysmem"
00075 
00076 #define       SCNHDR struct external_scnhdr
00077 #define       SCNHSZ 40
00078   
00079 /* FIXME - need to correlate external_auxent with
00080    TIc80 Code Generation Tools User's Guide, CG:A-25 */
00081 
00082 /********************** RELOCATION DIRECTIVES **********************/
00083 
00084 /* The external reloc has an offset field, because some of the reloc
00085    types on the h8 don't have room in the instruction for the entire
00086    offset - eg the strange jump and high page addressing modes.  */
00087 
00088 struct external_reloc
00089 {
00090   char r_vaddr[4];
00091   char r_symndx[4];
00092   char r_reserved[2];
00093   char r_type[2];
00094 };
00095 
00096 #define RELOC struct external_reloc
00097 #define RELSZ 12
00098 
00099 /* TIc80 relocation types. */
00100 
00101 #define R_ABS        0x00          /* Absolute address - no relocation */
00102 #define R_RELLONGX   0x11          /* PP: 32 bits, direct */
00103 #define R_PPBASE     0x34          /* PP: Global base address type */
00104 #define R_PPLBASE    0x35          /* PP: Local base address type */
00105 #define R_PP15              0x38          /* PP: Global 15 bit offset */
00106 #define R_PP15W             0x39          /* PP: Global 15 bit offset divided by 4 */
00107 #define R_PP15H             0x3A          /* PP: Global 15 bit offset divided by 2 */
00108 #define R_PP16B             0x3B          /* PP: Global 16 bit offset for bytes */
00109 #define R_PPL15             0x3C          /* PP: Local 15 bit offset */
00110 #define R_PPL15W     0x3D          /* PP: Local 15 bit offset divided by 4 */
00111 #define R_PPL15H     0x3E          /* PP: Local 15 bit offset divided by 2 */
00112 #define R_PPL16B     0x3F          /* PP: Local 16 bit offset for bytes */
00113 #define R_PPN15             0x40          /* PP: Global 15 bit negative offset */
00114 #define R_PPN15W     0x41          /* PP: Global 15 bit negative offset divided by 4 */
00115 #define R_PPN15H     0x42          /* PP: Global 15 bit negative offset divided by 2 */
00116 #define R_PPN16B     0x43          /* PP: Global 16 bit negative byte offset */
00117 #define R_PPLN15     0x44          /* PP: Local 15 bit negative offset */
00118 #define R_PPLN15W    0x45          /* PP: Local 15 bit negative offset divided by 4 */
00119 #define R_PPLN15H    0x46          /* PP: Local 15 bit negative offset divided by 2 */
00120 #define R_PPLN16B    0x47          /* PP: Local 16 bit negative byte offset */
00121 #define R_MPPCR15W   0x4E          /* MP: 15 bit PC-relative divided by 4 */
00122 #define R_MPPCR             0x4F          /* MP: 32 bit PC-relative divided by 4 */