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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
/* `a.out.adobe' differences from standard a.out files */
2
 
3
#ifndef __A_OUT_ADOBE_H__
4
#define __A_OUT_ADOBE_H__
5
 
6
#define BYTES_IN_WORD   4
7
 
8
/* Struct external_exec is the same.  */
9
 
10
/* This is the layout on disk of the 32-bit or 64-bit exec header. */
11
 
12
struct external_exec
13
{
14
  bfd_byte e_info[4];           /* magic number and stuff               */
15
  bfd_byte e_text[BYTES_IN_WORD]; /* length of text section in bytes    */
16
  bfd_byte e_data[BYTES_IN_WORD]; /* length of data section in bytes    */
17
  bfd_byte e_bss[BYTES_IN_WORD]; /* length of bss area in bytes                 */
18
  bfd_byte e_syms[BYTES_IN_WORD]; /* length of symbol table in bytes    */
19
  bfd_byte e_entry[BYTES_IN_WORD]; /* start address                     */
20
  bfd_byte e_trsize[BYTES_IN_WORD]; /* length of text relocation info   */
21
  bfd_byte e_drsize[BYTES_IN_WORD]; /* length of data relocation info   */
22
};
23
 
24
#define EXEC_BYTES_SIZE (4 + BYTES_IN_WORD * 7)
25
 
26
/* Magic numbers for a.out files */
27
 
28
#undef  ZMAGIC
29
#define ZMAGIC  0xAD0BE         /* Cute, eh?  */
30
#undef  OMAGIC
31
#undef  NMAGIC
32
 
33
#define N_BADMAG(x)       ((x).a_info != ZMAGIC)
34
 
35
/* By default, segment size is constant.  But some machines override this
36
   to be a function of the a.out header (e.g. machine type).  */
37
#ifndef N_SEGSIZE
38
#define N_SEGSIZE(x)    SEGMENT_SIZE
39
#endif
40
#undef N_SEGSIZE   /* FIXMEXXXX */
41
 
42
/* Segment information for the a.out.Adobe format is specified after the
43
   file header.  It contains N segment descriptors, followed by one with
44
   a type of zero.
45
 
46
   The actual text of the segments starts at N_TXTOFF in the file,
47
   regardless of how many or how few segment headers there are.  */
48
 
49
struct external_segdesc {
50
        unsigned char e_type[1];
51
        unsigned char e_size[3];
52
        unsigned char e_virtbase[4];
53
        unsigned char e_filebase[4];
54
};
55
 
56
struct internal_segdesc {
57
        unsigned int    a_type:8;       /* Segment type N_TEXT, N_DATA, 0 */
58
        unsigned int    a_size:24;      /* Segment size */
59
        bfd_vma         a_virtbase;     /* Virtual address */
60
        unsigned int    a_filebase;     /* Base address in object file */
61
};
62
 
63
#define N_TXTADDR(x) \
64
 
65
/* This is documented to be at 1024, but appears to really be at 2048.
66
   FIXME?!  */
67
#define N_TXTOFF(x)     2048
68
 
69
#define N_TXTSIZE(x) ((x).a_text)
70
 
71
#define N_DATADDR(x)
72
 
73
#define N_BSSADDR(x)
74
 
75
/* Offsets of the various portions of the file after the text segment.  */
76
 
77
#define N_DATOFF(x)     ( N_TXTOFF(x) + N_TXTSIZE(x) )
78
#define N_TRELOFF(x)    ( N_DATOFF(x) + (x).a_data )
79
#define N_DRELOFF(x)    ( N_TRELOFF(x) + (x).a_trsize )
80
#define N_SYMOFF(x)     ( N_DRELOFF(x) + (x).a_drsize )
81
#define N_STROFF(x)     ( N_SYMOFF(x) + (x).a_syms )
82
 
83
/* Symbols */
84
struct external_nlist {
85
  bfd_byte e_strx[BYTES_IN_WORD];       /* index into string table of name */
86
  bfd_byte e_type[1];                   /* type of symbol */
87
  bfd_byte e_other[1];                  /* misc info (usually empty) */
88
  bfd_byte e_desc[2];                   /* description field */
89
  bfd_byte e_value[BYTES_IN_WORD];      /* value of symbol */
90
};
91
 
92
#define EXTERNAL_NLIST_SIZE (BYTES_IN_WORD+4+BYTES_IN_WORD)
93
 
94
struct internal_nlist {
95
  unsigned long n_strx;                 /* index into string table of name */
96
  unsigned char n_type;                 /* type of symbol */
97
  unsigned char n_other;                /* misc info (usually empty) */
98
  unsigned short n_desc;                /* description field */
99
  bfd_vma n_value;                      /* value of symbol */
100
};
101
 
102
/* The n_type field is the symbol type, containing:  */
103
 
