1 /* coff information for Intel 860. 2 3 Copyright 2001 Free Software Foundation, Inc. 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 18 19 /********************** FILE HEADER **********************/ 20 21 struct external_filehdr { 22 char f_magic[2]; /* magic number */ 23 char f_nscns[2]; /* number of sections */ 24 char f_timdat[4]; /* time & date stamp */ 25 char f_symptr[4]; /* file pointer to symtab */ 26 char f_nsyms[4]; /* number of symtab entries */ 27 char f_opthdr[2]; /* sizeof(optional hdr) */ 28 char f_flags[2]; /* flags */ 29 }; 30 31 32 /* Bits for f_flags: 33 * F_RELFLG relocation info stripped from file 34 * F_EXEC file is executable (no unresolved external references) 35 * F_LNNO line numbers stripped from file 36 * F_LSYMS local symbols stripped from file 37 * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) 38 */ 39 40 #define F_RELFLG (0x0001) 41 #define F_EXEC (0x0002) 42 #define F_LNNO (0x0004) 43 #define F_LSYMS (0x0008) 44 45 46 47 #define I860MAGIC 0x14d 48 49 #define I860BADMAG(x) ((x).f_magic != I860MAGIC) 50 51 #define FILHDR struct external_filehdr 52 #define FILHSZ 20 53 54 55 /********************** AOUT "OPTIONAL HEADER" **********************/ 56 57 58 typedef struct 59 { 60 char magic[2]; /* type of file */ 61 char vstamp[2]; /* version stamp */ 62 char tsize[4]; /* text size in bytes, padded to FW bdry*/ 63 char dsize[4]; /* initialized data " " */ 64 char bsize[4]; /* uninitialized data " " */ 65 char entry[4]; /* entry pt. */ 66 char text_start[4]; /* base of text used for this file */ 67 char data_start[4]; /* base of data used for this file */ 68 } 69 AOUTHDR; 70 71 72 #define AOUTSZ 28 73 #define AOUTHDRSZ 28 74 75 /* FIXME: What are the a.out magic numbers? */ 76 77 /********************** SECTION HEADER **********************/ 78 79 80 struct external_scnhdr { 81 char s_name[8]; /* section name */ 82 char s_paddr[4]; /* physical address, aliased s_nlib */ 83 char s_vaddr[4]; /* virtual address */ 84 char s_size[4]; /* section size */ 85 char s_scnptr[4]; /* file ptr to raw data for section */ 86 char s_relptr[4]; /* file ptr to relocation */ 87 char s_lnnoptr[4]; /* file ptr to line numbers */ 88 char s_nreloc[2]; /* number of relocation entries */ 89 char s_nlnno[2]; /* number of line number entries*/ 90 char s_flags[4]; /* flags */ 91 }; 92 93 #define SCNHDR struct external_scnhdr 94 #define SCNHSZ 40 95 96 /* 97 * names of "special" sections 98 */ 99 #define _TEXT ".text" 100 #define _DATA ".data" 101 #define _BSS ".bss" 102 #define _COMMENT ".comment" 103 #define _LIB ".lib" 104 105 /********************** LINE NUMBERS **********************/ 106 107 /* 1 line number entry for every "breakpointable" source line in a section. 108 * Line numbers are grouped on a per function basis; first entry in a function 109 * grouping will have l_lnno = 0 and in place of physical address will be the 110 * symbol table index of the function name. 111 */ 112 struct external_lineno { 113 union { 114 char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ 115 char l_paddr[4]; /* (physical) address of line number */ 116 } l_addr; 117 char l_lnno[2]; /* line number */ 118 }; 119 120 121 #define LINENO struct external_lineno 122 #define LINESZ 6 123 124 125 /********************** SYMBOLS **********************/ 126 127 #define E_SYMNMLEN 8 /* # characters in a symbol name */ 128 #define E_FILNMLEN 14 /* # characters in a file name */ 129 #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ 130 131 struct external_syment 132 { 133 union { 134 char e_name[E_SYMNMLEN]; 135 struct { 136 char e_zeroes[4]; 137 char e_offset[4]; 138 } e; 139 } e; 140 char e_value[4]; 141 char e_scnum[2]; 142 char e_type[2]; 143 char e_sclass[1]; 144 char e_numaux[1]; 145 }; 146 147 #define N_BTMASK (0xf) 148 #define N_TMASK (0x30) 149 #define N_BTSHFT (4) 150 #define N_TSHIFT (2) 151 152 union external_auxent { 153 struct { 154 char x_tagndx[4]; /* str, un, or enum tag indx */ 155 union { 156 struct { 157 char x_lnno[2]; /* declaration line number */ 158 char x_size[2]; /* str/union/array size */ 159 } x_lnsz; 160 char x_fsize[4]; /* size of function */ 161 } x_misc; 162 union { 163 struct { /* if ISFCN, tag, or .bb */ 164 char x_lnnoptr[4]; /* ptr to fcn line # */ 165 char x_endndx[4]; /* entry ndx past block end */ 166 } x_fcn; 167 struct { /* if ISARY, up to 4 dimen. */ 168 char x_dimen[E_DIMNUM][2]; 169 } x_ary; 170 } x_fcnary; 171 char x_tvndx[2]; /* tv index */ 172 } x_sym; 173 174 union { 175 char x_fname[E_FILNMLEN]; 176 struct { 177 char x_zeroes[4]; 178 char x_offset[4]; 179 } x_n; 180 } x_file; 181 182 struct { 183 char x_scnlen[4]; /* section length */ 184 char x_nreloc[2]; /* # relocation entries */ 185 char x_nlinno[2]; /* # line numbers */ 186 } x_scn; 187 188 struct { 189 char x_tvfill[4]; /* tv fill value */ 190 char x_tvlen[2]; /* length of .tv */ 191 char x_tvran[2][2]; /* tv range */ 192 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ 193 194 195 }; 196 197 #define SYMENT struct external_syment 198 #define SYMESZ 18 199 #define AUXENT union external_auxent 200 #define AUXESZ 18 201 202 203 # define _ETEXT "etext" 204 205 206 /********************** RELOCATION DIRECTIVES **********************/ 207 208 209 210 struct external_reloc { 211 char r_vaddr[4]; 212 char r_symndx[4]; 213 char r_type[2]; 214 }; 215 216 217 #define RELOC struct external_reloc 218 #define RELSZ 10 219