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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [include/] [elf/] [internal.h] - Blame information for rev 107

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
/* ELF support for BFD.
2
   Copyright (C) 1991, 92, 93, 94, 95, 97, 1998 Free Software Foundation, Inc.
3
 
4
   Written by Fred Fish @ Cygnus Support, from information published
5
   in "UNIX System V Release 4, Programmers Guide: ANSI C and
6
   Programming Support Tools".
7
 
8
This file is part of BFD, the Binary File Descriptor library.
9
 
10
This program is free software; you can redistribute it and/or modify
11
it under the terms of the GNU General Public License as published by
12
the Free Software Foundation; either version 2 of the License, or
13
(at your option) any later version.
14
 
15
This program is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
GNU General Public License for more details.
19
 
20
You should have received a copy of the GNU General Public License
21
along with this program; if not, write to the Free Software
22
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
23
 
24
 
25
/* This file is part of ELF support for BFD, and contains the portions
26
   that describe how ELF is represented internally in the BFD library.
27
   I.E. it describes the in-memory representation of ELF.  It requires
28
   the elf-common.h file which contains the portions that are common to
29
   both the internal and external representations. */
30
 
31
 
32
/* NOTE that these structures are not kept in the same order as they appear
33
   in the object file.  In some cases they've been reordered for more optimal
34
   packing under various circumstances.  */
35
 
36
#ifndef _ELF_INTERNAL_H
37
#define _ELF_INTERNAL_H
38
 
39
/* ELF Header */
40
 
41
#define EI_NIDENT       16              /* Size of e_ident[] */
42
 
43
typedef struct elf_internal_ehdr {
44
  unsigned char         e_ident[EI_NIDENT];     /* ELF "magic number" */
45
  bfd_vma               e_entry;                /* Entry point virtual address */
46
  bfd_size_type         e_phoff;                /* Program header table file offset */
47
  bfd_size_type         e_shoff;                /* Section header table file offset */
48
  unsigned long         e_version;              /* Identifies object file version */
49
  unsigned long         e_flags;                /* Processor-specific flags */
50
  unsigned short        e_type;                 /* Identifies object file type */
51
  unsigned short        e_machine;              /* Specifies required architecture */
52
  unsigned short        e_ehsize;               /* ELF header size in bytes */
53
  unsigned short        e_phentsize;            /* Program header table entry size */
54
  unsigned short        e_phnum;                /* Program header table entry count */
55
  unsigned short        e_shentsize;            /* Section header table entry size */
56
  unsigned short        e_shnum;                /* Section header table entry count */
57
  unsigned short        e_shstrndx;             /* Section header string table index */
58
} Elf_Internal_Ehdr;
59
 
60
#define elf32_internal_ehdr elf_internal_ehdr
61
#define Elf32_Internal_Ehdr Elf_Internal_Ehdr
62
#define elf64_internal_ehdr elf_internal_ehdr
63
#define Elf64_Internal_Ehdr Elf_Internal_Ehdr
64
 
65
/* Program header */
66
 
67
struct elf_internal_phdr {
68
  unsigned long p_type;                 /* Identifies program segment type */
69
  unsigned long p_flags;                /* Segment flags */
70
  bfd_vma       p_offset;               /* Segment file offset */
71
  bfd_vma       p_vaddr;                /* Segment virtual address */
72
  bfd_vma       p_paddr;                /* Segment physical address */
73
  bfd_vma       p_filesz;               /* Segment size in file */
74
  bfd_vma       p_memsz;                /* Segment size in memory */
75
  bfd_vma       p_align;                /* Segment alignment, file & memory */
76
};
77
 
78
typedef struct elf_internal_phdr Elf_Internal_Phdr;
79
#define elf32_internal_phdr elf_internal_phdr
80
#define Elf32_Internal_Phdr Elf_Internal_Phdr
81
#define elf64_internal_phdr elf_internal_phdr
82
#define Elf64_Internal_Phdr Elf_Internal_Phdr
83
 
