remove some sym_probe_fns methods
[deliverable/binutils-gdb.git] / elfcpp / elfcpp_internal.h
CommitLineData
bae7f79e
ILT
1// elfcpp_internal.h -- internals for elfcpp -*- C++ -*-
2
6cb15b7f
ILT
3// Copyright 2006, 2007, Free Software Foundation, Inc.
4// Written by Ian Lance Taylor <iant@google.com>.
5
6// This file is part of elfcpp.
7
8// This program is free software; you can redistribute it and/or
9// modify it under the terms of the GNU Library General Public License
10// as published by the Free Software Foundation; either version 2, or
11// (at your option) any later version.
12
13// In addition to the permissions in the GNU Library General Public
14// License, the Free Software Foundation gives you unlimited
15// permission to link the compiled version of this file into
16// combinations with other programs, and to distribute those
17// combinations without any restriction coming from the use of this
18// file. (The Library Public License restrictions do apply in other
19// respects; for example, they cover modification of the file, and
20/// distribution when not linked into a combined executable.)
21
22// This program is distributed in the hope that it will be useful, but
23// WITHOUT ANY WARRANTY; without even the implied warranty of
24// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25// Library General Public License for more details.
26
27// You should have received a copy of the GNU Library General Public
28// License along with this program; if not, write to the Free Software
29// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
30// 02110-1301, USA.
31
bae7f79e
ILT
32// This is included by elfcpp.h, the external interface, but holds
33// information which we want to keep private.
34
bae7f79e
ILT
35#ifndef ELFCPP_INTERNAL_H
36#define ELFCPP_INTERNAL_H
37
38namespace elfcpp
39{
40
41namespace internal
42{
43
bae7f79e
ILT
44// The ELF file header.
45
46template<int size>
47struct Ehdr_data
48{
49 unsigned char e_ident[EI_NIDENT];
50 Elf_Half e_type;
51 Elf_Half e_machine;
52 Elf_Word e_version;
53 typename Elf_types<size>::Elf_Addr e_entry;
54 typename Elf_types<size>::Elf_Off e_phoff;
55 typename Elf_types<size>::Elf_Off e_shoff;
56 Elf_Word e_flags;
57 Elf_Half e_ehsize;
58 Elf_Half e_phentsize;
59 Elf_Half e_phnum;
60 Elf_Half e_shentsize;
61 Elf_Half e_shnum;
62 Elf_Half e_shstrndx;
63};
64
dbe717ef 65// An ELF section header.
bae7f79e
ILT
66
67template<int size>
68struct Shdr_data
69{
70 Elf_Word sh_name;
71 Elf_Word sh_type;
72 typename Elf_types<size>::Elf_WXword sh_flags;
73 typename Elf_types<size>::Elf_Addr sh_addr;
74 typename Elf_types<size>::Elf_Off sh_offset;
75 typename Elf_types<size>::Elf_WXword sh_size;
76 Elf_Word sh_link;
77 Elf_Word sh_info;
78 typename Elf_types<size>::Elf_WXword sh_addralign;
79 typename Elf_types<size>::Elf_WXword sh_entsize;
80};
81
39081c14
ILT
82// An ELF segment header. We use template specialization for the
83// 32-bit and 64-bit versions because the fields are in a different
84// order.
85
86template<int size>
87struct Phdr_data;
88
89template<>
90struct Phdr_data<32>
91{
92 Elf_Word p_type;
93 Elf_types<32>::Elf_Off p_offset;
94 Elf_types<32>::Elf_Addr p_vaddr;
95 Elf_types<32>::Elf_Addr p_paddr;
96 Elf_Word p_filesz;
97 Elf_Word p_memsz;
98 Elf_Word p_flags;
99 Elf_Word p_align;
100};
101
102template<>
103struct Phdr_data<64>
104{
105 Elf_Word p_type;
106 Elf_Word p_flags;
107 Elf_types<64>::Elf_Off p_offset;
108 Elf_types<64>::Elf_Addr p_vaddr;
109 Elf_types<64>::Elf_Addr p_paddr;
110 Elf_Xword p_filesz;
111 Elf_Xword p_memsz;
112 Elf_Xword p_align;
113};
114
bae7f79e
ILT
115// An ELF symbol table entry. We use template specialization for the
116// 32-bit and 64-bit versions because the fields are in a different
117// order.
118
119template<int size>
120struct Sym_data;
121
122template<>
123struct Sym_data<32>
124{
125 Elf_Word st_name;
126 Elf_types<32>::Elf_Addr st_value;
127 Elf_Word st_size;
128 unsigned char st_info;
129 unsigned char st_other;
130 Elf_Half st_shndx;
131};
132
133template<>
134struct Sym_data<64>
135{
136 Elf_Word st_name;
137 unsigned char st_info;
138 unsigned char st_other;
139 Elf_Half st_shndx;
140 Elf_types<64>::Elf_Addr st_value;
141 Elf_Xword st_size;
142};
143
dbe717ef 144// ELF relocation table entries.
61ba1cf9
ILT
145
146template<int size>
147struct Rel_data
148{
149 typename Elf_types<size>::Elf_Addr r_offset;
150 typename Elf_types<size>::Elf_WXword r_info;
151};
152
153template<int size>
154struct Rela_data
155{
156 typename Elf_types<size>::Elf_Addr r_offset;
157 typename Elf_types<size>::Elf_WXword r_info;
158 typename Elf_types<size>::Elf_Swxword r_addend;
159};
160
dbe717ef
ILT
161// An entry in the ELF SHT_DYNAMIC section aka PT_DYNAMIC segment.
162
163template<int size>
164struct Dyn_data
165{
166 typename Elf_types<size>::Elf_Swxword d_tag;
167 typename Elf_types<size>::Elf_WXword d_val;
168};
169
170// An entry in a SHT_GNU_verdef section. This structure is the same
171// in 32-bit and 64-bit ELF files.
172
173struct Verdef_data
174{
175 // Version number of structure (VER_DEF_*).
176 Elf_Half vd_version;
177 // Bit flags (VER_FLG_*).
178 Elf_Half vd_flags;
179 // Version index.
180 Elf_Half vd_ndx;
181 // Number of auxiliary Verdaux entries.
182 Elf_Half vd_cnt;
183 // Hash of name.
184 Elf_Word vd_hash;
185 // Byte offset to first Verdaux entry.
186 Elf_Word vd_aux;
187 // Byte offset to next Verdef entry.
188 Elf_Word vd_next;
189};
190
191// An auxiliary entry in a SHT_GNU_verdef section. This structure is
192// the same in 32-bit and 64-bit ELF files.
193
194struct Verdaux_data
195{
196 // Offset in string table of version name.
197 Elf_Word vda_name;
198 // Byte offset to next Verdaux entry.
199 Elf_Word vda_next;
200};
201
202// An entry in a SHT_GNU_verneed section. This structure is the same
203// in 32-bit and 64-bit ELF files.
204
205struct Verneed_data
206{
207 // Version number of structure (VER_NEED_*).
208 Elf_Half vn_version;
209 // Number of auxiliary Vernaux entries.
210 Elf_Half vn_cnt;
211 // Offset in string table of library name.
212 Elf_Word vn_file;
213 // Byte offset to first Vernaux entry.
214 Elf_Word vn_aux;
215 // Byt eoffset to next Verneed entry.
216 Elf_Word vn_next;
217};
218
219// An auxiliary entry in a SHT_GNU_verneed section. This structure is
220// the same in 32-bit and 64-bit ELF files.
221
222struct Vernaux_data
223{
224 // Hash of dependency name.
225 Elf_Word vna_hash;
226 // Bit flags (VER_FLG_*).
227 Elf_Half vna_flags;
228 // Version index used in SHT_GNU_versym entries.
229 Elf_Half vna_other;
230 // Offset in string table of version name.
231 Elf_Word vna_name;
232 // Byte offset to next Vernaux entry.
233 Elf_Word vna_next;
234};
235
bae7f79e
ILT
236} // End namespace internal.
237
238} // End namespace elfcpp.
239
240#endif // !defined(ELFCPP_INTERNAL_H)
This page took 0.28735 seconds and 4 git commands to generate.