1 /* coff information for 80960. Origins: Intel corp, natch.
3 Copyright (C) 2001-2018 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 3 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,
18 MA 02110-1301, USA. */
20 /* NOTE: Tagentries (cf TAGBITS) are no longer used by the 960 */
22 /********************** FILE HEADER **********************/
24 struct external_filehdr
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 */
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 */
40 * Intel 80960 (I960) processor flags.
41 * F_I960TYPE == mask for processor type field.
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)
57 /** i80960 Magic Numbers
60 #define I960ROMAGIC (0x160) /* read-only text segments */
61 #define I960RWMAGIC (0x161) /* read-write text segments */
63 #define I960BADMAG(x) (((x).f_magic!=I960ROMAGIC) && ((x).f_magic!=I960RWMAGIC))
65 #define FILHDR struct external_filehdr
68 /********************** AOUT "OPTIONAL HEADER" **********************/
72 unsigned long phys_addr;
73 unsigned long bitarray;
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 */
90 /* return a pointer to the tag bits array */
92 #define TAGPTR(aout) ((TAGBITS *) (&(aout.tagentries)+1))
94 /* compute size of a header */
96 /*#define AOUTSZ(aout) (sizeof(AOUTHDR)+(aout.tagentries*sizeof(TAGBITS)))*/
101 /********************** SECTION HEADER **********************/
103 struct external_scnhdr
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 */
119 #define SCNHDR struct external_scnhdr
123 * names of "special" sections
125 #define _TEXT ".text"
126 #define _DATA ".data"
129 /********************** LINE NUMBERS **********************/
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.
136 struct external_lineno
140 char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
141 char l_paddr[4]; /* (physical) address of line number */
144 char l_lnno[2]; /* line number */
145 char padding[2]; /* force alignment */
149 #define LINENO struct external_lineno
152 /********************** SYMBOLS **********************/
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 */
158 struct external_syment
162 char e_name[E_SYMNMLEN];
180 #define N_BTMASK (0x1f)
181 #define N_TMASK (0x60)
185 union external_auxent
189 char x_tagndx[4]; /* str, un, or enum tag indx */
195 char x_lnno[2]; /* declaration line number */
196 char x_size[2]; /* str/union/array size */
199 char x_fsize[4]; /* size of function */
205 struct /* if ISFCN, tag, or .bb */
207 char x_lnnoptr[4]; /* ptr to fcn line # */
208 char x_endndx[4]; /* entry ndx past block end */
211 struct /* if ISARY, up to 4 dimen. */
213 char x_dimen[E_DIMNUM][2];
218 char x_tvndx[2]; /* tv index */
224 char x_fname[E_FILNMLEN];
236 char x_scnlen[4]; /* section length */
237 char x_nreloc[2]; /* # relocation entries */
238 char x_nlinno[2]; /* # line numbers */
244 char x_tvfill[4]; /* tv fill value */
245 char x_tvlen[2]; /* length of .tv */
246 char x_tvran[2][2]; /* tv range */
248 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
250 /******************************************
251 * I960-specific *2nd* aux. entry formats
252 ******************************************/
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 */
262 char x_balntry[4]; /* BAL entry point */
263 } x_bal; /* BAL-callable function */
267 char x_timestamp[4]; /* time stamp */
268 char x_idstring[20]; /* producer identity string */
270 } x_ident; /* Producer ident info */
273 #define SYMENT struct external_syment
275 #define AUXENT union external_auxent
278 # define _ETEXT "_etext"
280 /********************** RELOCATION DIRECTIVES **********************/
282 struct external_reloc
290 /* r_type values for the i960. */
292 /* The i960 uses R_RELLONG, which is defined in internal.h as 0x11.
293 It is an absolute 32 bit relocation. */
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) */
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.
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. */
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. */
318 #define RELOC struct external_reloc