84
/* Section header */
85
 
86
typedef struct elf_internal_shdr {
87
  unsigned int  sh_name;                /* Section name, index in string tbl */
88
  unsigned int  sh_type;                /* Type of section */
89
  bfd_vma       sh_flags;               /* Miscellaneous section attributes */
90
  bfd_vma       sh_addr;                /* Section virtual addr at execution */
91
  bfd_size_type sh_size;                /* Size of section in bytes */
92
  bfd_size_type sh_entsize;             /* Entry size if section holds table */
93
  unsigned long sh_link;                /* Index of another section */
94
  unsigned long sh_info;                /* Additional section information */
95
  file_ptr      sh_offset;              /* Section file offset */
96
  unsigned int  sh_addralign;           /* Section alignment */
97
 
98
  /* The internal rep also has some cached info associated with it. */
99
  asection *    bfd_section;            /* Associated BFD section.  */
100
  PTR           contents;               /* Section contents.  */
101
} Elf_Internal_Shdr;
102
 
103
#define elf32_internal_shdr elf_internal_shdr
104
#define Elf32_Internal_Shdr Elf_Internal_Shdr
105
#define elf64_internal_shdr elf_internal_shdr
106
#define Elf64_Internal_Shdr Elf_Internal_Shdr
107
 
108
/* Symbol table entry */
109
 
110
struct elf_internal_sym {
111
  bfd_vma       st_value;               /* Value of the symbol */
112
  bfd_vma       st_size;                /* Associated symbol size */
113
  unsigned long st_name;                /* Symbol name, index in string tbl */
114
  unsigned char st_info;                /* Type and binding attributes */
115
  unsigned char st_other;               /* No defined meaning, 0 */
116
  unsigned short st_shndx;              /* Associated section index */
117
};
118
 
119
typedef struct elf_internal_sym Elf_Internal_Sym;
120
 
121
#define elf32_internal_sym elf_internal_sym
122
#define elf64_internal_sym elf_internal_sym
123
#define Elf32_Internal_Sym Elf_Internal_Sym
124
#define Elf64_Internal_Sym Elf_Internal_Sym
125
 
126
/* Note segments */
127
 
128
typedef struct elf_internal_note {
129
  unsigned long namesz;                 /* Size of entry's owner string */
130
  unsigned long descsz;                 /* Size of the note descriptor */
131
  unsigned long type;                   /* Interpretation of the descriptor */
132
  char *        namedata;               /* Start of the name+desc data */
133
  char *        descdata;               /* Start of the desc data */
134
  bfd_vma       descpos;                /* File offset of the descdata */
135
} Elf_Internal_Note;
136
#define Elf32_Internal_Note     Elf_Internal_Note
137
#define elf32_internal_note     elf_internal_note
138
 
139
/* Relocation Entries */
140
 
141
typedef struct elf_internal_rel {
142
  bfd_vma       r_offset;       /* Location at which to apply the action */
143
  /* This needs to support 64-bit values in elf64.  */
144
  bfd_vma       r_info;         /* index and type of relocation */
145
} Elf_Internal_Rel;
146
 
147
#define elf32_internal_rel elf_internal_rel
148
#define Elf32_Internal_Rel Elf_Internal_Rel
149
#define elf64_internal_rel elf_internal_rel
150
#define Elf64_Internal_Rel Elf_Internal_Rel
151
 
152
typedef struct elf_internal_rela {
153
  bfd_vma       r_offset;       /* Location at which to apply the action */
154
  bfd_vma       r_info;         /* Index and Type of relocation */
155
  bfd_signed_vma r_addend;      /* Constant addend used to compute value */
156
} Elf_Internal_Rela;
157
 
158
#define elf32_internal_rela elf_internal_rela
159
#define elf64_internal_rela elf_internal_rela
160
#define Elf32_Internal_Rela Elf_Internal_Rela
161
#define Elf64_Internal_Rela Elf_Internal_Rela
162
 
