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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [include/] [coff/] [ecoff.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
#ifndef ECOFF_H
2
#define ECOFF_H
3
 
4
/* Generic ECOFF support.
5
   This does not include symbol information, found in sym.h and
6
   symconst.h.  */
7
 
8
/* Mips magic numbers used in filehdr.  MIPS_MAGIC_LITTLE is used on
9
   little endian machines.  MIPS_MAGIC_BIG is used on big endian
10
   machines.  Where is MIPS_MAGIC_1 from?  */
11
#define MIPS_MAGIC_1 0x0180
12
#define MIPS_MAGIC_LITTLE 0x0162
13
#define MIPS_MAGIC_BIG 0x0160
14
 
15
/* These are the magic numbers used for MIPS code compiled at ISA
16
   level 2.  */
17
#define MIPS_MAGIC_LITTLE2 0x0166
18
#define MIPS_MAGIC_BIG2 0x0163
19
 
20
/* These are the magic numbers used for MIPS code compiled at ISA
21
   level 3.  */
22
#define MIPS_MAGIC_LITTLE3 0x142
23
#define MIPS_MAGIC_BIG3 0x140
24
 
25
/* Alpha magic numbers used in filehdr.  */
26
#define ALPHA_MAGIC 0x183
27
#define ALPHA_MAGIC_BSD 0x185
28
 
29
/* Magic numbers used in a.out header.  */
30
#define ECOFF_AOUT_OMAGIC 0407  /* not demand paged (ld -N).  */
31
#define ECOFF_AOUT_ZMAGIC 0413  /* demand load format, eg normal ld output */
32
 
33
/* Names of special sections.  */
34
#define _TEXT   ".text"
35
#define _DATA   ".data"
36
#define _BSS    ".bss"
37
#define _RDATA  ".rdata"
38
#define _SDATA  ".sdata"
39
#define _SBSS   ".sbss"
40
#define _LITA   ".lita"
41
#define _LIT4   ".lit4"
42
#define _LIT8   ".lit8"
43
#define _LIB    ".lib"
44
#define _INIT   ".init"
45
#define _FINI   ".fini"
46
#define _PDATA  ".pdata"
47
#define _XDATA  ".xdata"
48
#define _GOT    ".got"
49
#define _HASH   ".hash"
50
#define _DYNSYM ".dynsym"
51
#define _DYNSTR ".dynstr"
52
#define _RELDYN ".rel.dyn"
53
#define _CONFLIC ".conflic"
54
#define _COMMENT ".comment"
55
#define _LIBLIST ".liblist"
56
#define _DYNAMIC ".dynamic"
57
#define _RCONST ".rconst"
58
 
59
/* ECOFF uses some additional section flags.  */
60
#define STYP_RDATA           0x100
61
#define STYP_SDATA           0x200
62
#define STYP_SBSS            0x400
63
#define STYP_GOT            0x1000
64
#define STYP_DYNAMIC        0x2000
65
#define STYP_DYNSYM         0x4000
66
#define STYP_RELDYN         0x8000
67
#define STYP_DYNSTR        0x10000
68
#define STYP_HASH          0x20000
69
#define STYP_LIBLIST       0x40000
70
#define STYP_CONFLIC      0x100000
71
#define STYP_ECOFF_FINI  0x1000000
72
#define STYP_EXTENDESC   0x2000000 /* 0x02FFF000 bits => scn type, rest clr */
73
#define STYP_LITA        0x4000000
74
#define STYP_LIT8        0x8000000
75
#define STYP_LIT4       0x10000000
76
#define STYP_ECOFF_LIB  0x40000000
77
#define STYP_ECOFF_INIT 0x80000000
78
#define STYP_OTHER_LOAD (STYP_ECOFF_INIT | STYP_ECOFF_FINI)
79
 
80
/* extended section types */
81
#define STYP_COMMENT     0x2100000
82
#define STYP_RCONST      0x2200000
83
#define STYP_XDATA       0x2400000
84
#define STYP_PDATA       0x2800000
85
 
86
/* The linker needs a section to hold small common variables while
87
   linking.  There is no convenient way to create it when the linker
88
   needs it, so we always create one for each BFD.  We then avoid
89
   writing it out.  */
90
#define SCOMMON ".scommon"
91
 
92
/* If the extern bit in a reloc is 1, then r_symndx is an index into
93
   the external symbol table.  If the extern bit is 0, then r_symndx
94
   indicates a section, and is one of the following values.  */
95
#define RELOC_SECTION_NONE      0
96
#define RELOC_SECTION_TEXT      1
97
#define RELOC_SECTION_RDATA     2
98
#define RELOC_SECTION_DATA      3
99
#define RELOC_SECTION_SDATA     4
100
#define RELOC_SECTION_SBSS      5
101
#define RELOC_SECTION_BSS       6
102
#define RELOC_SECTION_INIT      7
103
#define RELOC_SECTION_LIT8      8
104
#define RELOC_SECTION_LIT4      9
105
#define RELOC_SECTION_XDATA    10
106
#define RELOC_SECTION_PDATA    11
107
#define RELOC_SECTION_FINI     12
108
#define RELOC_SECTION_LITA     13
109
#define RELOC_SECTION_ABS      14
110
#define RELOC_SECTION_RCONST   15
111
 
112
#define NUM_RELOC_SECTIONS     16
113
 
114
/********************** STABS **********************/
115
 
116
/* gcc uses mips-tfile to output type information in special stabs
117
   entries.  These must match the corresponding definition in
118
   gcc/config/mips.h.  At some point, these should probably go into a
119
   shared include file, but currently gcc and gdb do not share any
120
   directories. */
121
#define CODE_MASK 0x8F300
122
#define ECOFF_IS_STAB(sym) (((sym)->index & 0xFFF00) == CODE_MASK)
123
#define ECOFF_MARK_STAB(code) ((code)+CODE_MASK)
124
#define ECOFF_UNMARK_STAB(code) ((code)-CODE_MASK)
125
#define STABS_SYMBOL "@stabs"
126
 
127
/********************** COFF **********************/
128
 
129
/* gcc also uses mips-tfile to output COFF debugging information.
130
   These are the values it uses when outputting the .type directive.
131
   These should also be in a shared include file.  */
132
#define N_BTMASK        (017)
133
#define N_TMASK         (060)
134
#define N_BTSHFT        (4)
135
#define N_TSHIFT        (2)
136
 
137
/********************** AUX **********************/
138
 
139
/* The auxiliary type information is the same on all known ECOFF
140
   targets.  I can't see any reason that it would ever change, so I am
141
   going to gamble and define the external structures here, in the
142
   target independent ECOFF header file.  The internal forms are
143
   defined in coff/sym.h, which was originally donated by MIPS
144
   Computer Systems.  */
145
 
146
/* Type information external record */
147
 
148
struct tir_ext {
149
        unsigned char   t_bits1[1];
150
        unsigned char   t_tq45[1];
151
        unsigned char   t_tq01[1];
152
        unsigned char   t_tq23[1];
153
};
154
 
155
#define TIR_BITS1_FBITFIELD_BIG         ((unsigned int) 0x80)
156
#define TIR_BITS1_FBITFIELD_LITTLE      ((unsigned int) 0x01)
157
 
158
#define TIR_BITS1_CONTINUED_BIG         ((unsigned int) 0x40)
159
#define TIR_BITS1_CONTINUED_LITTLE      ((unsigned int) 0x02)
160
 
161
#define TIR_BITS1_BT_BIG                ((unsigned int) 0x3F)
162
#define TIR_BITS1_BT_SH_BIG             0
163
#define TIR_BITS1_BT_LITTLE             ((unsigned int) 0xFC)
164
#define TIR_BITS1_BT_SH_LITTLE          2
165
 
166
#define TIR_BITS_TQ4_BIG                ((unsigned int) 0xF0)
167
#define TIR_BITS_TQ4_SH_BIG             4
168
#define TIR_BITS_TQ5_BIG                ((unsigned int) 0x0F)
169
#define TIR_BITS_TQ5_SH_BIG             0
170
#define TIR_BITS_TQ4_LITTLE             ((unsigned int) 0x0F)
171
#define TIR_BITS_TQ4_SH_LITTLE          0
172
#define TIR_BITS_TQ5_LITTLE             ((unsigned int) 0xF0)
173
#define TIR_BITS_TQ5_SH_LITTLE          4
174
 
175
#define TIR_BITS_TQ0_BIG                ((unsigned int) 0xF0)
176
#define TIR_BITS_TQ0_SH_BIG             4
177
#define TIR_BITS_TQ1_BIG                ((unsigned int) 0x0F)
178
#define TIR_BITS_TQ1_SH_BIG             0
179
#define TIR_BITS_TQ0_LITTLE             ((unsigned int) 0x0F)
180
#define TIR_BITS_TQ0_SH_LITTLE          0
181
#define TIR_BITS_TQ1_LITTLE             ((unsigned int) 0xF0)
182
#define TIR_BITS_TQ1_SH_LITTLE          4
183
 
184
#define TIR_BITS_TQ2_BIG                ((unsigned int) 0xF0)
185
#define TIR_BITS_TQ2_SH_BIG             4
186
#define TIR_BITS_TQ3_BIG                ((unsigned int) 0x0F)
187
#define TIR_BITS_TQ3_SH_BIG             0
188
#define TIR_BITS_TQ2_LITTLE             ((unsigned int) 0x0F)
189
#define TIR_BITS_TQ2_SH_LITTLE          0
190
#define TIR_BITS_TQ3_LITTLE             ((unsigned int) 0xF0)
191
#define TIR_BITS_TQ3_SH_LITTLE          4
192
 
193
/* Relative symbol external record */
194
 
195
struct rndx_ext {
196
        unsigned char   r_bits[4];
197
};
198
 
199
#define RNDX_BITS0_RFD_SH_LEFT_BIG      4
200
#define RNDX_BITS1_RFD_BIG              ((unsigned int) 0xF0)
201
#define RNDX_BITS1_RFD_SH_BIG           4
202
 
203
#define RNDX_BITS0_RFD_SH_LEFT_LITTLE   0
204
#define RNDX_BITS1_RFD_LITTLE           ((unsigned int) 0x0F)
205
#define RNDX_BITS1_RFD_SH_LEFT_LITTLE   8
206
 
207
#define RNDX_BITS1_INDEX_BIG            ((unsigned int) 0x0F)
208
#define RNDX_BITS1_INDEX_SH_LEFT_BIG    16
209
#define RNDX_BITS2_INDEX_SH_LEFT_BIG    8
210
#define RNDX_BITS3_INDEX_SH_LEFT_BIG    0
211
 
212
#define RNDX_BITS1_INDEX_LITTLE         ((unsigned int) 0xF0)
213
#define RNDX_BITS1_INDEX_SH_LITTLE      4
214
#define RNDX_BITS2_INDEX_SH_LEFT_LITTLE 4
215
#define RNDX_BITS3_INDEX_SH_LEFT_LITTLE 12
216
 
217
/* Auxiliary symbol information external record */
218
 
219
union aux_ext {
220
        struct tir_ext  a_ti;
221
        struct rndx_ext a_rndx;
222
        unsigned char   a_dnLow[4];
223
        unsigned char   a_dnHigh[4];
224
        unsigned char   a_isym[4];
225
        unsigned char   a_iss[4];
226
        unsigned char   a_width[4];
227
        unsigned char   a_count[4];
228
};
229
 
230
#define AUX_GET_ANY(bigend, ax, field) \
231
  ((bigend) ? bfd_getb32 ((ax)->field) : bfd_getl32 ((ax)->field))
232
 
233
#define AUX_GET_DNLOW(bigend, ax)       AUX_GET_ANY ((bigend), (ax), a_dnLow)
234
#define AUX_GET_DNHIGH(bigend, ax)      AUX_GET_ANY ((bigend), (ax), a_dnHigh)
235
#define AUX_GET_ISYM(bigend, ax)        AUX_GET_ANY ((bigend), (ax), a_isym)
236
#define AUX_GET_ISS(bigend, ax)         AUX_GET_ANY ((bigend), (ax), a_iss)
237
#define AUX_GET_WIDTH(bigend, ax)       AUX_GET_ANY ((bigend), (ax), a_width)
238
#define AUX_GET_COUNT(bigend, ax)       AUX_GET_ANY ((bigend), (ax), a_count)
239
 
240
#define AUX_PUT_ANY(bigend, val, ax, field) \
241
  ((bigend) \
242
   ? (bfd_putb32 ((bfd_vma) (val), (ax)->field), 0) \
243
   : (bfd_putl32 ((bfd_vma) (val), (ax)->field), 0))
244
 
245
#define AUX_PUT_DNLOW(bigend, val, ax) \
246
  AUX_PUT_ANY ((bigend), (val), (ax), a_dnLow)
247
#define AUX_PUT_DNHIGH(bigend, val, ax) \
248
  AUX_PUT_ANY ((bigend), (val), (ax), a_dnHigh)
249
#define AUX_PUT_ISYM(bigend, val, ax) \
250
  AUX_PUT_ANY ((bigend), (val), (ax), a_isym)
251
#define AUX_PUT_ISS(bigend, val, ax) \
252
  AUX_PUT_ANY ((bigend), (val), (ax), a_iss)
253
#define AUX_PUT_WIDTH(bigend, val, ax) \
254
  AUX_PUT_ANY ((bigend), (val), (ax), a_width)
255
#define AUX_PUT_COUNT(bigend, val, ax) \
256
  AUX_PUT_ANY ((bigend), (val), (ax), a_count)
257
 
258
/********************** SYMBOLS **********************/
259
 
260
/* For efficiency, gdb deals directly with the unswapped symbolic
261
   information (that way it only takes the time to swap information
262
   that it really needs to read).  gdb originally retrieved the
263
   information directly from the BFD backend information, but that
264
   strategy, besides being sort of ugly, does not work for MIPS ELF,
265
   which also uses ECOFF debugging information.  This structure holds
266
   pointers to the (mostly) unswapped symbolic information.  */
267
 
268
struct ecoff_debug_info
269
{
270
  /* The swapped ECOFF symbolic header.  */
271
  HDRR symbolic_header;
272
 
273
  /* Pointers to the unswapped symbolic information.  Note that the
274
     pointers to external structures point to different sorts of
275
     information on different ECOFF targets.  The ecoff_debug_swap
276
     structure provides the sizes of the structures and the functions
277
     needed to swap the information in and out.  These pointers are
278
     all pointers to arrays, not single structures.  They will be NULL
279
     if there are no instances of the relevant structure.  These
280
     fields are also used by the assembler to output ECOFF debugging
281
     information.  */
282
  unsigned char *line;
283
  PTR external_dnr;     /* struct dnr_ext */
284
  PTR external_pdr;     /* struct pdr_ext */
285
  PTR external_sym;     /* struct sym_ext */
286
  PTR external_opt;     /* struct opt_ext */
287
  union aux_ext *external_aux;
288
  char *ss;
289
  char *ssext;
290
  PTR external_fdr;     /* struct fdr_ext */
291
  PTR external_rfd;     /* struct rfd_ext */
292
  PTR external_ext;     /* struct ext_ext */
293
 
294
  /* These fields are used when linking.  They may disappear at some
295
     point.  */
296
  char *ssext_end;
297
  PTR external_ext_end;
298
 
299
  /* When linking, this field holds a mapping from the input FDR
300
     numbers to the output numbers, and is used when writing out the
301
     external symbols.  It is NULL if no mapping is required.  */
302
  RFDT *ifdmap;
303
 
304
  /* The swapped FDR information.  Currently this is never NULL, but
305
     code using this structure should probably double-check in case
306
     this changes in the future.  This is a pointer to an array, not a
307
     single structure.  */
308
  FDR *fdr;
309
 
310
  /* When relaxing MIPS embedded PIC code, we may need to adjust
311
     symbol values when they are output.  This is a linked list of
312
     structures indicating how values should be adjusted.  There is no
313
     requirement that the entries be in any order, or that they not
314
     overlap.  This field is normally NULL, in which case no
315
     adjustments need to be made.  */
316
  struct ecoff_value_adjust *adjust;
317
};
318
 
319
/* This structure describes how to adjust symbol values when
320
   outputting MIPS embedded PIC code.  These adjustments only apply to
321
   the internal symbols, as the external symbol values will come from
322
   the hash table and have already been adjusted.  */
323
 
324
struct ecoff_value_adjust
325
{
326
  /* Next entry on adjustment list.  */
327
  struct ecoff_value_adjust *next;
328
  /* Starting VMA of adjustment.  This is the VMA in the ECOFF file,
329
     not the offset from the start of the section.  Thus it should
330
     indicate a particular section.  */
331
  bfd_vma start;
332
  /* Ending VMA of adjustment.  */
333
  bfd_vma end;
334
  /* Adjustment.  This should be added to the value of the symbol, or
335
     FDR.  This is zero for the last entry in the array.  */
336
  long adjust;
337
};
338
 
339
/* These structures are used by the ECOFF find_nearest_line function.  */
340
 
341
struct ecoff_fdrtab_entry
342
{
343
  /* Base address in .text of this FDR.  */
344
  bfd_vma base_addr;
345
  FDR *fdr;
346
};
347
 
348
struct ecoff_find_line
349
{
350
  /* Allocated memory to hold function and file names.  */
351
  char *find_buffer;
352
 
353
  /* FDR table, sorted by address: */
354
  long fdrtab_len;
355
  struct ecoff_fdrtab_entry *fdrtab;
356
 
357
  /* Cache entry for most recently found line information.  The sect
358
     field is NULL if this cache does not contain valid information.  */
359
  struct
360
    {
361
      asection *sect;
362
      bfd_vma start;
363
      bfd_vma stop;
364
      const char *filename;
365
      const char *functionname;
366
      unsigned int line_num;
367
    } cache;
368
};
369
 
370
/********************** SWAPPING **********************/
371
 
372
/* The generic ECOFF code needs to be able to swap debugging
373
   information in and out in the specific format used by a particular
374
   ECOFF implementation.  This structure provides the information
375
   needed to do this.  */
376
 
377
struct ecoff_debug_swap
378
{
379
  /* Symbol table magic number.  */
380
  int sym_magic;
381
  /* Alignment of debugging information.  E.g., 4.  */
382
  bfd_size_type debug_align;
383
  /* Sizes of external symbolic information.  */
384
  bfd_size_type external_hdr_size;
385
  bfd_size_type external_dnr_size;
386
  bfd_size_type external_pdr_size;
387
  bfd_size_type external_sym_size;
388
  bfd_size_type external_opt_size;
389
  bfd_size_type external_fdr_size;
390
  bfd_size_type external_rfd_size;
391
  bfd_size_type external_ext_size;
392
  /* Functions to swap in external symbolic data.  */
393
  void (*swap_hdr_in) PARAMS ((bfd *, PTR, HDRR *));
394
  void (*swap_dnr_in) PARAMS ((bfd *, PTR, DNR *));
395
  void (*swap_pdr_in) PARAMS ((bfd *, PTR, PDR *));
396
  void (*swap_sym_in) PARAMS ((bfd *, PTR, SYMR *));
397
  void (*swap_opt_in) PARAMS ((bfd *, PTR, OPTR *));
398
  void (*swap_fdr_in) PARAMS ((bfd *, PTR, FDR *));
399
  void (*swap_rfd_in) PARAMS ((bfd *, PTR, RFDT *));
400
  void (*swap_ext_in) PARAMS ((bfd *, PTR, EXTR *));
401
  void (*swap_tir_in) PARAMS ((int, const struct tir_ext *, TIR *));
402
  void (*swap_rndx_in) PARAMS ((int, const struct rndx_ext *, RNDXR *));
403
  /* Functions to swap out external symbolic data.  */
404
  void (*swap_hdr_out) PARAMS ((bfd *, const HDRR *, PTR));
405
  void (*swap_dnr_out) PARAMS ((bfd *, const DNR *, PTR));
406
  void (*swap_pdr_out) PARAMS ((bfd *, const PDR *, PTR));
407
  void (*swap_sym_out) PARAMS ((bfd *, const SYMR *, PTR));
408
  void (*swap_opt_out) PARAMS ((bfd *, const OPTR *, PTR));
409
  void (*swap_fdr_out) PARAMS ((bfd *, const FDR *, PTR));
410
  void (*swap_rfd_out) PARAMS ((bfd *, const RFDT *, PTR));
411
  void (*swap_ext_out) PARAMS ((bfd *, const EXTR *, PTR));
412
  void (*swap_tir_out) PARAMS ((int, const TIR *, struct tir_ext *));
413
  void (*swap_rndx_out) PARAMS ((int, const RNDXR *, struct rndx_ext *));
414
  /* Function to read symbol data and set up pointers in
415
     ecoff_debug_info structure.  The section argument is used for
416
     ELF, not straight ECOFF.  */
417
  boolean (*read_debug_info) PARAMS ((bfd *, asection *,
418
                                      struct ecoff_debug_info *));
419
};
420
 
421
#endif /* ! defined (ECOFF_H) */

powered by: WebSVN 2.1.0

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