1*3d8817e4Smiod /* coff information for TI TMS320C80 (MVP) 2*3d8817e4Smiod 3*3d8817e4Smiod Copyright 2001 Free Software Foundation, Inc. 4*3d8817e4Smiod 5*3d8817e4Smiod This program is free software; you can redistribute it and/or modify 6*3d8817e4Smiod it under the terms of the GNU General Public License as published by 7*3d8817e4Smiod the Free Software Foundation; either version 2 of the License, or 8*3d8817e4Smiod (at your option) any later version. 9*3d8817e4Smiod 10*3d8817e4Smiod This program is distributed in the hope that it will be useful, 11*3d8817e4Smiod but WITHOUT ANY WARRANTY; without even the implied warranty of 12*3d8817e4Smiod MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13*3d8817e4Smiod GNU General Public License for more details. 14*3d8817e4Smiod 15*3d8817e4Smiod You should have received a copy of the GNU General Public License 16*3d8817e4Smiod along with this program; if not, write to the Free Software 17*3d8817e4Smiod Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 18*3d8817e4Smiod 19*3d8817e4Smiod #define DO_NOT_DEFINE_FILHDR 20*3d8817e4Smiod #define DO_NOT_DEFINE_SCNHDR 21*3d8817e4Smiod #define L_LNNO_SIZE 2 22*3d8817e4Smiod #include "coff/external.h" 23*3d8817e4Smiod 24*3d8817e4Smiod /********************** FILE HEADER **********************/ 25*3d8817e4Smiod 26*3d8817e4Smiod struct external_filehdr 27*3d8817e4Smiod { 28*3d8817e4Smiod char f_magic[2]; /* magic number */ 29*3d8817e4Smiod char f_nscns[2]; /* number of sections */ 30*3d8817e4Smiod char f_timdat[4]; /* time & date stamp */ 31*3d8817e4Smiod char f_symptr[4]; /* file pointer to symtab */ 32*3d8817e4Smiod char f_nsyms[4]; /* number of symtab entries */ 33*3d8817e4Smiod char f_opthdr[2]; /* sizeof(optional hdr) */ 34*3d8817e4Smiod char f_flags[2]; /* flags */ 35*3d8817e4Smiod char f_target_id[2];/* target id (TIc80 specific) */ 36*3d8817e4Smiod }; 37*3d8817e4Smiod 38*3d8817e4Smiod #define TIC80_ARCH_MAGIC 0x0C1 /* Goes in the file header magic number field */ 39*3d8817e4Smiod #define TIC80_TARGET_ID 0x95 /* Goes in the target id field */ 40*3d8817e4Smiod 41*3d8817e4Smiod #define TIC80BADMAG(x) ((x).f_magic != TIC80_ARCH_MAGIC) 42*3d8817e4Smiod 43*3d8817e4Smiod #define FILHDR struct external_filehdr 44*3d8817e4Smiod #define FILHSZ 22 45*3d8817e4Smiod 46*3d8817e4Smiod #define TIC80_AOUTHDR_MAGIC 0x108 /* Goes in the optional file header magic number field */ 47*3d8817e4Smiod 48*3d8817e4Smiod /********************** SECTION HEADER **********************/ 49*3d8817e4Smiod 50*3d8817e4Smiod struct external_scnhdr 51*3d8817e4Smiod { 52*3d8817e4Smiod char s_name[8]; /* section name */ 53*3d8817e4Smiod char s_paddr[4]; /* physical address, aliased s_nlib */ 54*3d8817e4Smiod char s_vaddr[4]; /* virtual address */ 55*3d8817e4Smiod char s_size[4]; /* section size */ 56*3d8817e4Smiod char s_scnptr[4]; /* file ptr to raw data for section */ 57*3d8817e4Smiod char s_relptr[4]; /* file ptr to relocation */ 58*3d8817e4Smiod char s_lnnoptr[4]; /* file ptr to line numbers */ 59*3d8817e4Smiod char s_nreloc[2]; /* number of relocation entries */ 60*3d8817e4Smiod char s_nlnno[2]; /* number of line number entries*/ 61*3d8817e4Smiod char s_flags[2]; /* flags */ 62*3d8817e4Smiod char s_reserved[1]; /* reserved (TIc80 specific) */ 63*3d8817e4Smiod char s_mempage[1]; /* memory page number (TIc80) */ 64*3d8817e4Smiod }; 65*3d8817e4Smiod 66*3d8817e4Smiod /* Names of "special" sections. */ 67*3d8817e4Smiod #define _TEXT ".text" 68*3d8817e4Smiod #define _DATA ".data" 69*3d8817e4Smiod #define _BSS ".bss" 70*3d8817e4Smiod #define _CINIT ".cinit" 71*3d8817e4Smiod #define _CONST ".const" 72*3d8817e4Smiod #define _SWITCH ".switch" 73*3d8817e4Smiod #define _STACK ".stack" 74*3d8817e4Smiod #define _SYSMEM ".sysmem" 75*3d8817e4Smiod 76*3d8817e4Smiod #define SCNHDR struct external_scnhdr 77*3d8817e4Smiod #define SCNHSZ 40 78*3d8817e4Smiod 79*3d8817e4Smiod /* FIXME - need to correlate external_auxent with 80*3d8817e4Smiod TIc80 Code Generation Tools User's Guide, CG:A-25 */ 81*3d8817e4Smiod 82*3d8817e4Smiod /********************** RELOCATION DIRECTIVES **********************/ 83*3d8817e4Smiod 84*3d8817e4Smiod /* The external reloc has an offset field, because some of the reloc 85*3d8817e4Smiod types on the h8 don't have room in the instruction for the entire 86*3d8817e4Smiod offset - eg the strange jump and high page addressing modes. */ 87*3d8817e4Smiod 88*3d8817e4Smiod struct external_reloc 89*3d8817e4Smiod { 90*3d8817e4Smiod char r_vaddr[4]; 91*3d8817e4Smiod char r_symndx[4]; 92*3d8817e4Smiod char r_reserved[2]; 93*3d8817e4Smiod char r_type[2]; 94*3d8817e4Smiod }; 95*3d8817e4Smiod 96*3d8817e4Smiod #define RELOC struct external_reloc 97*3d8817e4Smiod #define RELSZ 12 98*3d8817e4Smiod 99*3d8817e4Smiod /* TIc80 relocation types. */ 100*3d8817e4Smiod 101*3d8817e4Smiod #define R_ABS 0x00 /* Absolute address - no relocation */ 102*3d8817e4Smiod #define R_RELLONGX 0x11 /* PP: 32 bits, direct */ 103*3d8817e4Smiod #define R_PPBASE 0x34 /* PP: Global base address type */ 104*3d8817e4Smiod #define R_PPLBASE 0x35 /* PP: Local base address type */ 105*3d8817e4Smiod #define R_PP15 0x38 /* PP: Global 15 bit offset */ 106*3d8817e4Smiod #define R_PP15W 0x39 /* PP: Global 15 bit offset divided by 4 */ 107*3d8817e4Smiod #define R_PP15H 0x3A /* PP: Global 15 bit offset divided by 2 */ 108*3d8817e4Smiod #define R_PP16B 0x3B /* PP: Global 16 bit offset for bytes */ 109*3d8817e4Smiod #define R_PPL15 0x3C /* PP: Local 15 bit offset */ 110*3d8817e4Smiod #define R_PPL15W 0x3D /* PP: Local 15 bit offset divided by 4 */ 111*3d8817e4Smiod #define R_PPL15H 0x3E /* PP: Local 15 bit offset divided by 2 */ 112*3d8817e4Smiod #define R_PPL16B 0x3F /* PP: Local 16 bit offset for bytes */ 113*3d8817e4Smiod #define R_PPN15 0x40 /* PP: Global 15 bit negative offset */ 114*3d8817e4Smiod #define R_PPN15W 0x41 /* PP: Global 15 bit negative offset divided by 4 */ 115*3d8817e4Smiod #define R_PPN15H 0x42 /* PP: Global 15 bit negative offset divided by 2 */ 116*3d8817e4Smiod #define R_PPN16B 0x43 /* PP: Global 16 bit negative byte offset */ 117*3d8817e4Smiod #define R_PPLN15 0x44 /* PP: Local 15 bit negative offset */ 118*3d8817e4Smiod #define R_PPLN15W 0x45 /* PP: Local 15 bit negative offset divided by 4 */ 119*3d8817e4Smiod #define R_PPLN15H 0x46 /* PP: Local 15 bit negative offset divided by 2 */ 120*3d8817e4Smiod #define R_PPLN16B 0x47 /* PP: Local 16 bit negative byte offset */ 121*3d8817e4Smiod #define R_MPPCR15W 0x4E /* MP: 15 bit PC-relative divided by 4 */ 122*3d8817e4Smiod #define R_MPPCR 0x4F /* MP: 32 bit PC-relative divided by 4 */ 123