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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
/* ELF support for BFD.
2
   Copyright (C) 1991, 92, 93, 95, 97, 98, 1999 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 externally by the BFD library.
27
   I.E. it describes the in-file 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
/* The 64-bit stuff is kind of random.  Perhaps someone will publish a
32
   spec someday.  */
33
 
34
#ifndef _ELF_EXTERNAL_H
35
#define _ELF_EXTERNAL_H
36
 
37
/* ELF Header (32-bit implementations) */
38
 
39
typedef struct {
40
  unsigned char e_ident[16];            /* ELF "magic number" */
41
  unsigned char e_type[2];              /* Identifies object file type */
42
  unsigned char e_machine[2];           /* Specifies required architecture */
43
  unsigned char e_version[4];           /* Identifies object file version */
44
  unsigned char e_entry[4];             /* Entry point virtual address */
45
  unsigned char e_phoff[4];             /* Program header table file offset */
46
  unsigned char e_shoff[4];             /* Section header table file offset */
47
  unsigned char e_flags[4];             /* Processor-specific flags */
48
  unsigned char e_ehsize[2];            /* ELF header size in bytes */
49
  unsigned char e_phentsize[2];         /* Program header table entry size */
50
  unsigned char e_phnum[2];             /* Program header table entry count */
51
  unsigned char e_shentsize[2];         /* Section header table entry size */
52
  unsigned char e_shnum[2];             /* Section header table entry count */
53
  unsigned char e_shstrndx[2];          /* Section header string table index */
54
} Elf32_External_Ehdr;
55
 
56
typedef struct {
57
  unsigned char e_ident[16];            /* ELF "magic number" */
58
  unsigned char e_type[2];              /* Identifies object file type */
59
  unsigned char e_machine[2];           /* Specifies required architecture */
60
  unsigned char e_version[4];           /* Identifies object file version */
61
  unsigned char e_entry[8];             /* Entry point virtual address */
62
  unsigned char e_phoff[8];             /* Program header table file offset */
63
  unsigned char e_shoff[8];             /* Section header table file offset */
64
  unsigned char e_flags[4];             /* Processor-specific flags */
65
  unsigned char e_ehsize[2];            /* ELF header size in bytes */
66
  unsigned char e_phentsize[2];         /* Program header table entry size */
67
  unsigned char e_phnum[2];             /* Program header table entry count */
68
  unsigned char e_shentsize[2];         /* Section header table entry size */
69
  unsigned char e_shnum[2];             /* Section header table entry count */
70
  unsigned char e_shstrndx[2];          /* Section header string table index */
71
} Elf64_External_Ehdr;
72
 
73
/* Program header */
74
 
75
typedef struct {
76
  unsigned char p_type[4];              /* Identifies program segment type */
77
  unsigned char p_offset[4];            /* Segment file offset */
78
  unsigned char p_vaddr[4];             /* Segment virtual address */
79
  unsigned char p_paddr[4];             /* Segment physical address */
80
  unsigned char p_filesz[4];            /* Segment size in file */
81
  unsigned char p_memsz[4];             /* Segment size in memory */
82
  unsigned char p_flags[4];             /* Segment flags */
83
  unsigned char p_align[4];             /* Segment alignment, file & memory */
84
} Elf32_External_Phdr;
85
 
86
typedef struct {
87
  unsigned char p_type[4];              /* Identifies program segment type */
88
  unsigned char p_flags[4];             /* Segment flags */
89
  unsigned char p_offset[8];            /* Segment file offset */
90
  unsigned char p_vaddr[8];             /* Segment virtual address */
91
  unsigned char p_paddr[8];             /* Segment physical address */
92
  unsigned char p_filesz[8];            /* Segment size in file */
93
  unsigned char p_memsz[8];             /* Segment size in memory */
94
  unsigned char p_align[8];             /* Segment alignment, file & memory */
95
} Elf64_External_Phdr;
96
 
97
/* Section header */
98
 
99
typedef struct {
100
  unsigned char sh_name[4];             /* Section name, index in string tbl */
101
  unsigned char sh_type[4];             /* Type of section */
102
  unsigned char sh_flags[4];            /* Miscellaneous section attributes */
103
  unsigned char sh_addr[4];             /* Section virtual addr at execution */
104
  unsigned char sh_offset[4];           /* Section file offset */
105
  unsigned char sh_size[4];             /* Size of section in bytes */
106
  unsigned char sh_link[4];             /* Index of another section */
107
  unsigned char sh_info[4];             /* Additional section information */
108
  unsigned char sh_addralign[4];        /* Section alignment */
109
  unsigned char sh_entsize[4];          /* Entry size if section holds table */
110
} Elf32_External_Shdr;
111
 
112
typedef struct {
113
  unsigned char sh_name[4];             /* Section name, index in string tbl */
114
  unsigned char sh_type[4];             /* Type of section */
115
  unsigned char sh_flags[8];            /* Miscellaneous section attributes */
116
  unsigned char sh_addr[8];             /* Section virtual addr at execution */
117
  unsigned char sh_offset[8];           /* Section file offset */
118
  unsigned char sh_size[8];             /* Size of section in bytes */
119
  unsigned char sh_link[4];             /* Index of another section */
120
  unsigned char sh_info[4];             /* Additional section information */
121
  unsigned char sh_addralign[8];        /* Section alignment */
122
  unsigned char sh_entsize[8];          /* Entry size if section holds table */
123
} Elf64_External_Shdr;
124
 
