OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [branches/] [oc/] [gdb-5.0/] [include/] [coff/] [mips.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
/* ECOFF support on MIPS machines.
2
   coff/ecoff.h must be included before this file.  */
3
 
4
/********************** FILE HEADER **********************/
5
 
6
struct external_filehdr {
7
  unsigned char f_magic[2];     /* magic number                 */
8
  unsigned char f_nscns[2];     /* number of sections           */
9
  unsigned char f_timdat[4];    /* time & date stamp            */
10
  unsigned char f_symptr[4];    /* file pointer to symtab       */
11
  unsigned char f_nsyms[4];     /* number of symtab entries     */
12
  unsigned char f_opthdr[2];    /* sizeof(optional hdr)         */
13
  unsigned char f_flags[2];     /* flags                        */
14
};
15
 
16
/* Magic numbers are defined in coff/ecoff.h.  */
17
#define MIPS_ECOFF_BADMAG(x) (((x).f_magic!=MIPS_MAGIC_1) && \
18
                              ((x).f_magic!=MIPS_MAGIC_LITTLE) &&\
19
                              ((x).f_magic!=MIPS_MAGIC_BIG) && \
20
                              ((x).f_magic!=MIPS_MAGIC_LITTLE2) && \
21
                              ((x).f_magic!=MIPS_MAGIC_BIG2) && \
22
                              ((x).f_magic!=MIPS_MAGIC_LITTLE3) && \
23
                              ((x).f_magic!=MIPS_MAGIC_BIG3))
24
 
25
#define FILHDR  struct external_filehdr
26
#define FILHSZ  20
27
 
28
/********************** AOUT "OPTIONAL HEADER" **********************/
29
 
30
 
31
typedef struct external_aouthdr
32
{
33
  unsigned char magic[2];       /* type of file                         */
34
  unsigned char vstamp[2];      /* version stamp                        */
35
  unsigned char tsize[4];       /* text size in bytes, padded to FW bdry*/
36
  unsigned char dsize[4];       /* initialized data "  "                */
37
  unsigned char bsize[4];       /* uninitialized data "   "             */
38
  unsigned char entry[4];       /* entry pt.                            */
39
  unsigned char text_start[4];  /* base of text used for this file */
40
  unsigned char data_start[4];  /* base of data used for this file */
41
  unsigned char bss_start[4];   /* base of bss used for this file */
42
  unsigned char gprmask[4];     /* ?? */
43
  unsigned char cprmask[4][4];  /* ?? */
44
  unsigned char gp_value[4];    /* value for gp register */
45
} AOUTHDR;
46
 
47
/* compute size of a header */
48
 
49
#define AOUTSZ 56
50
#define AOUTHDRSZ 56
51
 
52
/********************** SECTION HEADER **********************/
53
 
54
struct external_scnhdr {
55
  unsigned char s_name[8];      /* section name                 */
56
  unsigned char s_paddr[4];     /* physical address, aliased s_nlib */
57
  unsigned char s_vaddr[4];     /* virtual address              */
58
  unsigned char s_size[4];      /* section size                 */
59
  unsigned char s_scnptr[4];    /* file ptr to raw data for section */
60
  unsigned char s_relptr[4];    /* file ptr to relocation       */
61
  unsigned char s_lnnoptr[4];   /* file ptr to line numbers     */
62
  unsigned char s_nreloc[2];    /* number of relocation entries */
63
  unsigned char s_nlnno[2];     /* number of line number entries*/
64
  unsigned char s_flags[4];     /* flags                        */
65
};
66
 
67
#define SCNHDR  struct external_scnhdr
68
#define SCNHSZ  40
69
 
70
/********************** RELOCATION DIRECTIVES **********************/
71
 
72
struct external_reloc {
73
  unsigned char r_vaddr[4];
74
  unsigned char r_bits[4];
75
};
76
 
77
#define RELOC struct external_reloc
78
#define RELSZ 8
79
 
80
/* MIPS ECOFF uses a packed 8 byte format for relocs.  These constants
81
   are used to unpack the r_bits field.  */
82
 
83
#define RELOC_BITS0_SYMNDX_SH_LEFT_BIG          16
84
#define RELOC_BITS0_SYMNDX_SH_LEFT_LITTLE       0
85
 
