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