125
/* Symbol table entry */
126
 
127
typedef struct {
128
  unsigned char st_name[4];             /* Symbol name, index in string tbl */
129
  unsigned char st_value[4];            /* Value of the symbol */
130
  unsigned char st_size[4];             /* Associated symbol size */
131
  unsigned char st_info[1];             /* Type and binding attributes */
132
  unsigned char st_other[1];            /* No defined meaning, 0 */
133
  unsigned char st_shndx[2];            /* Associated section index */
134
} Elf32_External_Sym;
135
 
136
typedef struct {
137
  unsigned char st_name[4];             /* Symbol name, index in string tbl */
138
  unsigned char st_info[1];             /* Type and binding attributes */
139
  unsigned char st_other[1];            /* No defined meaning, 0 */
140
  unsigned char st_shndx[2];            /* Associated section index */
141
  unsigned char st_value[8];            /* Value of the symbol */
142
  unsigned char st_size[8];             /* Associated symbol size */
143
} Elf64_External_Sym;
144
 
145
/* Note segments */
146
 
147
typedef struct {
148
  unsigned char namesz[4];              /* Size of entry's owner string */
149
  unsigned char descsz[4];              /* Size of the note descriptor */
150
  unsigned char type[4];                /* Interpretation of the descriptor */
151
  char          name[1];                /* Start of the name+desc data */
152
} Elf_External_Note;
153
 
154
/* Relocation Entries */
155
typedef struct {
156
  unsigned char r_offset[4];    /* Location at which to apply the action */
157
  unsigned char r_info[4];      /* index and type of relocation */
158
} Elf32_External_Rel;
159
 
160
typedef struct {
161
  unsigned char r_offset[4];    /* Location at which to apply the action */
162
  unsigned char r_info[4];      /* index and type of relocation */
163
  unsigned char r_addend[4];    /* Constant addend used to compute value */
164
} Elf32_External_Rela;
165
 
166
typedef struct {
167
  unsigned char r_offset[8];    /* Location at which to apply the action */
168
  unsigned char r_info[8];      /* index and type of relocation */
169
} Elf64_External_Rel;
170
 
171
typedef struct {
172
  unsigned char r_offset[8];    /* Location at which to apply the action */
173
  unsigned char r_info[8];      /* index and type of relocation */
174
  unsigned char r_addend[8];    /* Constant addend used to compute value */
175
} Elf64_External_Rela;
176
 
177
/* dynamic section structure */
178
 
179
typedef struct {
180
  unsigned char d_tag[4];               /* entry tag value */
181
  union {
182
    unsigned char       d_val[4];
183
    unsigned char       d_ptr[4];
184
  } d_un;
185
} Elf32_External_Dyn;
186
 
187
typedef struct {
188
  unsigned char d_tag[8];               /* entry tag value */
189
  union {
190
    unsigned char       d_val[8];
191
    unsigned char       d_ptr[8];
192
  } d_un;
193
} Elf64_External_Dyn;
194
 
195
/* The version structures are currently size independent.  They are
196
   named without a 32 or 64.  If that ever changes, these structures
197
   will need to be renamed.  */
198
 
199
/* This structure appears in a SHT_GNU_verdef section.  */
200
 
201
typedef struct {
202
  unsigned char         vd_version[2];
203
  unsigned char         vd_flags[2];
204
  unsigned char         vd_ndx[2];
205
  unsigned char         vd_cnt[2];
206
  unsigned char         vd_hash[4];
207
  unsigned char         vd_aux[4];
208
  unsigned char         vd_next[4];
209
} Elf_External_Verdef;
210
 
211
/* This structure appears in a SHT_GNU_verdef section.  */
212
 
213
typedef struct {
214
  unsigned char         vda_name[4];
215
  unsigned char         vda_next[4];
216
} Elf_External_Verdaux;
217
 
218
/* This structure appears in a SHT_GNU_verneed section.  */
219
 
220
typedef struct {
221
  unsigned char         vn_version[2];
222
  unsigned char         vn_cnt[2];
223
  unsigned char         vn_file[4];
224
  unsigned char         vn_aux[4];
225
  unsigned char         vn_next[4];
226
} Elf_External_Verneed;
227
 
228
/* This structure appears in a SHT_GNU_verneed section.  */
229
 
230
typedef struct {
231
  unsigned char         vna_hash[4];
232
  unsigned char         vna_flags[2];
233
  unsigned char         vna_other[2];
234
  unsigned char         vna_name[4];
235
  unsigned char         vna_next[4];
236
} Elf_External_Vernaux;
237
 
238
/* This structure appears in a SHT_GNU_versym section.  This is not a
239
   standard ELF structure; ELF just uses Elf32_Half.  */
240
 
241
typedef struct {
242
  unsigned char         vs_vers[2];
243
}
244
#ifdef __GNUC__
245
  __attribute__ ((packed))
246
#endif
247
  Elf_External_Versym;
248
 
249
/* Structure for syminfo section.  */
250
typedef struct
251
{
252
  unsigned char         si_boundto[2];
253
  unsigned char         si_flags[2];
254
} Elf_External_Syminfo;
255
 
256
#endif /* _ELF_EXTERNAL_H */

powered by: WebSVN 2.1.0

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