86
#define RELOC_BITS1_SYMNDX_SH_LEFT_BIG          8
87
#define RELOC_BITS1_SYMNDX_SH_LEFT_LITTLE       8
88
 
89
#define RELOC_BITS2_SYMNDX_SH_LEFT_BIG          0
90
#define RELOC_BITS2_SYMNDX_SH_LEFT_LITTLE       16
91
 
92
/* Originally, ECOFF used four bits for the reloc type and had three
93
   reserved bits.  Irix 4 added another bit for the reloc type, which
94
   was easy because it was big endian and one of the spare bits became
95
   the new most significant bit.  To make this also work for little
96
   endian ECOFF, we need to wrap one of the reserved bits around to
97
   become the most significant bit of the reloc type.  */
98
#define RELOC_BITS3_TYPE_BIG                    0x3E
99
#define RELOC_BITS3_TYPE_SH_BIG                 1
100
#define RELOC_BITS3_TYPE_LITTLE                 0x78
101
#define RELOC_BITS3_TYPE_SH_LITTLE              3
102
#define RELOC_BITS3_TYPEHI_LITTLE               0x04
103
#define RELOC_BITS3_TYPEHI_SH_LITTLE            2
104
 
105
#define RELOC_BITS3_EXTERN_BIG                  0x01
106
#define RELOC_BITS3_EXTERN_LITTLE               0x80
107
 
108
/* The r_type field in a reloc is one of the following values.  I
109
   don't know if any other values can appear.  These seem to be all
110
   that occur in the Ultrix 4.2 libraries.  */
111
#define MIPS_R_IGNORE   0
112
#define MIPS_R_REFHALF  1
113
#define MIPS_R_REFWORD  2
114
#define MIPS_R_JMPADDR  3
115
#define MIPS_R_REFHI    4
116
#define MIPS_R_REFLO    5
117
#define MIPS_R_GPREL    6
118
#define MIPS_R_LITERAL  7
119
 
120
/* These reloc types are a Cygnus extension used when generating
121
   position independent code for embedded systems.  The numbers are
122
   taken from Irix 4, but at least for internal relocs Irix 5 does not
123
   give them the same meaning.  For an internal reloc the symbol index
124
   of RELHI and RELLO is modified as described below for
125
   MIPS_R_SWITCH.  */
126
#define MIPS_R_PCREL16  12
127
#define MIPS_R_RELHI    13
128
#define MIPS_R_RELLO    14
129
 
130
/* This reloc type is a Cygnus extension used when generating position
131
   independent code for embedded systems.  It is used for an entry in
132
   a switch table, which looks like this:
133
     .word $L3-$LS12
134
   The object file will contain the correct difference, and does not
135
   require adjustment.  However, when the linker is relaxing PC
136
   relative calls, it is possible for $L3 to move farther away.  This
137
   reloc always appears in the .text section, and is always against
138
   the .text section.  However, the symbol index is not
139
   RELOC_SECTION_TEXT.  It is, instead, the distance between this
140
   switch table entry and $LS12.  Thus, the original value of $L12 is
141
     vaddr - symndx
142
   and the original value of $L3 is
143
     vaddr - symndx + addend
144
   where addend is the value in the object file.  Knowing this, the
145
   linker can know whether the addend in the object file must be
146
   adjusted.  */
147
#define MIPS_R_SWITCH   22
148
 
149
/********************** STABS **********************/
150
 
151
#define MIPS_IS_STAB ECOFF_IS_STAB
152
#define MIPS_MARK_STAB ECOFF_MARK_STAB
153
#define MIPS_UNMARK_STAB ECOFF_UNMARK_STAB
154
 
155
/********************** SYMBOLIC INFORMATION **********************/
156
 
157
/* Written by John Gilmore.  */
158
 
159
/* ECOFF uses COFF-like section structures, but its own symbol format.
160
   This file defines the symbol format in fields whose size and alignment
161
   will not vary on different host systems.  */
162
 
163
/* File header as a set of bytes */
164
 
