Tue Jun 23 14:55:05 1998 Mike Stump <mrs@wrs.com>
[deliverable/binutils-gdb.git] / binutils / readelf.h
CommitLineData
76466873
NC
1/* readelf.h -- This file contains structures similar to those found in
2 include/elf/internal.h. These structures however, match the layout of
3 the information in the file, rather than being optimised for internal
4 storage.
5
6 Copyright (C) 1998 Free Software Foundation, Inc.
7
8This file is part of GNU Binutils.
9
10This program is free software; you can redistribute it and/or modify
11it under the terms of the GNU General Public License as published by
12the Free Software Foundation; either version 2 of the License, or
13(at your option) any later version.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
23\f
24#ifndef _READELF_H
25#define _READELF_H
26
27#include "bfd.h"
28#include "elf/common.h"
a09db9ba
MM
29#include "elf/ppc.h"
30#include "elf/m32r.h"
31#include "elf/mips.h"
76466873
NC
32
33/* The type 'bfd_vma' is used in places where the 64 bit version of the
34 structure has a 64 bit wide field, and the 32 bit version has a 32 bit wide
35 field. It does not necessarily imply that the field contains an address. */
36
37#define EI_NIDENT 16
38
39/* The ELF file header. This appears at the start of every ELF file. */
40typedef struct
41{
42 unsigned char e_ident [EI_NIDENT]; /* Magic number and other info */
43 unsigned short e_type; /* Object file type */
44 unsigned short e_machine; /* Architecture */
45 unsigned long e_version; /* Object file version */
46 bfd_vma e_entry; /* Entry point virtual address */
47 bfd_vma e_phoff; /* Program header table file offset */
48 bfd_vma e_shoff; /* Section header table file offset */
49 unsigned long e_flags; /* Processor-specific flags */
50 unsigned short e_ehsize; /* ELF header size in bytes */
51 unsigned short e_phentsize; /* Program header table entry size */
52 unsigned short e_phnum; /* Program header table entry count */
53 unsigned short e_shentsize; /* Section header table entry size */
54 unsigned short e_shnum; /* Section header table entry count */
55 unsigned short e_shstrndx; /* Section header string table index */
56}
57Elf_Ehdr;
58
59/* Program Segment Header. (Might be wrong for 64 bit ELF formats). */
60typedef struct
61{
62 unsigned long p_type; /* Segment type */
63 bfd_vma p_offset; /* Segment file offset */
64 bfd_vma p_vaddr; /* Segment virtual address */
65 bfd_vma p_paddr; /* Segment physical address */
66 unsigned long p_filesz; /* Segment size in file */
67 unsigned long p_memsz; /* Segment size in memory */
68 unsigned long p_flags; /* Segment flags */
69 unsigned long p_align; /* Segment alignment */
70}
71Elf_Phdr;
72
73/* Section header. */
74typedef struct
75{
76 unsigned long sh_name; /* Section name (string tbl index) */
77 unsigned long sh_type; /* Section type */
78 bfd_vma sh_flags; /* Section flags */
79 bfd_vma sh_addr; /* Section virtual addr at execution */
80 bfd_vma sh_offset; /* Section file offset */
81 unsigned long sh_size; /* Section size in bytes */
82 unsigned long sh_link; /* Link to another section */
83 unsigned long sh_info; /* Additional section information */
84 bfd_vma sh_addralign; /* Section alignment */
85 bfd_vma sh_entsize; /* Entry size if section holds table */
86}
87Elf_Shdr;
88
89/* Symbol table entry. (Might be incorrect for 64 bit ELF formats) */
90typedef struct
91{
92 unsigned long st_name; /* Symbol name (string tbl index) */
93 bfd_vma st_value; /* Symbol value */
94 bfd_vma st_size; /* Symbol size */
95 unsigned char st_info; /* Symbol type and binding */
96 unsigned char st_other; /* No defined meaning, 0 */
97 unsigned short st_shndx; /* Section index */
98}
99Elf_Sym;
100
101/* Version definition sections. */
102typedef struct
103{
104 unsigned short vd_version; /* Version number of structure. */
105 unsigned short vd_flags; /* Flags (VER_FLG_*). */
106 unsigned short vd_ndx; /* Version index. */
107 unsigned short vd_cnt; /* Number of verdaux entries. */
108 unsigned long vd_hash; /* Hash of name. */
109 unsigned long vd_aux; /* Offset to verdaux entries. */
110 unsigned long vd_next; /* Offset to next verdef. */
111}
112Elf_Verdef;
113
114/* Auxialiary version information. */
115typedef struct
116{
117 unsigned long vda_name; /* String table offset of name. */
118 unsigned long vda_next; /* Offset to next verdaux. */
119}
120Elf_Verdaux;
121
122/* Version dependency section. */
123typedef struct
124{
125 unsigned short vn_version; /* Version number of structure. */
126 unsigned short vn_cnt; /* Number of vernaux entries. */
127 unsigned long vn_file; /* String table offset of library name. */
128 unsigned long vn_aux; /* Offset to vernaux entries. */
129 unsigned long vn_next; /* Offset to next verneed. */
130}
131Elf_Verneed;
132
133/* Auxiliary needed version information. */
134typedef struct
135{
136 unsigned long vna_hash; /* Hash of dependency name. */
137 unsigned short vna_flags; /* Flags (VER_FLG_*). */
138 unsigned short vna_other; /* Unused. */
139 unsigned long vna_name; /* String table offset to version name. */
140 unsigned long vna_next; /* Offset to next vernaux. */
141}
142Elf_Vernaux;
143
144/* Relocation table entry without addend. */
145typedef struct
146{
147 bfd_vma r_offset; /* Location at which to apply the action */
148 bfd_vma r_info; /* index and type of relocation */
149}
150Elf_Rel;
151
152/* Relocation table entry with addend. */
153typedef struct
154{
155 bfd_vma r_offset; /* Location at which to apply the action */
156 bfd_vma r_info; /* Index and Type of relocation */
157 bfd_signed_vma r_addend; /* Constant addend used to compute value */
158}
159Elf_Rela;
160
161/* Dynamic section entry. */
162typedef struct
163{
164 signed long d_tag; /* Dynamic entry type */
165 union
166 {
167 bfd_vma d_val; /* Integer value */
168 bfd_vma d_ptr; /* Address value */
169 } d_un;
170}
171Elf_Dyn;
172
173
174#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */
175
176#endif /* _READELF_H */
This page took 0.029443 seconds and 4 git commands to generate.