163
/* dynamic section structure */
164
 
165
typedef struct elf_internal_dyn {
166
  /* This needs to support 64-bit values in elf64.  */
167
  bfd_vma d_tag;                /* entry tag value */
168
  union {
169
    /* This needs to support 64-bit values in elf64.  */
170
    bfd_vma     d_val;
171
    bfd_vma     d_ptr;
172
  } d_un;
173
} Elf_Internal_Dyn;
174
 
175
#define elf32_internal_dyn elf_internal_dyn
176
#define elf64_internal_dyn elf_internal_dyn
177
#define Elf32_Internal_Dyn Elf_Internal_Dyn
178
#define Elf64_Internal_Dyn Elf_Internal_Dyn
179
 
180
/* This structure appears in a SHT_GNU_verdef section.  */
181
 
182
typedef struct elf_internal_verdef {
183
  unsigned short vd_version;    /* Version number of structure.  */
184
  unsigned short vd_flags;      /* Flags (VER_FLG_*).  */
185
  unsigned short vd_ndx;        /* Version index.  */
186
  unsigned short vd_cnt;        /* Number of verdaux entries.  */
187
  unsigned long  vd_hash;       /* Hash of name.  */
188
  unsigned long  vd_aux;        /* Offset to verdaux entries.  */
189
  unsigned long  vd_next;       /* Offset to next verdef.  */
190
 
191
  /* These fields are set up when BFD reads in the structure.  FIXME:
192
     It would be cleaner to store these in a different structure.  */
193
  bfd                         *vd_bfd;          /* BFD.  */
194
  const char                  *vd_nodename;     /* Version name.  */
195
  struct elf_internal_verdef  *vd_nextdef;      /* vd_next as pointer.  */
196
  struct elf_internal_verdaux *vd_auxptr;       /* vd_aux as pointer.  */
197
  unsigned int                 vd_exp_refno;    /* Used by the linker.  */
198
} Elf_Internal_Verdef;
199
 
200
/* This structure appears in a SHT_GNU_verdef section.  */
201
 
202
typedef struct elf_internal_verdaux {
203
  unsigned long vda_name;       /* String table offset of name.  */
204
  unsigned long vda_next;       /* Offset to next verdaux.  */
205
 
206
  /* These fields are set up when BFD reads in the structure.  FIXME:
207
     It would be cleaner to store these in a different structure.  */
208
  const char *vda_nodename;                     /* vda_name as pointer.  */
209
  struct elf_internal_verdaux *vda_nextptr;     /* vda_next as pointer.  */
210
} Elf_Internal_Verdaux;
211
 
212
/* This structure appears in a SHT_GNU_verneed section.  */
213
 
214
typedef struct elf_internal_verneed {
215
  unsigned short vn_version;    /* Version number of structure.  */
216
  unsigned short vn_cnt;        /* Number of vernaux entries.  */
217
  unsigned long  vn_file;       /* String table offset of library name.  */
218
  unsigned long  vn_aux;        /* Offset to vernaux entries.  */
219
  unsigned long  vn_next;       /* Offset to next verneed.  */
220
 
221
  /* These fields are set up when BFD reads in the structure.  FIXME:
222
     It would be cleaner to store these in a different structure.  */
223
  bfd                         *vn_bfd;          /* BFD.  */
224
  const char                  *vn_filename;     /* vn_file as pointer.  */
225
  struct elf_internal_vernaux *vn_auxptr;       /* vn_aux as pointer.  */
226
  struct elf_internal_verneed *vn_nextref;      /* vn_nextref as pointer.  */
227
} Elf_Internal_Verneed;
228
 
229
/* This structure appears in a SHT_GNU_verneed section.  */
230
 
