Commit | Line | Data |
---|---|---|
bae7f79e ILT |
1 | // elfcpp.h -- main header file 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 the external interface for elfcpp. |
33 | ||
34 | #ifndef ELFCPP_H | |
35 | #define ELFCPP_H | |
36 | ||
8d9455b4 | 37 | #include "elfcpp_swap.h" |
bae7f79e ILT |
38 | |
39 | #include <stdint.h> | |
40 | ||
41 | namespace elfcpp | |
42 | { | |
43 | ||
44 | // Basic ELF types. | |
45 | ||
46 | // These types are always the same size. | |
47 | ||
48 | typedef uint16_t Elf_Half; | |
49 | typedef uint32_t Elf_Word; | |
50 | typedef int32_t Elf_Sword; | |
51 | typedef uint64_t Elf_Xword; | |
52 | typedef int64_t Elf_Sxword; | |
53 | ||
54 | // These types vary in size depending on the ELF file class. The | |
55 | // template parameter should be 32 or 64. | |
56 | ||
57 | template<int size> | |
39081c14 | 58 | struct Elf_types; |
bae7f79e ILT |
59 | |
60 | template<> | |
61 | struct Elf_types<32> | |
62 | { | |
63 | typedef uint32_t Elf_Addr; | |
64 | typedef uint32_t Elf_Off; | |
65 | typedef uint32_t Elf_WXword; | |
61ba1cf9 | 66 | typedef int32_t Elf_Swxword; |
bae7f79e ILT |
67 | }; |
68 | ||
69 | template<> | |
70 | struct Elf_types<64> | |
71 | { | |
72 | typedef uint64_t Elf_Addr; | |
73 | typedef uint64_t Elf_Off; | |
74 | typedef uint64_t Elf_WXword; | |
61ba1cf9 | 75 | typedef int64_t Elf_Swxword; |
bae7f79e ILT |
76 | }; |
77 | ||
78 | // Offsets within the Ehdr e_ident field. | |
79 | ||
80 | const int EI_MAG0 = 0; | |
81 | const int EI_MAG1 = 1; | |
82 | const int EI_MAG2 = 2; | |
83 | const int EI_MAG3 = 3; | |
84 | const int EI_CLASS = 4; | |
85 | const int EI_DATA = 5; | |
86 | const int EI_VERSION = 6; | |
87 | const int EI_OSABI = 7; | |
88 | const int EI_ABIVERSION = 8; | |
89 | const int EI_PAD = 9; | |
90 | const int EI_NIDENT = 16; | |
91 | ||
92 | // The valid values found in Ehdr e_ident[EI_MAG0 through EI_MAG3]. | |
93 | ||
94 | const int ELFMAG0 = 0x7f; | |
95 | const int ELFMAG1 = 'E'; | |
96 | const int ELFMAG2 = 'L'; | |
97 | const int ELFMAG3 = 'F'; | |
98 | ||
99 | // The valid values found in Ehdr e_ident[EI_CLASS]. | |
100 | ||
101 | enum | |
102 | { | |
103 | ELFCLASSNONE = 0, | |
104 | ELFCLASS32 = 1, | |
105 | ELFCLASS64 = 2 | |
106 | }; | |
107 | ||
108 | // The valid values found in Ehdr e_ident[EI_DATA]. | |
109 | ||
110 | enum | |
111 | { | |
112 | ELFDATANONE = 0, | |
113 | ELFDATA2LSB = 1, | |
114 | ELFDATA2MSB = 2 | |
115 | }; | |
116 | ||
117 | // The valid values found in Ehdr e_ident[EI_VERSION] and e_version. | |
118 | ||
119 | enum | |
120 | { | |
121 | EV_NONE = 0, | |
122 | EV_CURRENT = 1 | |
123 | }; | |
124 | ||
125 | // The valid values found in Ehdr e_ident[EI_OSABI]. | |
126 | ||
127 | enum ELFOSABI | |
128 | { | |
129 | ELFOSABI_NONE = 0, | |
130 | ELFOSABI_HPUX = 1, | |
131 | ELFOSABI_NETBSD = 2, | |
132 | // ELFOSABI_LINUX is not listed in the ELF standard. | |
133 | ELFOSABI_LINUX = 3, | |
134 | // ELFOSABI_HURD is not listed in the ELF standard. | |
135 | ELFOSABI_HURD = 4, | |
136 | ELFOSABI_SOLARIS = 6, | |
137 | ELFOSABI_AIX = 7, | |
138 | ELFOSABI_IRIX = 8, | |
139 | ELFOSABI_FREEBSD = 9, | |
140 | ELFOSABI_TRU64 = 10, | |
141 | ELFOSABI_MODESTO = 11, | |
142 | ELFOSABI_OPENBSD = 12, | |
143 | ELFOSABI_OPENVMS = 13, | |
144 | ELFOSABI_NSK = 14, | |
145 | ELFOSABI_AROS = 15, | |
146 | // A GNU extension for the ARM. | |
147 | ELFOSABI_ARM = 97, | |
148 | // A GNU extension for the MSP. | |
149 | ELFOSABI_STANDALONE = 255 | |
150 | }; | |
151 | ||
152 | // The valid values found in the Ehdr e_type field. | |
153 | ||
154 | enum ET | |
155 | { | |
156 | ET_NONE = 0, | |
157 | ET_REL = 1, | |
158 | ET_EXEC = 2, | |
159 | ET_DYN = 3, | |
160 | ET_CORE = 4, | |
161 | ET_LOOS = 0xfe00, | |
162 | ET_HIOS = 0xfeff, | |
163 | ET_LOPROC = 0xff00, | |
164 | ET_HIPROC = 0xffff | |
165 | }; | |
166 | ||
167 | // The valid values found in the Ehdr e_machine field. | |
168 | ||
169 | enum EM | |
170 | { | |
171 | EM_NONE = 0, | |
172 | EM_M32 = 1, | |
173 | EM_SPARC = 2, | |
174 | EM_386 = 3, | |
175 | EM_68K = 4, | |
176 | EM_88K = 5, | |
177 | // 6 used to be EM_486 | |
178 | EM_860 = 7, | |
179 | EM_MIPS = 8, | |
180 | EM_S370 = 9, | |
181 | EM_MIPS_RS3_LE = 10, | |
182 | // 11 was the old Sparc V9 ABI. | |
183 | // 12 through 14 are reserved. | |
184 | EM_PARISC = 15, | |
185 | // 16 is reserved. | |
186 | // Some old PowerPC object files use 17. | |
187 | EM_VPP500 = 17, | |
188 | EM_SPARC32PLUS = 18, | |
189 | EM_960 = 19, | |
190 | EM_PPC = 20, | |
191 | EM_PPC64 = 21, | |
192 | EM_S390 = 22, | |
193 | // 23 through 35 are served. | |
194 | EM_V800 = 36, | |
195 | EM_FR20 = 37, | |
196 | EM_RH32 = 38, | |
197 | EM_RCE = 39, | |
198 | EM_ARM = 40, | |
199 | EM_ALPHA = 41, | |
200 | EM_SH = 42, | |
201 | EM_SPARCV9 = 43, | |
202 | EM_TRICORE = 44, | |
203 | EM_ARC = 45, | |
204 | EM_H8_300 = 46, | |
205 | EM_H8_300H = 47, | |
206 | EM_H8S = 48, | |
207 | EM_H8_500 = 49, | |
208 | EM_IA_64 = 50, | |
209 | EM_MIPS_X = 51, | |
210 | EM_COLDFIRE = 52, | |
211 | EM_68HC12 = 53, | |
212 | EM_MMA = 54, | |
213 | EM_PCP = 55, | |
214 | EM_NCPU = 56, | |
215 | EM_NDR1 = 57, | |
216 | EM_STARCORE = 58, | |
217 | EM_ME16 = 59, | |
218 | EM_ST100 = 60, | |
219 | EM_TINYJ = 61, | |
220 | EM_X86_64 = 62, | |
221 | EM_PDSP = 63, | |
222 | EM_PDP10 = 64, | |
223 | EM_PDP11 = 65, | |
224 | EM_FX66 = 66, | |
225 | EM_ST9PLUS = 67, | |
226 | EM_ST7 = 68, | |
227 | EM_68HC16 = 69, | |
228 | EM_68HC11 = 70, | |
229 | EM_68HC08 = 71, | |
230 | EM_68HC05 = 72, | |
231 | EM_SVX = 73, | |
232 | EM_ST19 = 74, | |
233 | EM_VAX = 75, | |
234 | EM_CRIS = 76, | |
235 | EM_JAVELIN = 77, | |
236 | EM_FIREPATH = 78, | |
237 | EM_ZSP = 79, | |
238 | EM_MMIX = 80, | |
239 | EM_HUANY = 81, | |
240 | EM_PRISM = 82, | |
241 | EM_AVR = 83, | |
242 | EM_FR30 = 84, | |
243 | EM_D10V = 85, | |
244 | EM_D30V = 86, | |
245 | EM_V850 = 87, | |
246 | EM_M32R = 88, | |
247 | EM_MN10300 = 89, | |
248 | EM_MN10200 = 90, | |
249 | EM_PJ = 91, | |
250 | EM_OPENRISC = 92, | |
251 | EM_ARC_A5 = 93, | |
252 | EM_XTENSA = 94, | |
253 | EM_VIDEOCORE = 95, | |
254 | EM_TMM_GPP = 96, | |
255 | EM_NS32K = 97, | |
256 | EM_TPC = 98, | |
257 | // Some old picoJava object files use 99 (EM_PJ is correct). | |
258 | EM_SNP1K = 99, | |
259 | EM_ST200 = 100, | |
260 | EM_IP2K = 101, | |
261 | EM_MAX = 102, | |
262 | EM_CR = 103, | |
263 | EM_F2MC16 = 104, | |
264 | EM_MSP430 = 105, | |
265 | EM_BLACKFIN = 106, | |
266 | EM_SE_C33 = 107, | |
267 | EM_SEP = 108, | |
268 | EM_ARCA = 109, | |
269 | EM_UNICORE = 110, | |
270 | EM_ALTERA_NIOS2 = 113, | |
271 | EM_CRX = 114, | |
272 | // The Morph MT. | |
273 | EM_MT = 0x2530, | |
274 | // DLX. | |
275 | EM_DLX = 0x5aa5, | |
276 | // FRV. | |
277 | EM_FRV = 0x5441, | |
278 | // Infineon Technologies 16-bit microcontroller with C166-V2 core. | |
279 | EM_X16X = 0x4688, | |
280 | // Xstorym16 | |
281 | EM_XSTORMY16 = 0xad45, | |
282 | // Renesas M32C | |
283 | EM_M32C = 0xfeb0, | |
284 | // Vitesse IQ2000 | |
285 | EM_IQ2000 = 0xfeba, | |
286 | // NIOS | |
287 | EM_NIOS32 = 0xfebb | |
288 | // Old AVR objects used 0x1057 (EM_AVR is correct). | |
289 | // Old MSP430 objects used 0x1059 (EM_MSP430 is correct). | |
290 | // Old FR30 objects used 0x3330 (EM_FR30 is correct). | |
291 | // Old OpenRISC objects used 0x3426 and 0x8472 (EM_OPENRISC is correct). | |
292 | // Old D10V objects used 0x7650 (EM_D10V is correct). | |
293 | // Old D30V objects used 0x7676 (EM_D30V is correct). | |
294 | // Old IP2X objects used 0x8217 (EM_IP2K is correct). | |
295 | // Old PowerPC objects used 0x9025 (EM_PPC is correct). | |
296 | // Old Alpha objects used 0x9026 (EM_ALPHA is correct). | |
297 | // Old M32R objects used 0x9041 (EM_M32R is correct). | |
298 | // Old V850 objects used 0x9080 (EM_V850 is correct). | |
299 | // Old S/390 objects used 0xa390 (EM_S390 is correct). | |
300 | // Old Xtensa objects used 0xabc7 (EM_XTENSA is correct). | |
301 | // Old MN10300 objects used 0xbeef (EM_MN10300 is correct). | |
302 | // Old MN10200 objects used 0xdead (EM_MN10200 is correct). | |
303 | }; | |
304 | ||
305 | // Special section indices. | |
306 | ||
307 | enum | |
308 | { | |
309 | SHN_UNDEF = 0, | |
310 | SHN_LORESERVE = 0xff00, | |
311 | SHN_LOPROC = 0xff00, | |
312 | SHN_HIPROC = 0xff1f, | |
313 | SHN_LOOS = 0xff20, | |
314 | SHN_HIOS = 0xff3f, | |
315 | SHN_ABS = 0xfff1, | |
316 | SHN_COMMON = 0xfff2, | |
317 | SHN_XINDEX = 0xffff, | |
318 | SHN_HIRESERVE = 0xffff | |
319 | }; | |
320 | ||
321 | // The valid values found in the Shdr sh_type field. | |
322 | ||
39081c14 | 323 | enum SHT |
bae7f79e ILT |
324 | { |
325 | SHT_NULL = 0, | |
326 | SHT_PROGBITS = 1, | |
327 | SHT_SYMTAB = 2, | |
328 | SHT_STRTAB = 3, | |
329 | SHT_RELA = 4, | |
330 | SHT_HASH = 5, | |
331 | SHT_DYNAMIC = 6, | |
332 | SHT_NOTE = 7, | |
333 | SHT_NOBITS = 8, | |
334 | SHT_REL = 9, | |
335 | SHT_SHLIB = 10, | |
336 | SHT_DYNSYM = 11, | |
337 | SHT_INIT_ARRAY = 14, | |
338 | SHT_FINI_ARRAY = 15, | |
339 | SHT_PREINIT_ARRAY = 16, | |
340 | SHT_GROUP = 17, | |
341 | SHT_SYMTAB_SHNDX = 18, | |
342 | SHT_LOOS = 0x60000000, | |
343 | SHT_HIOS = 0x6fffffff, | |
344 | SHT_LOPROC = 0x70000000, | |
345 | SHT_HIPROC = 0x7fffffff, | |
346 | SHT_LOUSER = 0x80000000, | |
347 | SHT_HIUSER = 0xffffffff, | |
348 | // The remaining values are not in the standard. | |
349 | // List of prelink dependencies. | |
350 | SHT_GNU_LIBLIST = 0x6ffffff7, | |
351 | // Versions defined by file. | |
352 | SHT_SUNW_verdef = 0x6ffffffd, | |
353 | SHT_GNU_verdef = 0x6ffffffd, | |
354 | // Versions needed by file. | |
355 | SHT_SUNW_verneed = 0x6ffffffe, | |
356 | SHT_GNU_verneed = 0x6ffffffe, | |
357 | // Symbol versions, | |
358 | SHT_SUNW_versym = 0x6fffffff, | |
359 | SHT_GNU_versym = 0x6fffffff, | |
360 | }; | |
361 | ||
362 | // The valid bit flags found in the Shdr sh_flags field. | |
363 | ||
39081c14 | 364 | enum SHF |
bae7f79e ILT |
365 | { |
366 | SHF_WRITE = 0x1, | |
367 | SHF_ALLOC = 0x2, | |
368 | SHF_EXECINSTR = 0x4, | |
369 | SHF_MERGE = 0x10, | |
370 | SHF_STRINGS = 0x20, | |
371 | SHF_INFO_LINK = 0x40, | |
372 | SHF_LINK_ORDER = 0x80, | |
373 | SHF_OS_NONCONFORMING = 0x100, | |
374 | SHF_GROUP = 0x200, | |
375 | SHF_TLS = 0x400, | |
376 | SHF_MASKOS = 0x0ff00000, | |
377 | SHF_MASKPROC = 0xf0000000 | |
378 | }; | |
379 | ||
380 | // Bit flags which appear in the first 32-bit word of the section data | |
381 | // of a SHT_GROUP section. | |
382 | ||
383 | enum | |
384 | { | |
385 | GRP_COMDAT = 0x1, | |
386 | GRP_MASKOS = 0x0ff00000, | |
387 | GRP_MASKPROC = 0xf0000000 | |
388 | }; | |
389 | ||
39081c14 ILT |
390 | // The valid values found in the Phdr p_type field. |
391 | ||
392 | enum PT | |
393 | { | |
394 | PT_NULL = 0, | |
395 | PT_LOAD = 1, | |
396 | PT_DYNAMIC = 2, | |
397 | PT_INTERP = 3, | |
398 | PT_NOTE = 4, | |
399 | PT_SHLIB = 5, | |
400 | PT_PHDR = 6, | |
401 | PT_TLS = 7, | |
402 | PT_LOOS = 0x60000000, | |
403 | PT_HIOS = 0x6fffffff, | |
404 | PT_LOPROC = 0x70000000, | |
405 | PT_HIPROC = 0x7fffffff, | |
406 | // The remaining values are not in the standard. | |
407 | // Frame unwind information. | |
408 | PT_GNU_EH_FRAME = 0x6474e550, | |
409 | PT_SUNW_EH_FRAME = 0x6474e550, | |
410 | // Stack flags. | |
411 | PT_GNU_STACK = 0x6474e551, | |
412 | // Read only after relocation. | |
413 | PT_GNU_RELRO = 0x6474e552 | |
414 | }; | |
415 | ||
416 | // The valid bit flags found in the Phdr p_flags field. | |
417 | ||
418 | enum PF | |
419 | { | |
420 | PF_X = 0x1, | |
421 | PF_W = 0x2, | |
422 | PF_R = 0x4, | |
423 | PF_MASKOS = 0x0ff00000, | |
424 | PF_MASKPROC = 0xf0000000 | |
425 | }; | |
426 | ||
bae7f79e ILT |
427 | // Symbol binding from Sym st_info field. |
428 | ||
429 | enum STB | |
430 | { | |
431 | STB_LOCAL = 0, | |
432 | STB_GLOBAL = 1, | |
433 | STB_WEAK = 2, | |
434 | STB_LOOS = 10, | |
435 | STB_HIOS = 12, | |
436 | STB_LOPROC = 13, | |
437 | STB_HIPROC = 15 | |
438 | }; | |
439 | ||
440 | // Symbol types from Sym st_info field. | |
441 | ||
442 | enum STT | |
443 | { | |
444 | STT_NOTYPE = 0, | |
445 | STT_OBJECT = 1, | |
446 | STT_FUNC = 2, | |
447 | STT_SECTION = 3, | |
448 | STT_FILE = 4, | |
449 | STT_COMMON = 5, | |
450 | STT_TLS = 6, | |
451 | STT_LOOS = 10, | |
452 | STT_HIOS = 12, | |
453 | STT_LOPROC = 13, | |
454 | STT_HIPROC = 15 | |
455 | }; | |
456 | ||
14bfc3f5 ILT |
457 | inline STB |
458 | elf_st_bind(unsigned char info) | |
459 | { | |
460 | return static_cast<STB>(info >> 4); | |
461 | } | |
462 | ||
463 | inline STT | |
464 | elf_st_type(unsigned char info) | |
465 | { | |
466 | return static_cast<STT>(info & 0xf); | |
467 | } | |
468 | ||
469 | inline unsigned char | |
470 | elf_st_info(STB bind, STT type) | |
471 | { | |
472 | return ((static_cast<unsigned char>(bind) << 4) | |
473 | + (static_cast<unsigned char>(type) & 0xf)); | |
474 | } | |
475 | ||
bae7f79e ILT |
476 | // Symbol visibility from Sym st_other field. |
477 | ||
478 | enum STV | |
479 | { | |
480 | STV_DEFAULT = 0, | |
481 | STV_INTERNAL = 1, | |
482 | STV_HIDDEN = 2, | |
483 | STV_PROTECTED = 3 | |
484 | }; | |
485 | ||
14bfc3f5 ILT |
486 | inline STV |
487 | elf_st_visibility(unsigned char other) | |
488 | { | |
489 | return static_cast<STV>(other & 0x3); | |
490 | } | |
491 | ||
492 | inline unsigned char | |
493 | elf_st_nonvis(unsigned char other) | |
494 | { | |
495 | return static_cast<STV>(other >> 2); | |
496 | } | |
497 | ||
1564db8d ILT |
498 | inline unsigned char |
499 | elf_st_other(STV vis, unsigned char nonvis) | |
500 | { | |
501 | return ((nonvis << 2) | |
502 | + (static_cast<unsigned char>(vis) & 3)); | |
503 | } | |
504 | ||
61ba1cf9 ILT |
505 | // Reloc information from Rel/Rela r_info field. |
506 | ||
507 | template<int size> | |
508 | unsigned int | |
509 | elf_r_sym(typename Elf_types<size>::Elf_WXword); | |
510 | ||
511 | template<> | |
512 | inline unsigned int | |
513 | elf_r_sym<32>(Elf_Word v) | |
514 | { | |
515 | return v >> 8; | |
516 | } | |
517 | ||
518 | template<> | |
519 | inline unsigned int | |
520 | elf_r_sym<64>(Elf_Xword v) | |
521 | { | |
522 | return v >> 32; | |
523 | } | |
524 | ||
525 | template<int size> | |
526 | unsigned int | |
527 | elf_r_type(typename Elf_types<size>::Elf_WXword); | |
528 | ||
529 | template<> | |
530 | inline unsigned int | |
531 | elf_r_type<32>(Elf_Word v) | |
532 | { | |
533 | return v & 0xff; | |
534 | } | |
535 | ||
536 | template<> | |
537 | inline unsigned int | |
538 | elf_r_type<64>(Elf_Xword v) | |
539 | { | |
540 | return v & 0xffffffff; | |
541 | } | |
542 | ||
543 | template<int size> | |
544 | typename Elf_types<size>::Elf_WXword | |
545 | elf_r_info(unsigned int s, unsigned int t); | |
546 | ||
547 | template<> | |
548 | inline Elf_Word | |
549 | elf_r_info<32>(unsigned int s, unsigned int t) | |
550 | { | |
551 | return (s << 8) + (t & 0xff); | |
552 | } | |
553 | ||
554 | template<> | |
555 | inline Elf_Xword | |
556 | elf_r_info<64>(unsigned int s, unsigned int t) | |
557 | { | |
558 | return (static_cast<Elf_Xword>(s) << 32) + (t & 0xffffffff); | |
559 | } | |
560 | ||
dbe717ef ILT |
561 | // Dynamic tags found in the PT_DYNAMIC segment. |
562 | ||
563 | enum DT | |
564 | { | |
565 | DT_NULL = 0, | |
566 | DT_NEEDED = 1, | |
567 | DT_PLTRELSZ = 2, | |
568 | DT_PLTGOT = 3, | |
569 | DT_HASH = 4, | |
570 | DT_STRTAB = 5, | |
571 | DT_SYMTAB = 6, | |
572 | DT_RELA = 7, | |
573 | DT_RELASZ = 8, | |
574 | DT_RELAENT = 9, | |
575 | DT_STRSZ = 10, | |
576 | DT_SYMENT = 11, | |
577 | DT_INIT = 12, | |
578 | DT_FINI = 13, | |
579 | DT_SONAME = 14, | |
580 | DT_RPATH = 15, | |
581 | DT_SYMBOLIC = 16, | |
582 | DT_REL = 17, | |
583 | DT_RELSZ = 18, | |
584 | DT_RELENT = 19, | |
585 | DT_PLTREL = 20, | |
586 | DT_DEBUG = 21, | |
587 | DT_TEXTREL = 22, | |
588 | DT_JMPREL = 23, | |
589 | DT_BIND_NOW = 24, | |
590 | DT_INIT_ARRAY = 25, | |
591 | DT_FINI_ARRAY = 26, | |
592 | DT_INIT_ARRAYSZ = 27, | |
593 | DT_FINI_ARRAYSZ = 28, | |
594 | DT_RUNPATH = 29, | |
595 | DT_FLAGS = 30, | |
596 | DT_ENCODING = 32, | |
597 | DT_PREINIT_ARRAY = 33, | |
598 | DT_PREINIT_ARRAYSZ = 33, | |
599 | DT_LOOS = 0x6000000d, | |
600 | DT_HIOS = 0x6ffff000, | |
601 | DT_LOPROC = 0x70000000, | |
602 | DT_HIPROC = 0x7fffffff, | |
603 | ||
604 | // The remaining values are extensions used by GNU or Solaris. | |
605 | DT_VALRNGLO = 0x6ffffd00, | |
606 | DT_GNU_PRELINKED = 0x6ffffdf5, | |
607 | DT_GNU_CONFLICTSZ = 0x6ffffdf6, | |
608 | DT_GNU_LIBLISTSZ = 0x6ffffdf7, | |
609 | DT_CHECKSUM = 0x6ffffdf8, | |
610 | DT_PLTPADSZ = 0x6ffffdf9, | |
611 | DT_MOVEENT = 0x6ffffdfa, | |
612 | DT_MOVESZ = 0x6ffffdfb, | |
613 | DT_FEATURE = 0x6ffffdfc, | |
614 | DT_POSFLAG_1 = 0x6ffffdfd, | |
615 | DT_SYMINSZ = 0x6ffffdfe, | |
616 | DT_SYMINENT = 0x6ffffdff, | |
617 | DT_VALRNGHI = 0x6ffffdff, | |
618 | ||
619 | DT_ADDRRNGLO = 0x6ffffe00, | |
620 | DT_GNU_HASH = 0x6ffffef5, | |
621 | DT_TLSDESC_PLT = 0x6ffffef6, | |
622 | DT_TLSDESC_GOT = 0x6ffffef7, | |
623 | DT_GNU_CONFLICT = 0x6ffffef8, | |
624 | DT_GNU_LIBLIST = 0x6ffffef9, | |
625 | DT_CONFIG = 0x6ffffefa, | |
626 | DT_DEPAUDIT = 0x6ffffefb, | |
627 | DT_AUDIT = 0x6ffffefc, | |
628 | DT_PLTPAD = 0x6ffffefd, | |
629 | DT_MOVETAB = 0x6ffffefe, | |
630 | DT_SYMINFO = 0x6ffffeff, | |
631 | DT_ADDRRNGHI = 0x6ffffeff, | |
632 | ||
633 | DT_RELACOUNT = 0x6ffffff9, | |
634 | DT_RELCOUNT = 0x6ffffffa, | |
635 | DT_FLAGS_1 = 0x6ffffffb, | |
636 | DT_VERDEF = 0x6ffffffc, | |
637 | DT_VERDEFNUM = 0x6ffffffd, | |
638 | DT_VERNEED = 0x6ffffffe, | |
639 | DT_VERNEEDNUM = 0x6fffffff, | |
640 | ||
641 | DT_VERSYM = 0x6ffffff0, | |
642 | ||
643 | DT_AUXILIARY = 0x7ffffffd, | |
644 | DT_USED = 0x7ffffffe, | |
645 | DT_FILTER = 0x7fffffff | |
646 | }; | |
647 | ||
648 | // Flags found in the DT_FLAGS dynamic element. | |
649 | ||
650 | enum DF | |
651 | { | |
652 | DF_ORIGIN = 0x1, | |
653 | DF_SYMBOLIC = 0x2, | |
654 | DF_TEXTREL = 0x4, | |
655 | DF_BIND_NOW = 0x8, | |
656 | DF_STATIC_TLS = 0x10 | |
657 | }; | |
658 | ||
659 | // Version numbers which appear in the vd_version field of a Verdef | |
660 | // structure. | |
661 | ||
662 | const int VER_DEF_NONE = 0; | |
663 | const int VER_DEF_CURRENT = 1; | |
664 | ||
665 | // Version numbers which appear in the vn_version field of a Verneed | |
666 | // structure. | |
667 | ||
668 | const int VER_NEED_NONE = 0; | |
669 | const int VER_NEED_CURRENT = 1; | |
670 | ||
671 | // Bit flags which appear in vd_flags of Verdef and vna_flags of | |
672 | // Vernaux. | |
673 | ||
674 | const int VER_FLG_BASE = 0x1; | |
675 | const int VER_FLG_WEAK = 0x2; | |
676 | ||
677 | // Special constants found in the SHT_GNU_versym entries. | |
678 | ||
679 | const int VER_NDX_LOCAL = 0; | |
680 | const int VER_NDX_GLOBAL = 1; | |
681 | ||
682 | // A SHT_GNU_versym section holds 16-bit words. This bit is set if | |
683 | // the symbol is hidden and can only be seen when referenced using an | |
684 | // explicit version number. This is a GNU extension. | |
685 | ||
686 | const int VERSYM_HIDDEN = 0x8000; | |
687 | ||
688 | // This is the mask for the rest of the data in a word read from a | |
689 | // SHT_GNU_versym section. | |
690 | ||
691 | const int VERSYM_VERSION = 0x7fff; | |
692 | ||
bae7f79e ILT |
693 | } // End namespace elfcpp. |
694 | ||
695 | // Include internal details after defining the types. | |
696 | #include "elfcpp_internal.h" | |
697 | ||
698 | namespace elfcpp | |
699 | { | |
700 | ||
701 | // The offset of the ELF file header in the ELF file. | |
702 | ||
703 | const int file_header_offset = 0; | |
704 | ||
705 | // ELF structure sizes. | |
706 | ||
707 | template<int size> | |
708 | struct Elf_sizes | |
709 | { | |
710 | // Size of ELF file header. | |
711 | static const int ehdr_size = sizeof(internal::Ehdr_data<size>); | |
61ba1cf9 ILT |
712 | // Size of ELF segment header. |
713 | static const int phdr_size = sizeof(internal::Phdr_data<size>); | |
bae7f79e ILT |
714 | // Size of ELF section header. |
715 | static const int shdr_size = sizeof(internal::Shdr_data<size>); | |
716 | // Size of ELF symbol table entry. | |
717 | static const int sym_size = sizeof(internal::Sym_data<size>); | |
61ba1cf9 ILT |
718 | // Sizes of ELF reloc entries. |
719 | static const int rel_size = sizeof(internal::Rel_data<size>); | |
720 | static const int rela_size = sizeof(internal::Rela_data<size>); | |
dbe717ef ILT |
721 | // Size of ELF dynamic entry. |
722 | static const int dyn_size = sizeof(internal::Dyn_data<size>); | |
14b31740 ILT |
723 | // Size of ELF version structures. |
724 | static const int verdef_size = sizeof(internal::Verdef_data); | |
725 | static const int verdaux_size = sizeof(internal::Verdaux_data); | |
726 | static const int verneed_size = sizeof(internal::Verneed_data); | |
727 | static const int vernaux_size = sizeof(internal::Vernaux_data); | |
bae7f79e ILT |
728 | }; |
729 | ||
730 | // Accessor class for the ELF file header. | |
731 | ||
732 | template<int size, bool big_endian> | |
733 | class Ehdr | |
734 | { | |
735 | public: | |
736 | Ehdr(const unsigned char* p) | |
737 | : p_(reinterpret_cast<const internal::Ehdr_data<size>*>(p)) | |
738 | { } | |
739 | ||
645f8123 ILT |
740 | template<typename File> |
741 | Ehdr(File* file, typename File::Location loc) | |
742 | : p_(reinterpret_cast<const internal::Ehdr_data<size>*>( | |
743 | file->view(loc.file_offset, loc.data_size).data())) | |
744 | { } | |
745 | ||
bae7f79e ILT |
746 | const unsigned char* |
747 | get_e_ident() const | |
748 | { return this->p_->e_ident; } | |
749 | ||
750 | Elf_Half | |
751 | get_e_type() const | |
8d9455b4 | 752 | { return Convert<16, big_endian>::convert_host(this->p_->e_type); } |
bae7f79e ILT |
753 | |
754 | Elf_Half | |
755 | get_e_machine() const | |
8d9455b4 | 756 | { return Convert<16, big_endian>::convert_host(this->p_->e_machine); } |
bae7f79e ILT |
757 | |
758 | Elf_Word | |
759 | get_e_version() const | |
8d9455b4 | 760 | { return Convert<32, big_endian>::convert_host(this->p_->e_version); } |
bae7f79e ILT |
761 | |
762 | typename Elf_types<size>::Elf_Addr | |
763 | get_e_entry() const | |
8d9455b4 | 764 | { return Convert<size, big_endian>::convert_host(this->p_->e_entry); } |
bae7f79e ILT |
765 | |
766 | typename Elf_types<size>::Elf_Off | |
767 | get_e_phoff() const | |
8d9455b4 | 768 | { return Convert<size, big_endian>::convert_host(this->p_->e_phoff); } |
bae7f79e ILT |
769 | |
770 | typename Elf_types<size>::Elf_Off | |
771 | get_e_shoff() const | |
8d9455b4 | 772 | { return Convert<size, big_endian>::convert_host(this->p_->e_shoff); } |
bae7f79e ILT |
773 | |
774 | Elf_Word | |
775 | get_e_flags() const | |
8d9455b4 | 776 | { return Convert<32, big_endian>::convert_host(this->p_->e_flags); } |
bae7f79e ILT |
777 | |
778 | Elf_Half | |
779 | get_e_ehsize() const | |
8d9455b4 | 780 | { return Convert<16, big_endian>::convert_host(this->p_->e_ehsize); } |
bae7f79e ILT |
781 | |
782 | Elf_Half | |
783 | get_e_phentsize() const | |
8d9455b4 | 784 | { return Convert<16, big_endian>::convert_host(this->p_->e_phentsize); } |
bae7f79e ILT |
785 | |
786 | Elf_Half | |
787 | get_e_phnum() const | |
8d9455b4 | 788 | { return Convert<16, big_endian>::convert_host(this->p_->e_phnum); } |
bae7f79e ILT |
789 | |
790 | Elf_Half | |
791 | get_e_shentsize() const | |
8d9455b4 | 792 | { return Convert<16, big_endian>::convert_host(this->p_->e_shentsize); } |
bae7f79e ILT |
793 | |
794 | Elf_Half | |
795 | get_e_shnum() const | |
8d9455b4 | 796 | { return Convert<16, big_endian>::convert_host(this->p_->e_shnum); } |
bae7f79e ILT |
797 | |
798 | Elf_Half | |
799 | get_e_shstrndx() const | |
8d9455b4 | 800 | { return Convert<16, big_endian>::convert_host(this->p_->e_shstrndx); } |
bae7f79e ILT |
801 | |
802 | private: | |
803 | const internal::Ehdr_data<size>* p_; | |
804 | }; | |
805 | ||
61ba1cf9 ILT |
806 | // Write class for the ELF file header. |
807 | ||
808 | template<int size, bool big_endian> | |
809 | class Ehdr_write | |
810 | { | |
811 | public: | |
812 | Ehdr_write(unsigned char* p) | |
813 | : p_(reinterpret_cast<internal::Ehdr_data<size>*>(p)) | |
814 | { } | |
815 | ||
816 | void | |
817 | put_e_ident(const unsigned char v[EI_NIDENT]) const | |
818 | { memcpy(this->p_->e_ident, v, EI_NIDENT); } | |
819 | ||
820 | void | |
821 | put_e_type(Elf_Half v) | |
8d9455b4 | 822 | { this->p_->e_type = Convert<16, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
823 | |
824 | void | |
825 | put_e_machine(Elf_Half v) | |
8d9455b4 | 826 | { this->p_->e_machine = Convert<16, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
827 | |
828 | void | |
829 | put_e_version(Elf_Word v) | |
8d9455b4 | 830 | { this->p_->e_version = Convert<32, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
831 | |
832 | void | |
833 | put_e_entry(typename Elf_types<size>::Elf_Addr v) | |
8d9455b4 | 834 | { this->p_->e_entry = Convert<size, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
835 | |
836 | void | |
837 | put_e_phoff(typename Elf_types<size>::Elf_Off v) | |
8d9455b4 | 838 | { this->p_->e_phoff = Convert<size, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
839 | |
840 | void | |
841 | put_e_shoff(typename Elf_types<size>::Elf_Off v) | |
8d9455b4 | 842 | { this->p_->e_shoff = Convert<size, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
843 | |
844 | void | |
845 | put_e_flags(Elf_Word v) | |
8d9455b4 | 846 | { this->p_->e_flags = Convert<32, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
847 | |
848 | void | |
849 | put_e_ehsize(Elf_Half v) | |
8d9455b4 | 850 | { this->p_->e_ehsize = Convert<16, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
851 | |
852 | void | |
853 | put_e_phentsize(Elf_Half v) | |
8d9455b4 | 854 | { this->p_->e_phentsize = Convert<16, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
855 | |
856 | void | |
857 | put_e_phnum(Elf_Half v) | |
8d9455b4 | 858 | { this->p_->e_phnum = Convert<16, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
859 | |
860 | void | |
861 | put_e_shentsize(Elf_Half v) | |
8d9455b4 | 862 | { this->p_->e_shentsize = Convert<16, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
863 | |
864 | void | |
865 | put_e_shnum(Elf_Half v) | |
8d9455b4 | 866 | { this->p_->e_shnum = Convert<16, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
867 | |
868 | void | |
869 | put_e_shstrndx(Elf_Half v) | |
8d9455b4 | 870 | { this->p_->e_shstrndx = Convert<16, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
871 | |
872 | private: | |
873 | internal::Ehdr_data<size>* p_; | |
874 | }; | |
875 | ||
bae7f79e ILT |
876 | // Accessor class for an ELF section header. |
877 | ||
878 | template<int size, bool big_endian> | |
879 | class Shdr | |
880 | { | |
881 | public: | |
882 | Shdr(const unsigned char* p) | |
883 | : p_(reinterpret_cast<const internal::Shdr_data<size>*>(p)) | |
884 | { } | |
885 | ||
645f8123 ILT |
886 | template<typename File> |
887 | Shdr(File* file, typename File::Location loc) | |
888 | : p_(reinterpret_cast<const internal::Shdr_data<size>*>( | |
889 | file->view(loc.file_offset, loc.data_size).data())) | |
890 | { } | |
891 | ||
bae7f79e ILT |
892 | Elf_Word |
893 | get_sh_name() const | |
8d9455b4 | 894 | { return Convert<32, big_endian>::convert_host(this->p_->sh_name); } |
bae7f79e ILT |
895 | |
896 | Elf_Word | |
897 | get_sh_type() const | |
8d9455b4 | 898 | { return Convert<32, big_endian>::convert_host(this->p_->sh_type); } |
bae7f79e ILT |
899 | |
900 | typename Elf_types<size>::Elf_WXword | |
901 | get_sh_flags() const | |
8d9455b4 | 902 | { return Convert<size, big_endian>::convert_host(this->p_->sh_flags); } |
bae7f79e ILT |
903 | |
904 | typename Elf_types<size>::Elf_Addr | |
905 | get_sh_addr() const | |
8d9455b4 | 906 | { return Convert<size, big_endian>::convert_host(this->p_->sh_addr); } |
bae7f79e ILT |
907 | |
908 | typename Elf_types<size>::Elf_Off | |
909 | get_sh_offset() const | |
8d9455b4 | 910 | { return Convert<size, big_endian>::convert_host(this->p_->sh_offset); } |
bae7f79e ILT |
911 | |
912 | typename Elf_types<size>::Elf_WXword | |
913 | get_sh_size() const | |
8d9455b4 | 914 | { return Convert<size, big_endian>::convert_host(this->p_->sh_size); } |
bae7f79e ILT |
915 | |
916 | Elf_Word | |
917 | get_sh_link() const | |
8d9455b4 | 918 | { return Convert<32, big_endian>::convert_host(this->p_->sh_link); } |
bae7f79e ILT |
919 | |
920 | Elf_Word | |
921 | get_sh_info() const | |
8d9455b4 | 922 | { return Convert<32, big_endian>::convert_host(this->p_->sh_info); } |
bae7f79e ILT |
923 | |
924 | typename Elf_types<size>::Elf_WXword | |
925 | get_sh_addralign() const | |
926 | { return | |
8d9455b4 | 927 | Convert<size, big_endian>::convert_host(this->p_->sh_addralign); } |
bae7f79e ILT |
928 | |
929 | typename Elf_types<size>::Elf_WXword | |
930 | get_sh_entsize() const | |
8d9455b4 | 931 | { return Convert<size, big_endian>::convert_host(this->p_->sh_entsize); } |
bae7f79e ILT |
932 | |
933 | private: | |
934 | const internal::Shdr_data<size>* p_; | |
935 | }; | |
936 | ||
61ba1cf9 ILT |
937 | // Write class for an ELF section header. |
938 | ||
939 | template<int size, bool big_endian> | |
940 | class Shdr_write | |
941 | { | |
942 | public: | |
943 | Shdr_write(unsigned char* p) | |
944 | : p_(reinterpret_cast<internal::Shdr_data<size>*>(p)) | |
945 | { } | |
946 | ||
947 | void | |
948 | put_sh_name(Elf_Word v) | |
8d9455b4 | 949 | { this->p_->sh_name = Convert<32, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
950 | |
951 | void | |
952 | put_sh_type(Elf_Word v) | |
8d9455b4 | 953 | { this->p_->sh_type = Convert<32, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
954 | |
955 | void | |
956 | put_sh_flags(typename Elf_types<size>::Elf_WXword v) | |
8d9455b4 | 957 | { this->p_->sh_flags = Convert<size, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
958 | |
959 | void | |
960 | put_sh_addr(typename Elf_types<size>::Elf_Addr v) | |
8d9455b4 | 961 | { this->p_->sh_addr = Convert<size, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
962 | |
963 | void | |
964 | put_sh_offset(typename Elf_types<size>::Elf_Off v) | |
8d9455b4 | 965 | { this->p_->sh_offset = Convert<size, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
966 | |
967 | void | |
968 | put_sh_size(typename Elf_types<size>::Elf_WXword v) | |
8d9455b4 | 969 | { this->p_->sh_size = Convert<size, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
970 | |
971 | void | |
972 | put_sh_link(Elf_Word v) | |
8d9455b4 | 973 | { this->p_->sh_link = Convert<32, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
974 | |
975 | void | |
976 | put_sh_info(Elf_Word v) | |
8d9455b4 | 977 | { this->p_->sh_info = Convert<32, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
978 | |
979 | void | |
980 | put_sh_addralign(typename Elf_types<size>::Elf_WXword v) | |
8d9455b4 | 981 | { this->p_->sh_addralign = Convert<size, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
982 | |
983 | void | |
984 | put_sh_entsize(typename Elf_types<size>::Elf_WXword v) | |
8d9455b4 | 985 | { this->p_->sh_entsize = Convert<size, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
986 | |
987 | private: | |
988 | internal::Shdr_data<size>* p_; | |
989 | }; | |
990 | ||
39081c14 ILT |
991 | // Accessor class for an ELF segment header. |
992 | ||
993 | template<int size, bool big_endian> | |
994 | class Phdr | |
995 | { | |
996 | public: | |
997 | Phdr(const unsigned char* p) | |
998 | : p_(reinterpret_cast<const internal::Phdr_data<size>*>(p)) | |
999 | { } | |
1000 | ||
645f8123 ILT |
1001 | template<typename File> |
1002 | Phdr(File* file, typename File::Location loc) | |
1003 | : p_(reinterpret_cast<internal::Phdr_data<size>*>( | |
1004 | file->view(loc.file_offset, loc.data_size).data())) | |
1005 | { } | |
1006 | ||
39081c14 ILT |
1007 | Elf_Word |
1008 | get_p_type() const | |
8d9455b4 | 1009 | { return Convert<32, big_endian>::convert_host(this->p_->p_type); } |
39081c14 ILT |
1010 | |
1011 | typename Elf_types<size>::Elf_Off | |
1012 | get_p_offset() const | |
8d9455b4 | 1013 | { return Convert<size, big_endian>::convert_host(this->p_->p_offset); } |
39081c14 ILT |
1014 | |
1015 | typename Elf_types<size>::Elf_Addr | |
1016 | get_p_vaddr() const | |
8d9455b4 | 1017 | { return Convert<size, big_endian>::convert_host(this->p_->p_vaddr); } |
39081c14 ILT |
1018 | |
1019 | typename Elf_types<size>::Elf_Addr | |
1020 | get_p_paddr() const | |
8d9455b4 | 1021 | { return Convert<size, big_endian>::convert_host(this->p_->p_paddr); } |
39081c14 ILT |
1022 | |
1023 | typename Elf_types<size>::Elf_WXword | |
1024 | get_p_filesz() const | |
8d9455b4 | 1025 | { return Convert<size, big_endian>::convert_host(this->p_->p_filesz); } |
39081c14 ILT |
1026 | |
1027 | typename Elf_types<size>::Elf_WXword | |
1028 | get_p_memsz() const | |
8d9455b4 | 1029 | { return Convert<size, big_endian>::convert_host(this->p_->p_memsz); } |
39081c14 ILT |
1030 | |
1031 | Elf_Word | |
1032 | get_p_flags() const | |
8d9455b4 | 1033 | { return Convert<32, big_endian>::convert_host(this->p_->p_flags); } |
39081c14 ILT |
1034 | |
1035 | typename Elf_types<size>::Elf_WXword | |
1036 | get_p_align() const | |
8d9455b4 | 1037 | { return Convert<size, big_endian>::convert_host(this->p_->p_align); } |
39081c14 ILT |
1038 | |
1039 | private: | |
1040 | const internal::Phdr_data<size>* p_; | |
1041 | }; | |
1042 | ||
61ba1cf9 ILT |
1043 | // Write class for an ELF segment header. |
1044 | ||
1045 | template<int size, bool big_endian> | |
1046 | class Phdr_write | |
1047 | { | |
1048 | public: | |
1049 | Phdr_write(unsigned char* p) | |
1050 | : p_(reinterpret_cast<internal::Phdr_data<size>*>(p)) | |
1051 | { } | |
1052 | ||
1053 | void | |
1054 | put_p_type(Elf_Word v) | |
8d9455b4 | 1055 | { this->p_->p_type = Convert<32, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
1056 | |
1057 | void | |
1058 | put_p_offset(typename Elf_types<size>::Elf_Off v) | |
8d9455b4 | 1059 | { this->p_->p_offset = Convert<size, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
1060 | |
1061 | void | |
1062 | put_p_vaddr(typename Elf_types<size>::Elf_Addr v) | |
8d9455b4 | 1063 | { this->p_->p_vaddr = Convert<size, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
1064 | |
1065 | void | |
1066 | put_p_paddr(typename Elf_types<size>::Elf_Addr v) | |
8d9455b4 | 1067 | { this->p_->p_paddr = Convert<size, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
1068 | |
1069 | void | |
1070 | put_p_filesz(typename Elf_types<size>::Elf_WXword v) | |
8d9455b4 | 1071 | { this->p_->p_filesz = Convert<size, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
1072 | |
1073 | void | |
1074 | put_p_memsz(typename Elf_types<size>::Elf_WXword v) | |
8d9455b4 | 1075 | { this->p_->p_memsz = Convert<size, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
1076 | |
1077 | void | |
1078 | put_p_flags(Elf_Word v) | |
8d9455b4 | 1079 | { this->p_->p_flags = Convert<32, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
1080 | |
1081 | void | |
1082 | put_p_align(typename Elf_types<size>::Elf_WXword v) | |
8d9455b4 | 1083 | { this->p_->p_align = Convert<size, big_endian>::convert_host(v); } |
61ba1cf9 ILT |
1084 | |
1085 | private: | |
1086 | internal::Phdr_data<size>* p_; | |
1087 | }; | |
1088 | ||
bae7f79e ILT |
1089 | // Accessor class for an ELF symbol table entry. |
1090 | ||
1091 | template<int size, bool big_endian> | |
1092 | class Sym | |
1093 | { | |
1094 | public: | |
1095 | Sym(const unsigned char* p) | |
1096 | : p_(reinterpret_cast<const internal::Sym_data<size>*>(p)) | |
1097 | { } | |
1098 | ||
645f8123 ILT |
1099 | template<typename File> |
1100 | Sym(File* file, typename File::Location loc) | |
1101 | : p_(reinterpret_cast<const internal::Sym_data<size>*>( | |
1102 | file->view(loc.file_offset, loc.data_size).data())) | |
1103 | { } | |
1104 | ||
bae7f79e ILT |
1105 | Elf_Word |
1106 | get_st_name() const | |
8d9455b4 | 1107 | { return Convert<32, big_endian>::convert_host(this->p_->st_name); } |
bae7f79e ILT |
1108 | |
1109 | typename Elf_types<size>::Elf_Addr | |
1110 | get_st_value() const | |
8d9455b4 | 1111 | { return Convert<size, big_endian>::convert_host(this->p_->st_value); } |
bae7f79e ILT |
1112 | |
1113 | typename Elf_types<size>::Elf_WXword | |
1114 | get_st_size() const | |
8d9455b4 | 1115 | { return Convert<size, big_endian>::convert_host(this->p_->st_size); } |
bae7f79e ILT |
1116 | |
1117 | unsigned char | |
1118 | get_st_info() const | |
1119 | { return this->p_->st_info; } | |
1120 | ||
14bfc3f5 ILT |
1121 | STB |
1122 | get_st_bind() const | |
1123 | { return elf_st_bind(this->get_st_info()); } | |
1124 | ||
1125 | STT | |
1126 | get_st_type() const | |
1127 | { return elf_st_type(this->get_st_info()); } | |
1128 | ||
bae7f79e ILT |
1129 | unsigned char |
1130 | get_st_other() const | |
1131 | { return this->p_->st_other; } | |
1132 | ||
14bfc3f5 ILT |
1133 | STV |
1134 | get_st_visibility() const | |
1135 | { return elf_st_visibility(this->get_st_other()); } | |
1136 | ||
1137 | unsigned char | |
1138 | get_st_nonvis() const | |
1139 | { return elf_st_nonvis(this->get_st_other()); } | |
1140 | ||
bae7f79e ILT |
1141 | Elf_Half |
1142 | get_st_shndx() const | |
8d9455b4 | 1143 | { return Convert<16, big_endian>::convert_host(this->p_->st_shndx); } |
bae7f79e ILT |
1144 | |
1145 | private: | |
1146 | const internal::Sym_data<size>* p_; | |
1147 | }; | |
1148 | ||
1564db8d ILT |
1149 | // Writer class for an ELF symbol table entry. |
1150 | ||
1151 | template<int size, bool big_endian> | |
1152 | class Sym_write | |
1153 | { | |
1154 | public: | |
1155 | Sym_write(unsigned char* p) | |
1156 | : p_(reinterpret_cast<internal::Sym_data<size>*>(p)) | |
1157 | { } | |
1158 | ||
1159 | void | |
1160 | put_st_name(Elf_Word v) | |
8d9455b4 | 1161 | { this->p_->st_name = Convert<32, big_endian>::convert_host(v); } |
1564db8d ILT |
1162 | |
1163 | void | |
1164 | put_st_value(typename Elf_types<size>::Elf_Addr v) | |
8d9455b4 | 1165 | { this->p_->st_value = Convert<size, big_endian>::convert_host(v); } |
1564db8d ILT |
1166 | |
1167 | void | |
1168 | put_st_size(typename Elf_types<size>::Elf_WXword v) | |
8d9455b4 | 1169 | { this->p_->st_size = Convert<size, big_endian>::convert_host(v); } |
1564db8d ILT |
1170 | |
1171 | void | |
1172 | put_st_info(unsigned char v) | |
1173 | { this->p_->st_info = v; } | |
1174 | ||
1175 | void | |
1176 | put_st_info(STB bind, STT type) | |
1177 | { this->p_->st_info = elf_st_info(bind, type); } | |
1178 | ||
1179 | void | |
1180 | put_st_other(unsigned char v) | |
1181 | { this->p_->st_other = v; } | |
1182 | ||
1183 | void | |
1184 | put_st_other(STV vis, unsigned char nonvis) | |
1185 | { this->p_->st_other = elf_st_other(vis, nonvis); } | |
1186 | ||
1187 | void | |
1188 | put_st_shndx(Elf_Half v) | |
8d9455b4 | 1189 | { this->p_->st_shndx = Convert<16, big_endian>::convert_host(v); } |
1564db8d ILT |
1190 | |
1191 | Sym<size, big_endian> | |
1192 | sym() | |
1193 | { return Sym<size, big_endian>(reinterpret_cast<unsigned char*>(this->p_)); } | |
1194 | ||
1195 | private: | |
1196 | internal::Sym_data<size>* p_; | |
1197 | }; | |
1198 | ||
c06b7b0b | 1199 | // Accessor classes for an ELF REL relocation entry. |
61ba1cf9 ILT |
1200 | |
1201 | template<int size, bool big_endian> | |
1202 | class Rel | |
1203 | { | |
1204 | public: | |
1205 | Rel(const unsigned char* p) | |
1206 | : p_(reinterpret_cast<const internal::Rel_data<size>*>(p)) | |
1207 | { } | |
1208 | ||
645f8123 ILT |
1209 | template<typename File> |
1210 | Rel(File* file, typename File::Location loc) | |
1211 | : p_(reinterpret_cast<const internal::Rel_data<size>*>( | |
1212 | file->view(loc.file_offset, loc.data_size).data())) | |
1213 | { } | |
1214 | ||
61ba1cf9 ILT |
1215 | typename Elf_types<size>::Elf_Addr |
1216 | get_r_offset() const | |
8d9455b4 | 1217 | { return Convert<size, big_endian>::convert_host(this->p_->r_offset); } |
61ba1cf9 ILT |
1218 | |
1219 | typename Elf_types<size>::Elf_WXword | |
1220 | get_r_info() const | |
8d9455b4 | 1221 | { return Convert<size, big_endian>::convert_host(this->p_->r_info); } |
61ba1cf9 ILT |
1222 | |
1223 | private: | |
1224 | const internal::Rel_data<size>* p_; | |
1225 | }; | |
1226 | ||
c06b7b0b ILT |
1227 | // Writer class for an ELF Rel relocation. |
1228 | ||
1229 | template<int size, bool big_endian> | |
1230 | class Rel_write | |
1231 | { | |
1232 | public: | |
1233 | Rel_write(unsigned char* p) | |
1234 | : p_(reinterpret_cast<internal::Rel_data<size>*>(p)) | |
1235 | { } | |
1236 | ||
1237 | void | |
1238 | put_r_offset(typename Elf_types<size>::Elf_Addr v) | |
1239 | { this->p_->r_offset = Convert<size, big_endian>::convert_host(v); } | |
1240 | ||
1241 | void | |
1242 | put_r_info(typename Elf_types<size>::Elf_WXword v) | |
1243 | { this->p_->r_info = Convert<size, big_endian>::convert_host(v); } | |
1244 | ||
1245 | private: | |
1246 | internal::Rel_data<size>* p_; | |
1247 | }; | |
1248 | ||
1249 | // Accessor class for an ELF Rela relocation. | |
1250 | ||
61ba1cf9 ILT |
1251 | template<int size, bool big_endian> |
1252 | class Rela | |
1253 | { | |
1254 | public: | |
1255 | Rela(const unsigned char* p) | |
1256 | : p_(reinterpret_cast<const internal::Rela_data<size>*>(p)) | |
1257 | { } | |
1258 | ||
645f8123 ILT |
1259 | template<typename File> |
1260 | Rela(File* file, typename File::Location loc) | |
1261 | : p_(reinterpret_cast<const internal::Rela_data<size>*>( | |
1262 | file->view(loc.file_offset, loc.data_size).data())) | |
1263 | { } | |
1264 | ||
61ba1cf9 ILT |
1265 | typename Elf_types<size>::Elf_Addr |
1266 | get_r_offset() const | |
8d9455b4 | 1267 | { return Convert<size, big_endian>::convert_host(this->p_->r_offset); } |
61ba1cf9 ILT |
1268 | |
1269 | typename Elf_types<size>::Elf_WXword | |
1270 | get_r_info() const | |
8d9455b4 | 1271 | { return Convert<size, big_endian>::convert_host(this->p_->r_info); } |
61ba1cf9 ILT |
1272 | |
1273 | typename Elf_types<size>::Elf_Swxword | |
1274 | get_r_addend() const | |
8d9455b4 | 1275 | { return Convert<size, big_endian>::convert_host(this->p_->r_addend); } |
61ba1cf9 ILT |
1276 | |
1277 | private: | |
1278 | const internal::Rela_data<size>* p_; | |
1279 | }; | |
1280 | ||
c06b7b0b ILT |
1281 | // Writer class for an ELF Rela relocation. |
1282 | ||
1283 | template<int size, bool big_endian> | |
1284 | class Rela_write | |
1285 | { | |
1286 | public: | |
1287 | Rela_write(unsigned char* p) | |
1288 | : p_(reinterpret_cast<internal::Rela_data<size>*>(p)) | |
1289 | { } | |
1290 | ||
1291 | void | |
1292 | put_r_offset(typename Elf_types<size>::Elf_Addr v) | |
1293 | { this->p_->r_offset = Convert<size, big_endian>::convert_host(v); } | |
1294 | ||
1295 | void | |
1296 | put_r_info(typename Elf_types<size>::Elf_WXword v) | |
1297 | { this->p_->r_info = Convert<size, big_endian>::convert_host(v); } | |
1298 | ||
1299 | void | |
1300 | put_r_addend(typename Elf_types<size>::Elf_Swxword v) | |
1301 | { this->p_->r_addend = Convert<size, big_endian>::convert_host(v); } | |
1302 | ||
1303 | private: | |
1304 | internal::Rela_data<size>* p_; | |
1305 | }; | |
1306 | ||
dbe717ef ILT |
1307 | // Accessor classes for entries in the ELF SHT_DYNAMIC section aka |
1308 | // PT_DYNAMIC segment. | |
1309 | ||
1310 | template<int size, bool big_endian> | |
1311 | class Dyn | |
1312 | { | |
1313 | public: | |
1314 | Dyn(const unsigned char* p) | |
1315 | : p_(reinterpret_cast<const internal::Dyn_data<size>*>(p)) | |
1316 | { } | |
1317 | ||
1318 | template<typename File> | |
1319 | Dyn(File* file, typename File::Location loc) | |
1320 | : p_(reinterpret_cast<const internal::Dyn_data<size>*>( | |
1321 | file->view(loc.file_offset, loc.data_size).data())) | |
1322 | { } | |
1323 | ||
1324 | typename Elf_types<size>::Elf_Swxword | |
1325 | get_d_tag() const | |
1326 | { return Convert<size, big_endian>::convert_host(this->p_->d_tag); } | |
1327 | ||
1328 | typename Elf_types<size>::Elf_WXword | |
1329 | get_d_val() const | |
1330 | { return Convert<size, big_endian>::convert_host(this->p_->d_val); } | |
1331 | ||
1332 | typename Elf_types<size>::Elf_Addr | |
1333 | get_d_ptr() const | |
1334 | { return Convert<size, big_endian>::convert_host(this->p_->d_val); } | |
1335 | ||
1336 | private: | |
1337 | const internal::Dyn_data<size>* p_; | |
1338 | }; | |
1339 | ||
a3ad94ed ILT |
1340 | // Write class for an entry in the SHT_DYNAMIC section. |
1341 | ||
1342 | template<int size, bool big_endian> | |
1343 | class Dyn_write | |
1344 | { | |
1345 | public: | |
1346 | Dyn_write(unsigned char* p) | |
1347 | : p_(reinterpret_cast<internal::Dyn_data<size>*>(p)) | |
1348 | { } | |
1349 | ||
1350 | void | |
1351 | put_d_tag(typename Elf_types<size>::Elf_Swxword v) | |
1352 | { this->p_->d_tag = Convert<size, big_endian>::convert_host(v); } | |
1353 | ||
1354 | void | |
1355 | put_d_val(typename Elf_types<size>::Elf_WXword v) | |
1356 | { this->p_->d_val = Convert<size, big_endian>::convert_host(v); } | |
1357 | ||
1358 | void | |
1359 | put_d_ptr(typename Elf_types<size>::Elf_Addr v) | |
1360 | { this->p_->d_val = Convert<size, big_endian>::convert_host(v); } | |
1361 | ||
1362 | private: | |
1363 | internal::Dyn_data<size>* p_; | |
1364 | }; | |
1365 | ||
dbe717ef ILT |
1366 | // Accessor classes for entries in the ELF SHT_GNU_verdef section. |
1367 | ||
1368 | template<int size, bool big_endian> | |
1369 | class Verdef | |
1370 | { | |
1371 | public: | |
1372 | Verdef(const unsigned char* p) | |
1373 | : p_(reinterpret_cast<const internal::Verdef_data*>(p)) | |
1374 | { } | |
1375 | ||
1376 | template<typename File> | |
1377 | Verdef(File* file, typename File::Location loc) | |
1378 | : p_(reinterpret_cast<const internal::Verdef_data*>( | |
1379 | file->view(loc.file_offset, loc.data_size).data())) | |
1380 | { } | |
1381 | ||
1382 | Elf_Half | |
1383 | get_vd_version() const | |
1384 | { return Convert<16, big_endian>::convert_host(this->p_->vd_version); } | |
1385 | ||
1386 | Elf_Half | |
1387 | get_vd_flags() const | |
1388 | { return Convert<16, big_endian>::convert_host(this->p_->vd_flags); } | |
1389 | ||
1390 | Elf_Half | |
1391 | get_vd_ndx() const | |
1392 | { return Convert<16, big_endian>::convert_host(this->p_->vd_ndx); } | |
1393 | ||
1394 | Elf_Half | |
1395 | get_vd_cnt() const | |
1396 | { return Convert<16, big_endian>::convert_host(this->p_->vd_cnt); } | |
1397 | ||
1398 | Elf_Word | |
1399 | get_vd_hash() const | |
1400 | { return Convert<32, big_endian>::convert_host(this->p_->vd_hash); } | |
1401 | ||
1402 | Elf_Word | |
1403 | get_vd_aux() const | |
1404 | { return Convert<32, big_endian>::convert_host(this->p_->vd_aux); } | |
1405 | ||
1406 | Elf_Word | |
1407 | get_vd_next() const | |
1408 | { return Convert<32, big_endian>::convert_host(this->p_->vd_next); } | |
1409 | ||
1410 | private: | |
1411 | const internal::Verdef_data* p_; | |
1412 | }; | |
1413 | ||
14b31740 ILT |
1414 | template<int size, bool big_endian> |
1415 | class Verdef_write | |
1416 | { | |
1417 | public: | |
1418 | Verdef_write(unsigned char* p) | |
1419 | : p_(reinterpret_cast<internal::Verdef_data*>(p)) | |
1420 | { } | |
1421 | ||
1422 | void | |
1423 | set_vd_version(Elf_Half v) | |
1424 | { this->p_->vd_version = Convert<16, big_endian>::convert_host(v); } | |
1425 | ||
1426 | void | |
1427 | set_vd_flags(Elf_Half v) | |
1428 | { this->p_->vd_flags = Convert<16, big_endian>::convert_host(v); } | |
1429 | ||
1430 | void | |
1431 | set_vd_ndx(Elf_Half v) | |
1432 | { this->p_->vd_ndx = Convert<16, big_endian>::convert_host(v); } | |
1433 | ||
1434 | void | |
1435 | set_vd_cnt(Elf_Half v) | |
1436 | { this->p_->vd_cnt = Convert<16, big_endian>::convert_host(v); } | |
1437 | ||
1438 | void | |
1439 | set_vd_hash(Elf_Word v) | |
1440 | { this->p_->vd_hash = Convert<32, big_endian>::convert_host(v); } | |
1441 | ||
1442 | void | |
1443 | set_vd_aux(Elf_Word v) | |
1444 | { this->p_->vd_aux = Convert<32, big_endian>::convert_host(v); } | |
1445 | ||
1446 | void | |
1447 | set_vd_next(Elf_Word v) | |
1448 | { this->p_->vd_next = Convert<32, big_endian>::convert_host(v); } | |
1449 | ||
1450 | private: | |
1451 | internal::Verdef_data* p_; | |
1452 | }; | |
1453 | ||
dbe717ef ILT |
1454 | // Accessor classes for auxiliary entries in the ELF SHT_GNU_verdef |
1455 | // section. | |
1456 | ||
1457 | template<int size, bool big_endian> | |
1458 | class Verdaux | |
1459 | { | |
1460 | public: | |
1461 | Verdaux(const unsigned char* p) | |
1462 | : p_(reinterpret_cast<const internal::Verdaux_data*>(p)) | |
1463 | { } | |
1464 | ||
1465 | template<typename File> | |
1466 | Verdaux(File* file, typename File::Location loc) | |
1467 | : p_(reinterpret_cast<const internal::Verdaux_data*>( | |
1468 | file->view(loc.file_offset, loc.data_size).data())) | |
1469 | { } | |
1470 | ||
1471 | Elf_Word | |
1472 | get_vda_name() const | |
1473 | { return Convert<32, big_endian>::convert_host(this->p_->vda_name); } | |
1474 | ||
1475 | Elf_Word | |
1476 | get_vda_next() const | |
1477 | { return Convert<32, big_endian>::convert_host(this->p_->vda_next); } | |
1478 | ||
1479 | private: | |
1480 | const internal::Verdaux_data* p_; | |
1481 | }; | |
1482 | ||
14b31740 ILT |
1483 | template<int size, bool big_endian> |
1484 | class Verdaux_write | |
1485 | { | |
1486 | public: | |
1487 | Verdaux_write(unsigned char* p) | |
1488 | : p_(reinterpret_cast<internal::Verdaux_data*>(p)) | |
1489 | { } | |
1490 | ||
1491 | void | |
1492 | set_vda_name(Elf_Word v) | |
1493 | { this->p_->vda_name = Convert<32, big_endian>::convert_host(v); } | |
1494 | ||
1495 | void | |
1496 | set_vda_next(Elf_Word v) | |
1497 | { this->p_->vda_next = Convert<32, big_endian>::convert_host(v); } | |
1498 | ||
1499 | private: | |
1500 | internal::Verdaux_data* p_; | |
1501 | }; | |
1502 | ||
dbe717ef ILT |
1503 | // Accessor classes for entries in the ELF SHT_GNU_verneed section. |
1504 | ||
1505 | template<int size, bool big_endian> | |
1506 | class Verneed | |
1507 | { | |
1508 | public: | |
1509 | Verneed(const unsigned char* p) | |
1510 | : p_(reinterpret_cast<const internal::Verneed_data*>(p)) | |
1511 | { } | |
1512 | ||
1513 | template<typename File> | |
1514 | Verneed(File* file, typename File::Location loc) | |
1515 | : p_(reinterpret_cast<const internal::Verneed_data*>( | |
1516 | file->view(loc.file_offset, loc.data_size).data())) | |
1517 | { } | |
1518 | ||
1519 | Elf_Half | |
1520 | get_vn_version() const | |
1521 | { return Convert<16, big_endian>::convert_host(this->p_->vn_version); } | |
1522 | ||
1523 | Elf_Half | |
1524 | get_vn_cnt() const | |
1525 | { return Convert<16, big_endian>::convert_host(this->p_->vn_cnt); } | |
1526 | ||
1527 | Elf_Word | |
1528 | get_vn_file() const | |
1529 | { return Convert<32, big_endian>::convert_host(this->p_->vn_file); } | |
1530 | ||
1531 | Elf_Word | |
1532 | get_vn_aux() const | |
1533 | { return Convert<32, big_endian>::convert_host(this->p_->vn_aux); } | |
1534 | ||
1535 | Elf_Word | |
1536 | get_vn_next() const | |
1537 | { return Convert<32, big_endian>::convert_host(this->p_->vn_next); } | |
1538 | ||
1539 | private: | |
1540 | const internal::Verneed_data* p_; | |
1541 | }; | |
1542 | ||
14b31740 ILT |
1543 | template<int size, bool big_endian> |
1544 | class Verneed_write | |
1545 | { | |
1546 | public: | |
1547 | Verneed_write(unsigned char* p) | |
1548 | : p_(reinterpret_cast<internal::Verneed_data*>(p)) | |
1549 | { } | |
1550 | ||
1551 | void | |
1552 | set_vn_version(Elf_Half v) | |
1553 | { this->p_->vn_version = Convert<16, big_endian>::convert_host(v); } | |
1554 | ||
1555 | void | |
1556 | set_vn_cnt(Elf_Half v) | |
1557 | { this->p_->vn_cnt = Convert<16, big_endian>::convert_host(v); } | |
1558 | ||
1559 | void | |
1560 | set_vn_file(Elf_Word v) | |
1561 | { this->p_->vn_file = Convert<32, big_endian>::convert_host(v); } | |
1562 | ||
1563 | void | |
1564 | set_vn_aux(Elf_Word v) | |
1565 | { this->p_->vn_aux = Convert<32, big_endian>::convert_host(v); } | |
1566 | ||
1567 | void | |
1568 | set_vn_next(Elf_Word v) | |
1569 | { this->p_->vn_next = Convert<32, big_endian>::convert_host(v); } | |
1570 | ||
1571 | private: | |
1572 | internal::Verneed_data* p_; | |
1573 | }; | |
1574 | ||
dbe717ef ILT |
1575 | // Accessor classes for auxiliary entries in the ELF SHT_GNU_verneed |
1576 | // section. | |
1577 | ||
1578 | template<int size, bool big_endian> | |
1579 | class Vernaux | |
1580 | { | |
1581 | public: | |
1582 | Vernaux(const unsigned char* p) | |
1583 | : p_(reinterpret_cast<const internal::Vernaux_data*>(p)) | |
1584 | { } | |
1585 | ||
1586 | template<typename File> | |
1587 | Vernaux(File* file, typename File::Location loc) | |
1588 | : p_(reinterpret_cast<const internal::Vernaux_data*>( | |
1589 | file->view(loc.file_offset, loc.data_size).data())) | |
1590 | { } | |
1591 | ||
1592 | Elf_Word | |
1593 | get_vna_hash() const | |
1594 | { return Convert<32, big_endian>::convert_host(this->p_->vna_hash); } | |
1595 | ||
1596 | Elf_Half | |
1597 | get_vna_flags() const | |
1598 | { return Convert<16, big_endian>::convert_host(this->p_->vna_flags); } | |
1599 | ||
1600 | Elf_Half | |
1601 | get_vna_other() const | |
1602 | { return Convert<16, big_endian>::convert_host(this->p_->vna_other); } | |
1603 | ||
1604 | Elf_Word | |
1605 | get_vna_name() const | |
1606 | { return Convert<32, big_endian>::convert_host(this->p_->vna_name); } | |
1607 | ||
1608 | Elf_Word | |
1609 | get_vna_next() const | |
1610 | { return Convert<32, big_endian>::convert_host(this->p_->vna_next); } | |
1611 | ||
1612 | private: | |
1613 | const internal::Vernaux_data* p_; | |
1614 | }; | |
1615 | ||
14b31740 ILT |
1616 | template<int size, bool big_endian> |
1617 | class Vernaux_write | |
1618 | { | |
1619 | public: | |
1620 | Vernaux_write(unsigned char* p) | |
1621 | : p_(reinterpret_cast<internal::Vernaux_data*>(p)) | |
1622 | { } | |
1623 | ||
1624 | void | |
1625 | set_vna_hash(Elf_Word v) | |
1626 | { this->p_->vna_hash = Convert<32, big_endian>::convert_host(v); } | |
1627 | ||
1628 | void | |
1629 | set_vna_flags(Elf_Half v) | |
1630 | { this->p_->vna_flags = Convert<16, big_endian>::convert_host(v); } | |
1631 | ||
1632 | void | |
1633 | set_vna_other(Elf_Half v) | |
1634 | { this->p_->vna_other = Convert<16, big_endian>::convert_host(v); } | |
1635 | ||
1636 | void | |
1637 | set_vna_name(Elf_Word v) | |
1638 | { this->p_->vna_name = Convert<32, big_endian>::convert_host(v); } | |
1639 | ||
1640 | void | |
1641 | set_vna_next(Elf_Word v) | |
1642 | { this->p_->vna_next = Convert<32, big_endian>::convert_host(v); } | |
1643 | ||
1644 | private: | |
1645 | internal::Vernaux_data* p_; | |
1646 | }; | |
dbe717ef | 1647 | |
bae7f79e ILT |
1648 | } // End namespace elfcpp. |
1649 | ||
1650 | #endif // !defined(ELFPCP_H) |