165
struct hdr_ext {
166
        unsigned char   h_magic[2];
167
        unsigned char   h_vstamp[2];
168
        unsigned char   h_ilineMax[4];
169
        unsigned char   h_cbLine[4];
170
        unsigned char   h_cbLineOffset[4];
171
        unsigned char   h_idnMax[4];
172
        unsigned char   h_cbDnOffset[4];
173
        unsigned char   h_ipdMax[4];
174
        unsigned char   h_cbPdOffset[4];
175
        unsigned char   h_isymMax[4];
176
        unsigned char   h_cbSymOffset[4];
177
        unsigned char   h_ioptMax[4];
178
        unsigned char   h_cbOptOffset[4];
179
        unsigned char   h_iauxMax[4];
180
        unsigned char   h_cbAuxOffset[4];
181
        unsigned char   h_issMax[4];
182
        unsigned char   h_cbSsOffset[4];
183
        unsigned char   h_issExtMax[4];
184
        unsigned char   h_cbSsExtOffset[4];
185
        unsigned char   h_ifdMax[4];
186
        unsigned char   h_cbFdOffset[4];
187
        unsigned char   h_crfd[4];
188
        unsigned char   h_cbRfdOffset[4];
189
        unsigned char   h_iextMax[4];
190
        unsigned char   h_cbExtOffset[4];
191
};
192
 
193
/* File descriptor external record */
194
 
195
struct fdr_ext {
196
        unsigned char   f_adr[4];
197
        unsigned char   f_rss[4];
198
        unsigned char   f_issBase[4];
199
        unsigned char   f_cbSs[4];
200
        unsigned char   f_isymBase[4];
201
        unsigned char   f_csym[4];
202
        unsigned char   f_ilineBase[4];
203
        unsigned char   f_cline[4];
204
        unsigned char   f_ioptBase[4];
205
        unsigned char   f_copt[4];
206
        unsigned char   f_ipdFirst[2];
207
        unsigned char   f_cpd[2];
208
        unsigned char   f_iauxBase[4];
209
        unsigned char   f_caux[4];
210
        unsigned char   f_rfdBase[4];
211
        unsigned char   f_crfd[4];
212
        unsigned char   f_bits1[1];
213
        unsigned char   f_bits2[3];
214
        unsigned char   f_cbLineOffset[4];
215
        unsigned char   f_cbLine[4];
216
};
217
 
218
#define FDR_BITS1_LANG_BIG              0xF8
219
#define FDR_BITS1_LANG_SH_BIG           3
220
#define FDR_BITS1_LANG_LITTLE           0x1F
221
#define FDR_BITS1_LANG_SH_LITTLE        0
222
 
223
#define FDR_BITS1_FMERGE_BIG            0x04
224
#define FDR_BITS1_FMERGE_LITTLE         0x20
225
 
226
#define FDR_BITS1_FREADIN_BIG           0x02
227
#define FDR_BITS1_FREADIN_LITTLE        0x40
228
 
229
#define FDR_BITS1_FBIGENDIAN_BIG        0x01
230
#define FDR_BITS1_FBIGENDIAN_LITTLE     0x80
231
 
232
#define FDR_BITS2_GLEVEL_BIG            0xC0
233
#define FDR_BITS2_GLEVEL_SH_BIG         6
234
#define FDR_BITS2_GLEVEL_LITTLE         0x03
235
#define FDR_BITS2_GLEVEL_SH_LITTLE      0
236
 
237
/* We ignore the `reserved' field in bits2. */
238
 
239
/* Procedure descriptor external record */
240
 
241
struct pdr_ext {
242
        unsigned char   p_adr[4];
243
        unsigned char   p_isym[4];
244
        unsigned char   p_iline[4];
245
        unsigned char   p_regmask[4];
246
        unsigned char   p_regoffset[4];
247
        unsigned char   p_iopt[4];
248
        unsigned char   p_fregmask[4];
249
        unsigned char   p_fregoffset[4];
250
        unsigned char   p_frameoffset[4];
251
        unsigned char   p_framereg[2];
252
        unsigned char   p_pcreg[2];
253
        unsigned char   p_lnLow[4];
254
        unsigned char   p_lnHigh[4];
255
        unsigned char   p_cbLineOffset[4];
256
};
257
 
258
/* Runtime procedure table */
259
 
260
struct rpdr_ext {
261
        unsigned char   p_adr[4];
262
        unsigned char   p_regmask[4];
263
        unsigned char   p_regoffset[4];
264
        unsigned char   p_fregmask[4];
265
        unsigned char   p_fregoffset[4];
266
        unsigned char   p_frameoffset[4];
267
        unsigned char   p_framereg[2];
268
        unsigned char   p_pcreg[2];
269
        unsigned char   p_irpss[4];
270
        unsigned char   p_reserved[4];
271
        unsigned char   p_exception_info[4];
272
};
273
 
