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