1 /* coff information for 80960. Origins: Intel corp, natch. 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 /* NOTE: Tagentries (cf TAGBITS) are no longer used by the 960 */ 20 21 /********************** FILE HEADER **********************/ 22 23 struct external_filehdr 24 { 25 char f_magic[2]; /* magic number */ 26 char f_nscns[2]; /* number of sections */ 27 char f_timdat[4]; /* time & date stamp */ 28 char f_symptr[4]; /* file pointer to symtab */ 29 char f_nsyms[4]; /* number of symtab entries */ 30 char f_opthdr[2]; /* sizeof(optional hdr) */ 31 char f_flags[2]; /* flags */ 32 }; 33 34 #define OMAGIC (0407) /* old impure format. data immediately 35 follows text. both sections are rw. */ 36 #define NMAGIC (0410) /* split i&d, read-only text */ 37 38 /* 39 * Intel 80960 (I960) processor flags. 40 * F_I960TYPE == mask for processor type field. 41 */ 42 43 #define F_I960TYPE (0xf000) 44 #define F_I960CORE (0x1000) 45 #define F_I960KB (0x2000) 46 #define F_I960SB (0x2000) 47 #define F_I960MC (0x3000) 48 #define F_I960XA (0x4000) 49 #define F_I960CA (0x5000) 50 #define F_I960KA (0x6000) 51 #define F_I960SA (0x6000) 52 #define F_I960JX (0x7000) 53 #define F_I960HX (0x8000) 54 55 56 /** i80960 Magic Numbers 57 */ 58 59 #define I960ROMAGIC (0x160) /* read-only text segments */ 60 #define I960RWMAGIC (0x161) /* read-write text segments */ 61 62 #define I960BADMAG(x) (((x).f_magic!=I960ROMAGIC) && ((x).f_magic!=I960RWMAGIC)) 63 64 #define FILHDR struct external_filehdr 65 #define FILHSZ 20 66 67 /********************** AOUT "OPTIONAL HEADER" **********************/ 68 69 typedef struct 70 { 71 unsigned long phys_addr; 72 unsigned long bitarray; 73 } TAGBITS; 74 75 typedef struct 76 { 77 char magic[2]; /* type of file */ 78 char vstamp[2]; /* version stamp */ 79 char tsize[4]; /* text size in bytes, padded to FW bdry*/ 80 char dsize[4]; /* initialized data " " */ 81 char bsize[4]; /* uninitialized data " " */ 82 char entry[4]; /* entry pt. */ 83 char text_start[4]; /* base of text used for this file */ 84 char data_start[4]; /* base of data used for this file */ 85 char tagentries[4]; /* number of tag entries to follow */ 86 } 87 AOUTHDR; 88 89 /* return a pointer to the tag bits array */ 90 91 #define TAGPTR(aout) ((TAGBITS *) (&(aout.tagentries)+1)) 92 93 /* compute size of a header */ 94 95 /*#define AOUTSZ(aout) (sizeof(AOUTHDR)+(aout.tagentries*sizeof(TAGBITS)))*/ 96 #define AOUTSZ 32 97 #define AOUTHDRSZ 32 98 99 100 /********************** SECTION HEADER **********************/ 101 102 struct external_scnhdr 103 { 104 char s_name[8]; /* section name */ 105 char s_paddr[4]; /* physical address, aliased s_nlib */ 106 char s_vaddr[4]; /* virtual address */ 107 char s_size[4]; /* section size */ 108 char s_scnptr[4]; /* file ptr to raw data for section */ 109 char s_relptr[4]; /* file ptr to relocation */ 110 char s_lnnoptr[4]; /* file ptr to line numbers */ 111 char s_nreloc[2]; /* number of relocation entries */ 112 char s_nlnno[2]; /* number of line number entries*/ 113 char s_flags[4]; /* flags */ 114 char s_align[4]; /* section alignment */ 115 }; 116 117 118 #define SCNHDR struct external_scnhdr 119 #define SCNHSZ 44 120 121 /* 122 * names of "special" sections 123 */ 124 #define _TEXT ".text" 125 #define _DATA ".data" 126 #define _BSS ".bss" 127 128 /********************** LINE NUMBERS **********************/ 129 130 /* 1 line number entry for every "breakpointable" source line in a section. 131 * Line numbers are grouped on a per function basis; first entry in a function 132 * grouping will have l_lnno = 0 and in place of physical address will be the 133 * symbol table index of the function name. 134 */ 135 struct external_lineno 136 { 137 union 138 { 139 char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ 140 char l_paddr[4]; /* (physical) address of line number */ 141 } l_addr; 142 143 char l_lnno[2]; /* line number */ 144 char padding[2]; /* force alignment */ 145 }; 146 147 148 #define LINENO struct external_lineno 149 #define LINESZ 8 150 151 /********************** SYMBOLS **********************/ 152 153 #define E_SYMNMLEN 8 /* # characters in a symbol name */ 154 #define E_FILNMLEN 14 /* # characters in a file name */ 155 #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ 156 157 struct external_syment 158 { 159 union 160 { 161 char e_name[E_SYMNMLEN]; 162 163 struct 164 { 165 char e_zeroes[4]; 166 char e_offset[4]; 167 } e; 168 } e; 169 170 char e_value[4]; 171 char e_scnum[2]; 172 char e_flags[2]; 173 char e_type[4]; 174 char e_sclass[1]; 175 char e_numaux[1]; 176 char pad2[2]; 177 }; 178 179 #define N_BTMASK (0x1f) 180 #define N_TMASK (0x60) 181 #define N_BTSHFT (5) 182 #define N_TSHIFT (2) 183 184 union external_auxent 185 { 186 struct 187 { 188 char x_tagndx[4]; /* str, un, or enum tag indx */ 189 190 union 191 { 192 struct 193 { 194 char x_lnno[2]; /* declaration line number */ 195 char x_size[2]; /* str/union/array size */ 196 } x_lnsz; 197 198 char x_fsize[4]; /* size of function */ 199 200 } x_misc; 201 202 union 203 { 204 struct /* if ISFCN, tag, or .bb */ 205 { 206 char x_lnnoptr[4]; /* ptr to fcn line # */ 207 char x_endndx[4]; /* entry ndx past block end */ 208 } x_fcn; 209 210 struct /* if ISARY, up to 4 dimen. */ 211 { 212 char x_dimen[E_DIMNUM][2]; 213 } x_ary; 214 215 } x_fcnary; 216 217 char x_tvndx[2]; /* tv index */ 218 219 } x_sym; 220 221 union 222 { 223 char x_fname[E_FILNMLEN]; 224 225 struct 226 { 227 char x_zeroes[4]; 228 char x_offset[4]; 229 } x_n; 230 231 } x_file; 232 233 struct 234 { 235 char x_scnlen[4]; /* section length */ 236 char x_nreloc[2]; /* # relocation entries */ 237 char x_nlinno[2]; /* # line numbers */ 238 239 } x_scn; 240 241 struct 242 { 243 char x_tvfill[4]; /* tv fill value */ 244 char x_tvlen[2]; /* length of .tv */ 245 char x_tvran[2][2]; /* tv range */ 246 247 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ 248 249 /****************************************** 250 * I960-specific *2nd* aux. entry formats 251 ******************************************/ 252 struct 253 { 254 /* This is a very old typo that keeps getting propagated. */ 255 #define x_stdindx x_stindx 256 char x_stindx[4]; /* sys. table entry */ 257 } x_sc; /* system call entry */ 258 259 struct 260 { 261 char x_balntry[4]; /* BAL entry point */ 262 } x_bal; /* BAL-callable function */ 263 264 struct 265 { 266 char x_timestamp[4]; /* time stamp */ 267 char x_idstring[20]; /* producer identity string */ 268 269 } x_ident; /* Producer ident info */ 270 }; 271 272 #define SYMENT struct external_syment 273 #define SYMESZ 24 274 #define AUXENT union external_auxent 275 #define AUXESZ 24 276 277 # define _ETEXT "_etext" 278 279 /********************** RELOCATION DIRECTIVES **********************/ 280 281 struct external_reloc 282 { 283 char r_vaddr[4]; 284 char r_symndx[4]; 285 char r_type[2]; 286 char pad[2]; 287 }; 288 289 /* r_type values for the i960. */ 290 291 /* The i960 uses R_RELLONG, which is defined in internal.h as 0x11. 292 It is an absolute 32 bit relocation. */ 293 294 #define R_IPRMED (0x19) /* 24-bit ip-relative relocation */ 295 #define R_OPTCALL (0x1b) /* 32-bit optimizable call (leafproc/sysproc) */ 296 #define R_OPTCALLX (0x1c) /* 64-bit optimizable call (leafproc/sysproc) */ 297 298 /* The following relocation types are defined use by relaxing linkers, 299 which convert 32 bit calls (which require a 64 bit instruction) 300 into 24 bit calls (which require a 32 bit instruction) when 301 possible. It will be possible whenever the target of the call is 302 within a 24 bit range of the call instruction. 303 304 It is always safe to ignore these relocations. They only serve to 305 mark points which the relaxing linker will have to consider. The 306 assembler must ensure that the correct code is generated even if 307 the relocations are ignored. In particular, this means that the 308 R_IPR13 relocation may not appear with an external symbol. */ 309 310 #define R_IPR13 (0x1d) /* 13 bit ip-relative branch */ 311 #define R_ALIGN (0x1e) /* alignment marker. This has no 312 associated symbol. Instead, the 313 r_symndx field indicates the 314 require alignment at this point in 315 the file. It must be a power of 2. */ 316 317 #define RELOC struct external_reloc 318 #define RELSZ 12 319 320