104
#define N_UNDF  0        /* Undefined symbol */
105
#define N_ABS   2       /* Absolute symbol -- defined at particular addr */
106
#define N_TEXT  4       /* Text sym -- defined at offset in text seg */
107
#define N_DATA  6       /* Data sym -- defined at offset in data seg */
108
#define N_BSS   8       /* BSS  sym -- defined at offset in zero'd seg */
109
#define N_COMM  0x12    /* Common symbol (visible after shared lib dynlink) */
110
#define N_FN    0x1f    /* File name of .o file */
111
#define N_FN_SEQ 0x0C   /* N_FN from Sequent compilers (sigh) */
112
/* Note: N_EXT can only be usefully OR-ed with N_UNDF, N_ABS, N_TEXT,
113
   N_DATA, or N_BSS.  When the low-order bit of other types is set,
114
   (e.g. N_WARNING versus N_FN), they are two different types.  */
115
#define N_EXT   1       /* External symbol (as opposed to local-to-this-file) */
116
#define N_TYPE  0x1e
117
#define N_STAB  0xe0    /* If any of these bits are on, it's a debug symbol */
118
 
119
#define N_INDR 0x0a
120
 
121
/* The following symbols refer to set elements.
122
   All the N_SET[ATDB] symbols with the same name form one set.
123
   Space is allocated for the set in the text section, and each set
124
   elements value is stored into one word of the space.
125
   The first word of the space is the length of the set (number of elements).
126
 
127
   The address of the set is made into an N_SETV symbol
128
   whose name is the same as the name of the set.
129
   This symbol acts like a N_DATA global symbol
130
   in that it can satisfy undefined external references.  */
131
 
132
/* These appear as input to LD, in a .o file.  */
133
#define N_SETA  0x14            /* Absolute set element symbol */
134
#define N_SETT  0x16            /* Text set element symbol */
135
#define N_SETD  0x18            /* Data set element symbol */
136
#define N_SETB  0x1A            /* Bss set element symbol */
137
 
138
/* This is output from LD.  */
139
#define N_SETV  0x1C            /* Pointer to set vector in data area.  */
140
 
141
/* Warning symbol. The text gives a warning message, the next symbol
142
   in the table will be undefined. When the symbol is referenced, the
143
   message is printed.  */
144
 
145
#define N_WARNING 0x1e
146
 
147
/* Relocations
148
 
149
  There are two types of relocation flavours for a.out systems,
150
  standard and extended. The standard form is used on systems where the
151
  instruction has room for all the bits of an offset to the operand, whilst
152
  the extended form is used when an address operand has to be split over n
153
  instructions. Eg, on the 68k, each move instruction can reference
154
  the target with a displacement of 16 or 32 bits. On the sparc, move
155
  instructions use an offset of 14 bits, so the offset is stored in
156
  the reloc field, and the data in the section is ignored.
157
*/
158
 
159
/* This structure describes a single relocation to be performed.
160
   The text-relocation section of the file is a vector of these structures,
161
   all of which apply to the text section.
162
   Likewise, the data-relocation section applies to the data section.  */
163
 
164
struct reloc_std_external {
165
  bfd_byte r_address[BYTES_IN_WORD];    /* offset of of data to relocate */
166
  bfd_byte r_index[3];  /* symbol table index of symbol         */
167
  bfd_byte r_type[1];   /* relocation type                      */
168
};
169
 
170
#define RELOC_STD_BITS_PCREL_BIG        0x80
171
#define RELOC_STD_BITS_PCREL_LITTLE     0x01
172
 
173
#define RELOC_STD_BITS_LENGTH_BIG       0x60
174
#define RELOC_STD_BITS_LENGTH_SH_BIG    5       /* To shift to units place */
175
#define RELOC_STD_BITS_LENGTH_LITTLE    0x06
176
#define RELOC_STD_BITS_LENGTH_SH_LITTLE 1
177
 
178
#define RELOC_STD_BITS_EXTERN_BIG       0x10
179
#define RELOC_STD_BITS_EXTERN_LITTLE    0x08
180
 
181
#define RELOC_STD_BITS_BASEREL_BIG      0x08
182
#define RELOC_STD_BITS_BASEREL_LITTLE   0x08
183
 
184
#define RELOC_STD_BITS_JMPTABLE_BIG     0x04
185
#define RELOC_STD_BITS_JMPTABLE_LITTLE  0x04
186
 
187
#define RELOC_STD_BITS_RELATIVE_BIG     0x02
188
#define RELOC_STD_BITS_RELATIVE_LITTLE  0x02
189
 
190
#define RELOC_STD_SIZE  (BYTES_IN_WORD + 3 + 1)         /* Bytes per relocation entry */
191
 