274
/* Line numbers */
275
 
276
struct line_ext {
277
        unsigned char   l_line[4];
278
};
279
 
280
/* Symbol external record */
281
 
282
struct sym_ext {
283
        unsigned char   s_iss[4];
284
        unsigned char   s_value[4];
285
        unsigned char   s_bits1[1];
286
        unsigned char   s_bits2[1];
287
        unsigned char   s_bits3[1];
288
        unsigned char   s_bits4[1];
289
};
290
 
291
#define SYM_BITS1_ST_BIG                0xFC
292
#define SYM_BITS1_ST_SH_BIG             2
293
#define SYM_BITS1_ST_LITTLE             0x3F
294
#define SYM_BITS1_ST_SH_LITTLE          0
295
 
296
#define SYM_BITS1_SC_BIG                0x03
297
#define SYM_BITS1_SC_SH_LEFT_BIG        3
298
#define SYM_BITS1_SC_LITTLE             0xC0
299
#define SYM_BITS1_SC_SH_LITTLE          6
300
 
301
#define SYM_BITS2_SC_BIG                0xE0
302
#define SYM_BITS2_SC_SH_BIG             5
303
#define SYM_BITS2_SC_LITTLE             0x07
304
#define SYM_BITS2_SC_SH_LEFT_LITTLE     2
305
 
306
#define SYM_BITS2_RESERVED_BIG          0x10
307
#define SYM_BITS2_RESERVED_LITTLE       0x08
308
 
309
#define SYM_BITS2_INDEX_BIG             0x0F
310
#define SYM_BITS2_INDEX_SH_LEFT_BIG     16
311
#define SYM_BITS2_INDEX_LITTLE          0xF0
312
#define SYM_BITS2_INDEX_SH_LITTLE       4
313
 
314
#define SYM_BITS3_INDEX_SH_LEFT_BIG     8
315
#define SYM_BITS3_INDEX_SH_LEFT_LITTLE  4
316
 
317
#define SYM_BITS4_INDEX_SH_LEFT_BIG     0
318
#define SYM_BITS4_INDEX_SH_LEFT_LITTLE  12
319
 
320
/* External symbol external record */
321
 
322
struct ext_ext {
323
        unsigned char   es_bits1[1];
324
        unsigned char   es_bits2[1];
325
        unsigned char   es_ifd[2];
326
        struct  sym_ext es_asym;
327
};
328
 
329
#define EXT_BITS1_JMPTBL_BIG            0x80
330
#define EXT_BITS1_JMPTBL_LITTLE         0x01
331
 
332
#define EXT_BITS1_COBOL_MAIN_BIG        0x40
333
#define EXT_BITS1_COBOL_MAIN_LITTLE     0x02
334
 
335
#define EXT_BITS1_WEAKEXT_BIG           0x20
336
#define EXT_BITS1_WEAKEXT_LITTLE        0x04
337
 
338
/* Dense numbers external record */
339
 
340
struct dnr_ext {
341
        unsigned char   d_rfd[4];
342
        unsigned char   d_index[4];
343
};
344
 
345
/* Relative file descriptor */
346
 
347
struct rfd_ext {
348
  unsigned char rfd[4];
349
};
350
 
351
/* Optimizer symbol external record */
352
 
353
struct opt_ext {
354
  unsigned char o_bits1[1];
355
  unsigned char o_bits2[1];
356
  unsigned char o_bits3[1];
357
  unsigned char o_bits4[1];
358
  struct rndx_ext o_rndx;
359
  unsigned char o_offset[4];
360
};
361
 
362
#define OPT_BITS2_VALUE_SH_LEFT_BIG     16
363
#define OPT_BITS2_VALUE_SH_LEFT_LITTLE  0
364
 
365
#define OPT_BITS3_VALUE_SH_LEFT_BIG     8
366
#define OPT_BITS3_VALUE_SH_LEFT_LITTLE  8
367
 
368
#define OPT_BITS4_VALUE_SH_LEFT_BIG     0
369
#define OPT_BITS4_VALUE_SH_LEFT_LITTLE  16

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.