* config.sub, config.guess: Update from upstream sources.
[binutils.git] / include / coff / i960.h
blobb5ff6a5f89de58332e122f6cb038dec9b3dddc54
1 /* coff information for 80960. Origins: Intel corp, natch.
3 Copyright 2001 Free Software Foundation, Inc.
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.
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.
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, MA 02110-1301, USA. */
19 /* NOTE: Tagentries (cf TAGBITS) are no longer used by the 960 */
21 /********************** FILE HEADER **********************/
23 struct external_filehdr
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 */
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 */
39 * Intel 80960 (I960) processor flags.
40 * F_I960TYPE == mask for processor type field.
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)
56 /** i80960 Magic Numbers
59 #define I960ROMAGIC (0x160) /* read-only text segments */
60 #define I960RWMAGIC (0x161) /* read-write text segments */
62 #define I960BADMAG(x) (((x).f_magic!=I960ROMAGIC) && ((x).f_magic!=I960RWMAGIC))
64 #define FILHDR struct external_filehdr
65 #define FILHSZ 20
67 /********************** AOUT "OPTIONAL HEADER" **********************/
69 typedef struct
71 unsigned long phys_addr;
72 unsigned long bitarray;
73 } TAGBITS;
75 typedef struct
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 */
87 AOUTHDR;
89 /* return a pointer to the tag bits array */
91 #define TAGPTR(aout) ((TAGBITS *) (&(aout.tagentries)+1))
93 /* compute size of a header */
95 /*#define AOUTSZ(aout) (sizeof(AOUTHDR)+(aout.tagentries*sizeof(TAGBITS)))*/
96 #define AOUTSZ 32
97 #define AOUTHDRSZ 32
100 /********************** SECTION HEADER **********************/
102 struct external_scnhdr
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 */
118 #define SCNHDR struct external_scnhdr
119 #define SCNHSZ 44
122 * names of "special" sections
124 #define _TEXT ".text"
125 #define _DATA ".data"
126 #define _BSS ".bss"
128 /********************** LINE NUMBERS **********************/
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.
135 struct external_lineno
137 union
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;
143 char l_lnno[2]; /* line number */
144 char padding[2]; /* force alignment */
148 #define LINENO struct external_lineno
149 #define LINESZ 8
151 /********************** SYMBOLS **********************/
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 */
157 struct external_syment
159 union
161 char e_name[E_SYMNMLEN];
163 struct
165 char e_zeroes[4];
166 char e_offset[4];
167 } e;
168 } e;
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];
179 #define N_BTMASK (0x1f)
180 #define N_TMASK (0x60)
181 #define N_BTSHFT (5)
182 #define N_TSHIFT (2)
184 union external_auxent
186 struct
188 char x_tagndx[4]; /* str, un, or enum tag indx */
190 union
192 struct
194 char x_lnno[2]; /* declaration line number */
195 char x_size[2]; /* str/union/array size */
196 } x_lnsz;
198 char x_fsize[4]; /* size of function */
200 } x_misc;
202 union
204 struct /* if ISFCN, tag, or .bb */
206 char x_lnnoptr[4]; /* ptr to fcn line # */
207 char x_endndx[4]; /* entry ndx past block end */
208 } x_fcn;
210 struct /* if ISARY, up to 4 dimen. */
212 char x_dimen[E_DIMNUM][2];
213 } x_ary;
215 } x_fcnary;
217 char x_tvndx[2]; /* tv index */
219 } x_sym;
221 union
223 char x_fname[E_FILNMLEN];
225 struct
227 char x_zeroes[4];
228 char x_offset[4];
229 } x_n;
231 } x_file;
233 struct
235 char x_scnlen[4]; /* section length */
236 char x_nreloc[2]; /* # relocation entries */
237 char x_nlinno[2]; /* # line numbers */
239 } x_scn;
241 struct
243 char x_tvfill[4]; /* tv fill value */
244 char x_tvlen[2]; /* length of .tv */
245 char x_tvran[2][2]; /* tv range */
247 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
249 /******************************************
250 * I960-specific *2nd* aux. entry formats
251 ******************************************/
252 struct
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 */
259 struct
261 char x_balntry[4]; /* BAL entry point */
262 } x_bal; /* BAL-callable function */
264 struct
266 char x_timestamp[4]; /* time stamp */
267 char x_idstring[20]; /* producer identity string */
269 } x_ident; /* Producer ident info */
272 #define SYMENT struct external_syment
273 #define SYMESZ 24
274 #define AUXENT union external_auxent
275 #define AUXESZ 24
277 # define _ETEXT "_etext"
279 /********************** RELOCATION DIRECTIVES **********************/
281 struct external_reloc
283 char r_vaddr[4];
284 char r_symndx[4];
285 char r_type[2];
286 char pad[2];
289 /* r_type values for the i960. */
291 /* The i960 uses R_RELLONG, which is defined in internal.h as 0x11.
292 It is an absolute 32 bit relocation. */
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) */
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.
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. */
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. */
317 #define RELOC struct external_reloc
318 #define RELSZ 12