192
struct reloc_std_internal
193
{
194
  bfd_vma r_address;            /* Address (within segment) to be relocated.  */
195
  /* The meaning of r_symbolnum depends on r_extern.  */
196
  unsigned int r_symbolnum:24;
197
  /* Nonzero means value is a pc-relative offset
198
     and it should be relocated for changes in its own address
199
     as well as for changes in the symbol or section specified.  */
200
  unsigned int r_pcrel:1;
201
  /* Length (as exponent of 2) of the field to be relocated.
202
     Thus, a value of 2 indicates 1<<2 bytes.  */
203
  unsigned int r_length:2;
204
  /* 1 => relocate with value of symbol.
205
     r_symbolnum is the index of the symbol
206
     in files the symbol table.
207
 
208
     r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
209
     (the N_EXT bit may be set also, but signifies nothing).  */
210
  unsigned int r_extern:1;
211
  /* The next three bits are for SunOS shared libraries, and seem to
212
     be undocumented.  */
213
  unsigned int r_baserel:1;     /* Linkage table relative */
214
  unsigned int r_jmptable:1;    /* pc-relative to jump table */
215
  unsigned int r_relative:1;    /* "relative relocation" */
216
  /* unused */
217
  unsigned int r_pad:1;         /* Padding -- set to zero */
218
};
219
 
220
 
221
/* EXTENDED RELOCS  */
222
 
223
struct reloc_ext_external {
224
  bfd_byte r_address[BYTES_IN_WORD];    /* offset of of data to relocate        */
225
  bfd_byte r_index[3];  /* symbol table index of symbol         */
226
  bfd_byte r_type[1];   /* relocation type                      */
227
  bfd_byte r_addend[BYTES_IN_WORD];     /* datum addend                         */
228
};
229
 
230
#define RELOC_EXT_BITS_EXTERN_BIG       0x80
231
#define RELOC_EXT_BITS_EXTERN_LITTLE    0x01
232
 
233
#define RELOC_EXT_BITS_TYPE_BIG         0x1F
234
#define RELOC_EXT_BITS_TYPE_SH_BIG      0
235
#define RELOC_EXT_BITS_TYPE_LITTLE      0xF8
236
#define RELOC_EXT_BITS_TYPE_SH_LITTLE   3
237
 
238
/* Bytes per relocation entry */
239
#define RELOC_EXT_SIZE  (BYTES_IN_WORD + 3 + 1 + BYTES_IN_WORD)
240
 
241
enum reloc_type
242
{
243
  /* simple relocations */
244
  RELOC_8,                      /* data[0:7] = addend + sv              */
245
  RELOC_16,                     /* data[0:15] = addend + sv             */
246
  RELOC_32,                     /* data[0:31] = addend + sv             */
247
  /* pc-rel displacement */
248
  RELOC_DISP8,                  /* data[0:7] = addend - pc + sv         */
249
  RELOC_DISP16,                 /* data[0:15] = addend - pc + sv        */
250
  RELOC_DISP32,                 /* data[0:31] = addend - pc + sv        */
251
  /* Special */
252
  RELOC_WDISP30,                /* data[0:29] = (addend + sv - pc)>>2   */
253
  RELOC_WDISP22,                /* data[0:21] = (addend + sv - pc)>>2   */
254
  RELOC_HI22,                   /* data[0:21] = (addend + sv)>>10       */
255
  RELOC_22,                     /* data[0:21] = (addend + sv)           */
256
  RELOC_13,                     /* data[0:12] = (addend + sv)           */
257
  RELOC_LO10,                   /* data[0:9] = (addend + sv)            */
258
  RELOC_SFA_BASE,
259
  RELOC_SFA_OFF13,
260
  /* P.I.C. (base-relative) */
261
  RELOC_BASE10,                 /* Not sure - maybe we can do this the */
262
  RELOC_BASE13,                 /* right way now */
263
  RELOC_BASE22,
264
  /* for some sort of pc-rel P.I.C. (?) */
265
  RELOC_PC10,
266
  RELOC_PC22,
267
  /* P.I.C. jump table */
268
  RELOC_JMP_TBL,
269
  /* reputedly for shared libraries somehow */
270
  RELOC_SEGOFF16,
271
  RELOC_GLOB_DAT,
272
  RELOC_JMP_SLOT,
273
  RELOC_RELATIVE,
274
 
275
  RELOC_11,
276
  RELOC_WDISP2_14,
277
  RELOC_WDISP19,
278
  RELOC_HHI22,                  /* data[0:21] = (addend + sv) >> 42     */
279
  RELOC_HLO10,                  /* data[0:9] = (addend + sv) >> 32      */
280
 
281
  /* 29K relocation types */
282
  RELOC_JUMPTARG,
283
  RELOC_CONST,
284
  RELOC_CONSTH,
285
 
286
  NO_RELOC
287
  };
288
 
289
 
290
struct reloc_internal {
291
  bfd_vma r_address;            /* offset of of data to relocate        */
292
  long  r_index;                /* symbol table index of symbol         */
293
  enum reloc_type r_type;       /* relocation type                      */
294
  bfd_vma r_addend;             /* datum addend                         */
295
};
296
 
297
#endif                          /* __A_OUT_ADOBE_H__ */

powered by: WebSVN 2.1.0

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