231
typedef struct elf_internal_vernaux {
232
  unsigned long  vna_hash;      /* Hash of dependency name.  */
233
  unsigned short vna_flags;     /* Flags (VER_FLG_*).  */
234
  unsigned short vna_other;     /* Unused.  */
235
  unsigned long  vna_name;      /* String table offset to version name.  */
236
  unsigned long  vna_next;      /* Offset to next vernaux.  */
237
 
238
  /* These fields are set up when BFD reads in the structure.  FIXME:
239
     It would be cleaner to store these in a different structure.  */
240
  const char                  *vna_nodename;    /* vna_name as pointer.  */
241
  struct elf_internal_vernaux *vna_nextptr;     /* vna_next as pointer.  */
242
} Elf_Internal_Vernaux;
243
 
244
/* This structure appears in a SHT_GNU_versym section.  This is not a
245
   standard ELF structure; ELF just uses Elf32_Half.  */
246
 
247
typedef struct elf_internal_versym {
248
  unsigned short vs_vers;
249
} Elf_Internal_Versym;
250
 
251
/* Structure for syminfo section.  */
252
typedef struct
253
{
254
  unsigned short int    si_boundto;
255
  unsigned short int    si_flags;
256
} Elf_Internal_Syminfo;
257
 
258
 
259
#define elf32_internal_verdef elf_internal_verdef
260
#define elf64_internal_verdef elf_internal_verdef
261
#define elf32_internal_verdaux elf_internal_verdaux
262
#define elf64_internal_verdaux elf_internal_verdaux
263
#define elf32_internal_verneed elf_internal_verneed
264
#define elf64_internal_verneed elf_internal_verneed
265
#define elf32_internal_vernaux elf_internal_vernaux
266
#define elf64_internal_vernaux elf_internal_vernaux
267
#define elf32_internal_versym elf_internal_versym
268
#define elf64_internal_versym elf_internal_versym
269
 
270
#define Elf32_Internal_Verdef Elf_Internal_Verdef
271
#define Elf64_Internal_Verdef Elf_Internal_Verdef
272
#define Elf32_Internal_Verdaux Elf_Internal_Verdaux
273
#define Elf64_Internal_Verdaux Elf_Internal_Verdaux
274
#define Elf32_Internal_Verneed Elf_Internal_Verneed
275
#define Elf64_Internal_Verneed Elf_Internal_Verneed
276
#define Elf32_Internal_Vernaux Elf_Internal_Vernaux
277
#define Elf64_Internal_Vernaux Elf_Internal_Vernaux
278
#define Elf32_Internal_Versym Elf_Internal_Versym
279
#define Elf64_Internal_Versym Elf_Internal_Versym
280
#define Elf32_Internal_Syminfo Elf_Internal_Syminfo
281
#define Elf64_Internal_Syminfo Elf_Internal_Syminfo
282
 
283
/* This structure is used to describe how sections should be assigned
284
   to program segments.  */
285
 
286
struct elf_segment_map
287
{
288
  /* Next program segment.  */
289
  struct elf_segment_map *next;
290
  /* Program segment type.  */
291
  unsigned long p_type;
292
  /* Program segment flags.  */
293
  unsigned long p_flags;
294
  /* Program segment physical address.  */
295
  bfd_vma p_paddr;
296
  /* Whether the p_flags field is valid; if not, the flags are based
297
     on the section flags.  */
298
  unsigned int p_flags_valid : 1;
299
  /* Whether the p_paddr field is valid; if not, the physical address
300
     is based on the section lma values.  */
301
  unsigned int p_paddr_valid : 1;
302
  /* Whether this segment includes the file header.  */
303
  unsigned int includes_filehdr : 1;
304
  /* Whether this segment includes the program headers.  */
305
  unsigned int includes_phdrs : 1;
306
  /* Number of sections (may be 0).  */
307
  unsigned int count;
308
  /* Sections.  Actual number of elements is in count field.  */
309
  asection *sections[1];
310
};
311
 
312
#endif /* _ELF_INTERNAL_H */

powered by: WebSVN 2.1.0

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