* a29k.h: Define _LIT.
[deliverable/binutils-gdb.git] / include / coff / a29k.h
1 /* COFF spec for AMD 290*0
2 Contributed by David Wood @ New York University.
3 */
4
5 #ifndef AMD
6 # define AMD
7 #endif
8
9 /****************************************************************/
10
11 /*
12 ** File Header and related definitions
13 */
14
15 struct external_filehdr
16 {
17 char f_magic[2]; /* magic number */
18 char f_nscns[2]; /* number of sections */
19 char f_timdat[4]; /* time & date stamp */
20 char f_symptr[4]; /* file pointer to symtab */
21 char f_nsyms[4]; /* number of symtab entries */
22 char f_opthdr[2]; /* sizeof(optional hdr) */
23 char f_flags[2]; /* flags */
24 };
25
26 #define FILHDR struct external_filehdr
27 #define FILHSZ sizeof (FILHDR)
28
29 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
30
31 /*
32 ** Magic numbers for Am29000
33 ** (AT&T will assign the "real" magic number)
34 */
35
36 #define SIPFBOMAGIC 0572 /* Am29000 (Byte 0 is MSB) */
37 #define SIPRBOMAGIC 0573 /* Am29000 (Byte 0 is LSB) */
38
39
40 #define A29K_MAGIC_BIG SIPFBOMAGIC
41 #define A29K_MAGIC_LITTLE SIPRBOMAGIC
42 #define A29KBADMAG(x) (((x).f_magic!=A29K_MAGIC_BIG) && \
43 ((x).f_magic!=A29K_MAGIC_LITTLE))
44
45 #define OMAGIC A29K_MAGIC_BIG
46 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
47
48 /*
49 ** File header flags currently known to us.
50 **
51 ** Am29000 will use the F_AR32WR and F_AR32W flags to indicate
52 ** the byte ordering in the file.
53 */
54
55 /*--------------------------------------------------------------*/
56
57 /*
58 ** Optional (a.out) header
59 */
60
61 typedef struct external_aouthdr
62 {
63 char magic[2]; /* type of file */
64 char vstamp[2]; /* version stamp */
65 char tsize[4]; /* text size in bytes, padded to FW bdry*/
66 char dsize[4]; /* initialized data " " */
67 char bsize[4]; /* uninitialized data " " */
68 char entry[4]; /* entry pt. */
69 char text_start[4]; /* base of text used for this file */
70 char data_start[4]; /* base of data used for this file */
71 } AOUTHDR;
72
73 #define AOUTSZ (sizeof(AOUTHDR))
74 #define AOUTHDRSZ (sizeof(AOUTHDR))
75
76 /* aouthdr magic numbers */
77 #define NMAGIC 0410 /* separate i/d executable */
78 #define SHMAGIC 0406 /* NYU/Ultra3 shared data executable
79 (writable text) */
80
81 #define _ETEXT "_etext"
82
83 /*--------------------------------------------------------------*/
84
85 /*
86 ** Section header and related definitions
87 */
88
89 struct external_scnhdr
90 {
91 char s_name[8]; /* section name */
92 char s_paddr[4]; /* physical address, aliased s_nlib */
93 char s_vaddr[4]; /* virtual address */
94 char s_size[4]; /* section size */
95 char s_scnptr[4]; /* file ptr to raw data for section */
96 char s_relptr[4]; /* file ptr to relocation */
97 char s_lnnoptr[4]; /* file ptr to line numbers */
98 char s_nreloc[2]; /* number of relocation entries */
99 char s_nlnno[2]; /* number of line number entries*/
100 char s_flags[4]; /* flags */
101 };
102
103 #define SCNHDR struct external_scnhdr
104 #define SCNHSZ sizeof (SCNHDR)
105
106 /*
107 * names of "special" sections
108 */
109 #define _TEXT ".text"
110 #define _DATA ".data"
111 #define _BSS ".bss"
112 #define _LIT ".lit"
113
114 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
115
116 /*
117 ** Section types - with additional section type for global
118 ** registers which will be relocatable for the Am29000.
119 **
120 ** In instances where it is necessary for a linker to produce an
121 ** output file which contains text or data not based at virtual
122 ** address 0, e.g. for a ROM, then the linker should accept
123 ** address base information as command input and use PAD sections
124 ** to skip over unused addresses.
125 */
126
127 #define STYP_BSSREG 0x1200 /* Global register area (like STYP_INFO) */
128 #define STYP_ENVIR 0x2200 /* Environment (like STYP_INFO) */
129 #define STYP_ABS 0x4000 /* Absolute (allocated, not reloc, loaded) */
130
131 /*--------------------------------------------------------------*/
132
133 /*
134 ** Relocation information declaration and related definitions
135 */
136
137 struct external_reloc {
138 char r_vaddr[4]; /* (virtual) address of reference */
139 char r_symndx[4]; /* index into symbol table */
140 char r_type[2]; /* relocation type */
141 };
142
143 #define RELOC struct external_reloc
144 #define RELSZ 10 /* sizeof (RELOC) */
145
146 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
147
148 /*
149 ** Relocation types for the Am29000
150 */
151
152 #define R_ABS 0 /* reference is absolute */
153
154 #define R_IREL 030 /* instruction relative (jmp/call) */
155 #define R_IABS 031 /* instruction absolute (jmp/call) */
156 #define R_ILOHALF 032 /* instruction low half (const) */
157 #define R_IHIHALF 033 /* instruction high half (consth) part 1 */
158 #define R_IHCONST 034 /* instruction high half (consth) part 2 */
159 /* constant offset of R_IHIHALF relocation */
160 #define R_BYTE 035 /* relocatable byte value */
161 #define R_HWORD 036 /* relocatable halfword value */
162 #define R_WORD 037 /* relocatable word value */
163
164 #define R_IGLBLRC 040 /* instruction global register RC */
165 #define R_IGLBLRA 041 /* instruction global register RA */
166 #define R_IGLBLRB 042 /* instruction global register RB */
167
168 /*
169 NOTE:
170 All the "I" forms refer to 29000 instruction formats. The linker is
171 expected to know how the numeric information is split and/or aligned
172 within the instruction word(s). R_BYTE works for instructions, too.
173
174 If the parameter to a CONSTH instruction is a relocatable type, two
175 relocation records are written. The first has an r_type of R_IHIHALF
176 (33 octal) and a normal r_vaddr and r_symndx. The second relocation
177 record has an r_type of R_IHCONST (34 octal), a normal r_vaddr (which
178 is redundant), and an r_symndx containing the 32-bit constant offset
179 to the relocation instead of the actual symbol table index. This
180 second record is always written, even if the constant offset is zero.
181 The constant fields of the instruction are set to zero.
182 */
183
184 /*--------------------------------------------------------------*/
185
186 /*
187 ** Line number entry declaration and related definitions
188 */
189
190 struct external_lineno
191 {
192 union {
193 char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
194 char l_paddr[4]; /* (physical) address of line number */
195 } l_addr;
196 char l_lnno[2]; /* line number */
197 };
198
199 #define LINENO struct external_lineno
200 #define LINESZ 6 /* sizeof (LINENO) */
201
202 /*--------------------------------------------------------------*/
203
204 /*
205 ** Symbol entry declaration and related definitions
206 */
207
208 #define E_SYMNMLEN 8 /* Number of characters in a symbol name */
209
210 struct external_syment
211 {
212 union {
213 char e_name[E_SYMNMLEN];
214 struct {
215 char e_zeroes[4];
216 char e_offset[4];
217 } e;
218 } e;
219 char e_value[4];
220 char e_scnum[2];
221 char e_type[2];
222 char e_sclass[1];
223 char e_numaux[1];
224 };
225
226 #define SYMENT struct external_syment
227 #define SYMESZ sizeof(SYMENT)
228
229 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
230
231 /*
232 ** Storage class definitions - new classes for global registers.
233 */
234
235 #define C_GLBLREG 19 /* global register */
236 #define C_EXTREG 20 /* external global register */
237 #define C_DEFREG 21 /* ext. def. of global register */
238
239
240 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
241
242 /*
243 ** Derived symbol mask/shifts.
244 */
245
246 #define N_BTMASK (0xf)
247 #define N_BTSHFT (4)
248 #define N_TMASK (0x30)
249 #define N_TSHIFT (2)
250
251 /*--------------------------------------------------------------*/
252
253 /*
254 ** Auxiliary symbol table entry declaration and related
255 ** definitions.
256 */
257
258 #define E_FILNMLEN 14 /* # characters in a file name */
259 #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
260
261 union external_auxent {
262 struct {
263 char x_tagndx[4]; /* str, un, or enum tag indx */
264 union {
265 struct {
266 char x_lnno[2]; /* declaration line number */
267 char x_size[2]; /* str/union/array size */
268 } x_lnsz;
269 char x_fsize[4]; /* size of function */
270 } x_misc;
271 union {
272 struct { /* if ISFCN, tag, or .bb */
273 char x_lnnoptr[4]; /* ptr to fcn line # */
274 char x_endndx[4]; /* entry ndx past block end */
275 } x_fcn;
276 struct { /* if ISARY, up to 4 dimen. */
277 char x_dimen[E_DIMNUM][2];
278 } x_ary;
279 } x_fcnary;
280 char x_tvndx[2]; /* tv index */
281 } x_sym;
282
283 union {
284 char x_fname[E_FILNMLEN];
285 struct {
286 char x_zeroes[4];
287 char x_offset[4];
288 } x_n;
289 } x_file;
290
291 struct {
292 char x_scnlen[4]; /* section length */
293 char x_nreloc[2]; /* # relocation entries */
294 char x_nlinno[2]; /* # line numbers */
295 } x_scn;
296
297 struct {
298 char x_tvfill[4]; /* tv fill value */
299 char x_tvlen[2]; /* length of .tv */
300 char x_tvran[2][2]; /* tv range */
301 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
302 };
303
304 #define AUXENT union external_auxent
305 #define AUXESZ 18
This page took 0.043962 seconds and 5 git commands to generate.