Add program segments.
[deliverable/binutils-gdb.git] / elfcpp / elfcpp.h
1 // elfcpp.h -- main header file for elfcpp -*- C++ -*-
2
3 // This is the external interface for elfcpp.
4
5 #ifndef ELFCPP_H
6 #define ELFCPP_H
7
8 #include "elfcpp_config.h"
9
10 #include <stdint.h>
11
12 namespace elfcpp
13 {
14
15 // Basic ELF types.
16
17 // These types are always the same size.
18
19 typedef uint16_t Elf_Half;
20 typedef uint32_t Elf_Word;
21 typedef int32_t Elf_Sword;
22 typedef uint64_t Elf_Xword;
23 typedef int64_t Elf_Sxword;
24
25 // These types vary in size depending on the ELF file class. The
26 // template parameter should be 32 or 64.
27
28 template<int size>
29 struct Elf_types;
30
31 template<>
32 struct Elf_types<32>
33 {
34 typedef uint32_t Elf_Addr;
35 typedef uint32_t Elf_Off;
36 typedef uint32_t Elf_WXword;
37 };
38
39 template<>
40 struct Elf_types<64>
41 {
42 typedef uint64_t Elf_Addr;
43 typedef uint64_t Elf_Off;
44 typedef uint64_t Elf_WXword;
45 };
46
47 // Offsets within the Ehdr e_ident field.
48
49 const int EI_MAG0 = 0;
50 const int EI_MAG1 = 1;
51 const int EI_MAG2 = 2;
52 const int EI_MAG3 = 3;
53 const int EI_CLASS = 4;
54 const int EI_DATA = 5;
55 const int EI_VERSION = 6;
56 const int EI_OSABI = 7;
57 const int EI_ABIVERSION = 8;
58 const int EI_PAD = 9;
59 const int EI_NIDENT = 16;
60
61 // The valid values found in Ehdr e_ident[EI_MAG0 through EI_MAG3].
62
63 const int ELFMAG0 = 0x7f;
64 const int ELFMAG1 = 'E';
65 const int ELFMAG2 = 'L';
66 const int ELFMAG3 = 'F';
67
68 // The valid values found in Ehdr e_ident[EI_CLASS].
69
70 enum
71 {
72 ELFCLASSNONE = 0,
73 ELFCLASS32 = 1,
74 ELFCLASS64 = 2
75 };
76
77 // The valid values found in Ehdr e_ident[EI_DATA].
78
79 enum
80 {
81 ELFDATANONE = 0,
82 ELFDATA2LSB = 1,
83 ELFDATA2MSB = 2
84 };
85
86 // The valid values found in Ehdr e_ident[EI_VERSION] and e_version.
87
88 enum
89 {
90 EV_NONE = 0,
91 EV_CURRENT = 1
92 };
93
94 // The valid values found in Ehdr e_ident[EI_OSABI].
95
96 enum ELFOSABI
97 {
98 ELFOSABI_NONE = 0,
99 ELFOSABI_HPUX = 1,
100 ELFOSABI_NETBSD = 2,
101 // ELFOSABI_LINUX is not listed in the ELF standard.
102 ELFOSABI_LINUX = 3,
103 // ELFOSABI_HURD is not listed in the ELF standard.
104 ELFOSABI_HURD = 4,
105 ELFOSABI_SOLARIS = 6,
106 ELFOSABI_AIX = 7,
107 ELFOSABI_IRIX = 8,
108 ELFOSABI_FREEBSD = 9,
109 ELFOSABI_TRU64 = 10,
110 ELFOSABI_MODESTO = 11,
111 ELFOSABI_OPENBSD = 12,
112 ELFOSABI_OPENVMS = 13,
113 ELFOSABI_NSK = 14,
114 ELFOSABI_AROS = 15,
115 // A GNU extension for the ARM.
116 ELFOSABI_ARM = 97,
117 // A GNU extension for the MSP.
118 ELFOSABI_STANDALONE = 255
119 };
120
121 // The valid values found in the Ehdr e_type field.
122
123 enum ET
124 {
125 ET_NONE = 0,
126 ET_REL = 1,
127 ET_EXEC = 2,
128 ET_DYN = 3,
129 ET_CORE = 4,
130 ET_LOOS = 0xfe00,
131 ET_HIOS = 0xfeff,
132 ET_LOPROC = 0xff00,
133 ET_HIPROC = 0xffff
134 };
135
136 // The valid values found in the Ehdr e_machine field.
137
138 enum EM
139 {
140 EM_NONE = 0,
141 EM_M32 = 1,
142 EM_SPARC = 2,
143 EM_386 = 3,
144 EM_68K = 4,
145 EM_88K = 5,
146 // 6 used to be EM_486
147 EM_860 = 7,
148 EM_MIPS = 8,
149 EM_S370 = 9,
150 EM_MIPS_RS3_LE = 10,
151 // 11 was the old Sparc V9 ABI.
152 // 12 through 14 are reserved.
153 EM_PARISC = 15,
154 // 16 is reserved.
155 // Some old PowerPC object files use 17.
156 EM_VPP500 = 17,
157 EM_SPARC32PLUS = 18,
158 EM_960 = 19,
159 EM_PPC = 20,
160 EM_PPC64 = 21,
161 EM_S390 = 22,
162 // 23 through 35 are served.
163 EM_V800 = 36,
164 EM_FR20 = 37,
165 EM_RH32 = 38,
166 EM_RCE = 39,
167 EM_ARM = 40,
168 EM_ALPHA = 41,
169 EM_SH = 42,
170 EM_SPARCV9 = 43,
171 EM_TRICORE = 44,
172 EM_ARC = 45,
173 EM_H8_300 = 46,
174 EM_H8_300H = 47,
175 EM_H8S = 48,
176 EM_H8_500 = 49,
177 EM_IA_64 = 50,
178 EM_MIPS_X = 51,
179 EM_COLDFIRE = 52,
180 EM_68HC12 = 53,
181 EM_MMA = 54,
182 EM_PCP = 55,
183 EM_NCPU = 56,
184 EM_NDR1 = 57,
185 EM_STARCORE = 58,
186 EM_ME16 = 59,
187 EM_ST100 = 60,
188 EM_TINYJ = 61,
189 EM_X86_64 = 62,
190 EM_PDSP = 63,
191 EM_PDP10 = 64,
192 EM_PDP11 = 65,
193 EM_FX66 = 66,
194 EM_ST9PLUS = 67,
195 EM_ST7 = 68,
196 EM_68HC16 = 69,
197 EM_68HC11 = 70,
198 EM_68HC08 = 71,
199 EM_68HC05 = 72,
200 EM_SVX = 73,
201 EM_ST19 = 74,
202 EM_VAX = 75,
203 EM_CRIS = 76,
204 EM_JAVELIN = 77,
205 EM_FIREPATH = 78,
206 EM_ZSP = 79,
207 EM_MMIX = 80,
208 EM_HUANY = 81,
209 EM_PRISM = 82,
210 EM_AVR = 83,
211 EM_FR30 = 84,
212 EM_D10V = 85,
213 EM_D30V = 86,
214 EM_V850 = 87,
215 EM_M32R = 88,
216 EM_MN10300 = 89,
217 EM_MN10200 = 90,
218 EM_PJ = 91,
219 EM_OPENRISC = 92,
220 EM_ARC_A5 = 93,
221 EM_XTENSA = 94,
222 EM_VIDEOCORE = 95,
223 EM_TMM_GPP = 96,
224 EM_NS32K = 97,
225 EM_TPC = 98,
226 // Some old picoJava object files use 99 (EM_PJ is correct).
227 EM_SNP1K = 99,
228 EM_ST200 = 100,
229 EM_IP2K = 101,
230 EM_MAX = 102,
231 EM_CR = 103,
232 EM_F2MC16 = 104,
233 EM_MSP430 = 105,
234 EM_BLACKFIN = 106,
235 EM_SE_C33 = 107,
236 EM_SEP = 108,
237 EM_ARCA = 109,
238 EM_UNICORE = 110,
239 EM_ALTERA_NIOS2 = 113,
240 EM_CRX = 114,
241 // The Morph MT.
242 EM_MT = 0x2530,
243 // DLX.
244 EM_DLX = 0x5aa5,
245 // FRV.
246 EM_FRV = 0x5441,
247 // Infineon Technologies 16-bit microcontroller with C166-V2 core.
248 EM_X16X = 0x4688,
249 // Xstorym16
250 EM_XSTORMY16 = 0xad45,
251 // Renesas M32C
252 EM_M32C = 0xfeb0,
253 // Vitesse IQ2000
254 EM_IQ2000 = 0xfeba,
255 // NIOS
256 EM_NIOS32 = 0xfebb
257 // Old AVR objects used 0x1057 (EM_AVR is correct).
258 // Old MSP430 objects used 0x1059 (EM_MSP430 is correct).
259 // Old FR30 objects used 0x3330 (EM_FR30 is correct).
260 // Old OpenRISC objects used 0x3426 and 0x8472 (EM_OPENRISC is correct).
261 // Old D10V objects used 0x7650 (EM_D10V is correct).
262 // Old D30V objects used 0x7676 (EM_D30V is correct).
263 // Old IP2X objects used 0x8217 (EM_IP2K is correct).
264 // Old PowerPC objects used 0x9025 (EM_PPC is correct).
265 // Old Alpha objects used 0x9026 (EM_ALPHA is correct).
266 // Old M32R objects used 0x9041 (EM_M32R is correct).
267 // Old V850 objects used 0x9080 (EM_V850 is correct).
268 // Old S/390 objects used 0xa390 (EM_S390 is correct).
269 // Old Xtensa objects used 0xabc7 (EM_XTENSA is correct).
270 // Old MN10300 objects used 0xbeef (EM_MN10300 is correct).
271 // Old MN10200 objects used 0xdead (EM_MN10200 is correct).
272 };
273
274 // Special section indices.
275
276 enum
277 {
278 SHN_UNDEF = 0,
279 SHN_LORESERVE = 0xff00,
280 SHN_LOPROC = 0xff00,
281 SHN_HIPROC = 0xff1f,
282 SHN_LOOS = 0xff20,
283 SHN_HIOS = 0xff3f,
284 SHN_ABS = 0xfff1,
285 SHN_COMMON = 0xfff2,
286 SHN_XINDEX = 0xffff,
287 SHN_HIRESERVE = 0xffff
288 };
289
290 // The valid values found in the Shdr sh_type field.
291
292 enum SHT
293 {
294 SHT_NULL = 0,
295 SHT_PROGBITS = 1,
296 SHT_SYMTAB = 2,
297 SHT_STRTAB = 3,
298 SHT_RELA = 4,
299 SHT_HASH = 5,
300 SHT_DYNAMIC = 6,
301 SHT_NOTE = 7,
302 SHT_NOBITS = 8,
303 SHT_REL = 9,
304 SHT_SHLIB = 10,
305 SHT_DYNSYM = 11,
306 SHT_INIT_ARRAY = 14,
307 SHT_FINI_ARRAY = 15,
308 SHT_PREINIT_ARRAY = 16,
309 SHT_GROUP = 17,
310 SHT_SYMTAB_SHNDX = 18,
311 SHT_LOOS = 0x60000000,
312 SHT_HIOS = 0x6fffffff,
313 SHT_LOPROC = 0x70000000,
314 SHT_HIPROC = 0x7fffffff,
315 SHT_LOUSER = 0x80000000,
316 SHT_HIUSER = 0xffffffff,
317 // The remaining values are not in the standard.
318 // List of prelink dependencies.
319 SHT_GNU_LIBLIST = 0x6ffffff7,
320 // Versions defined by file.
321 SHT_SUNW_verdef = 0x6ffffffd,
322 SHT_GNU_verdef = 0x6ffffffd,
323 // Versions needed by file.
324 SHT_SUNW_verneed = 0x6ffffffe,
325 SHT_GNU_verneed = 0x6ffffffe,
326 // Symbol versions,
327 SHT_SUNW_versym = 0x6fffffff,
328 SHT_GNU_versym = 0x6fffffff,
329 };
330
331 // The valid bit flags found in the Shdr sh_flags field.
332
333 enum SHF
334 {
335 SHF_WRITE = 0x1,
336 SHF_ALLOC = 0x2,
337 SHF_EXECINSTR = 0x4,
338 SHF_MERGE = 0x10,
339 SHF_STRINGS = 0x20,
340 SHF_INFO_LINK = 0x40,
341 SHF_LINK_ORDER = 0x80,
342 SHF_OS_NONCONFORMING = 0x100,
343 SHF_GROUP = 0x200,
344 SHF_TLS = 0x400,
345 SHF_MASKOS = 0x0ff00000,
346 SHF_MASKPROC = 0xf0000000
347 };
348
349 // Bit flags which appear in the first 32-bit word of the section data
350 // of a SHT_GROUP section.
351
352 enum
353 {
354 GRP_COMDAT = 0x1,
355 GRP_MASKOS = 0x0ff00000,
356 GRP_MASKPROC = 0xf0000000
357 };
358
359 // The valid values found in the Phdr p_type field.
360
361 enum PT
362 {
363 PT_NULL = 0,
364 PT_LOAD = 1,
365 PT_DYNAMIC = 2,
366 PT_INTERP = 3,
367 PT_NOTE = 4,
368 PT_SHLIB = 5,
369 PT_PHDR = 6,
370 PT_TLS = 7,
371 PT_LOOS = 0x60000000,
372 PT_HIOS = 0x6fffffff,
373 PT_LOPROC = 0x70000000,
374 PT_HIPROC = 0x7fffffff,
375 // The remaining values are not in the standard.
376 // Frame unwind information.
377 PT_GNU_EH_FRAME = 0x6474e550,
378 PT_SUNW_EH_FRAME = 0x6474e550,
379 // Stack flags.
380 PT_GNU_STACK = 0x6474e551,
381 // Read only after relocation.
382 PT_GNU_RELRO = 0x6474e552
383 };
384
385 // The valid bit flags found in the Phdr p_flags field.
386
387 enum PF
388 {
389 PF_X = 0x1,
390 PF_W = 0x2,
391 PF_R = 0x4,
392 PF_MASKOS = 0x0ff00000,
393 PF_MASKPROC = 0xf0000000
394 };
395
396 // Symbol binding from Sym st_info field.
397
398 enum STB
399 {
400 STB_LOCAL = 0,
401 STB_GLOBAL = 1,
402 STB_WEAK = 2,
403 STB_LOOS = 10,
404 STB_HIOS = 12,
405 STB_LOPROC = 13,
406 STB_HIPROC = 15
407 };
408
409 // Symbol types from Sym st_info field.
410
411 enum STT
412 {
413 STT_NOTYPE = 0,
414 STT_OBJECT = 1,
415 STT_FUNC = 2,
416 STT_SECTION = 3,
417 STT_FILE = 4,
418 STT_COMMON = 5,
419 STT_TLS = 6,
420 STT_LOOS = 10,
421 STT_HIOS = 12,
422 STT_LOPROC = 13,
423 STT_HIPROC = 15
424 };
425
426 inline STB
427 elf_st_bind(unsigned char info)
428 {
429 return static_cast<STB>(info >> 4);
430 }
431
432 inline STT
433 elf_st_type(unsigned char info)
434 {
435 return static_cast<STT>(info & 0xf);
436 }
437
438 inline unsigned char
439 elf_st_info(STB bind, STT type)
440 {
441 return ((static_cast<unsigned char>(bind) << 4)
442 + (static_cast<unsigned char>(type) & 0xf));
443 }
444
445 // Symbol visibility from Sym st_other field.
446
447 enum STV
448 {
449 STV_DEFAULT = 0,
450 STV_INTERNAL = 1,
451 STV_HIDDEN = 2,
452 STV_PROTECTED = 3
453 };
454
455 inline STV
456 elf_st_visibility(unsigned char other)
457 {
458 return static_cast<STV>(other & 0x3);
459 }
460
461 inline unsigned char
462 elf_st_nonvis(unsigned char other)
463 {
464 return static_cast<STV>(other >> 2);
465 }
466
467 inline unsigned char
468 elf_st_other(STV vis, unsigned char nonvis)
469 {
470 return ((nonvis << 2)
471 + (static_cast<unsigned char>(vis) & 3));
472 }
473
474 } // End namespace elfcpp.
475
476 // Include internal details after defining the types.
477 #include "elfcpp_internal.h"
478
479 namespace elfcpp
480 {
481
482 // The offset of the ELF file header in the ELF file.
483
484 const int file_header_offset = 0;
485
486 // ELF structure sizes.
487
488 template<int size>
489 struct Elf_sizes
490 {
491 // Size of ELF file header.
492 static const int ehdr_size = sizeof(internal::Ehdr_data<size>);
493 // Size of ELF section header.
494 static const int shdr_size = sizeof(internal::Shdr_data<size>);
495 // Size of ELF symbol table entry.
496 static const int sym_size = sizeof(internal::Sym_data<size>);
497 };
498
499 // Given the address of an Elf_Word, return the value.
500
501 template<bool big_endian>
502 inline Elf_Word
503 read_elf_word(const Elf_Word* p)
504 {
505 return internal::convert_word<big_endian>(*p);
506 }
507
508 // Accessor class for the ELF file header.
509
510 template<int size, bool big_endian>
511 class Ehdr
512 {
513 public:
514 Ehdr(const unsigned char* p)
515 : p_(reinterpret_cast<const internal::Ehdr_data<size>*>(p))
516 { }
517
518 const unsigned char*
519 get_e_ident() const
520 { return this->p_->e_ident; }
521
522 Elf_Half
523 get_e_type() const
524 { return internal::convert_half<big_endian>(this->p_->e_type); }
525
526 Elf_Half
527 get_e_machine() const
528 { return internal::convert_half<big_endian>(this->p_->e_machine); }
529
530 Elf_Word
531 get_e_version() const
532 { return internal::convert_word<big_endian>(this->p_->e_version); }
533
534 typename Elf_types<size>::Elf_Addr
535 get_e_entry() const
536 { return internal::convert_addr<size, big_endian>(this->p_->e_entry); }
537
538 typename Elf_types<size>::Elf_Off
539 get_e_phoff() const
540 { return internal::convert_off<size, big_endian>(this->p_->e_phoff); }
541
542 typename Elf_types<size>::Elf_Off
543 get_e_shoff() const
544 { return internal::convert_off<size, big_endian>(this->p_->e_shoff); }
545
546 Elf_Word
547 get_e_flags() const
548 { return internal::convert_word<big_endian>(this->p_->e_flags); }
549
550 Elf_Half
551 get_e_ehsize() const
552 { return internal::convert_half<big_endian>(this->p_->e_ehsize); }
553
554 Elf_Half
555 get_e_phentsize() const
556 { return internal::convert_half<big_endian>(this->p_->e_phentsize); }
557
558 Elf_Half
559 get_e_phnum() const
560 { return internal::convert_half<big_endian>(this->p_->e_phnum); }
561
562 Elf_Half
563 get_e_shentsize() const
564 { return internal::convert_half<big_endian>(this->p_->e_shentsize); }
565
566 Elf_Half
567 get_e_shnum() const
568 { return internal::convert_half<big_endian>(this->p_->e_shnum); }
569
570 Elf_Half
571 get_e_shstrndx() const
572 { return internal::convert_half<big_endian>(this->p_->e_shstrndx); }
573
574 private:
575 const internal::Ehdr_data<size>* p_;
576 };
577
578 // Accessor class for an ELF section header.
579
580 template<int size, bool big_endian>
581 class Shdr
582 {
583 public:
584 Shdr(const unsigned char* p)
585 : p_(reinterpret_cast<const internal::Shdr_data<size>*>(p))
586 { }
587
588 Elf_Word
589 get_sh_name() const
590 { return internal::convert_word<big_endian>(this->p_->sh_name); }
591
592 Elf_Word
593 get_sh_type() const
594 { return internal::convert_word<big_endian>(this->p_->sh_type); }
595
596 typename Elf_types<size>::Elf_WXword
597 get_sh_flags() const
598 { return internal::convert_wxword<size, big_endian>(this->p_->sh_flags); }
599
600 typename Elf_types<size>::Elf_Addr
601 get_sh_addr() const
602 { return internal::convert_addr<size, big_endian>(this->p_->sh_addr); }
603
604 typename Elf_types<size>::Elf_Off
605 get_sh_offset() const
606 { return internal::convert_off<size, big_endian>(this->p_->sh_offset); }
607
608 typename Elf_types<size>::Elf_WXword
609 get_sh_size() const
610 { return internal::convert_wxword<size, big_endian>(this->p_->sh_size); }
611
612 Elf_Word
613 get_sh_link() const
614 { return internal::convert_word<big_endian>(this->p_->sh_link); }
615
616 Elf_Word
617 get_sh_info() const
618 { return internal::convert_word<big_endian>(this->p_->sh_info); }
619
620 typename Elf_types<size>::Elf_WXword
621 get_sh_addralign() const
622 { return
623 internal::convert_wxword<size, big_endian>(this->p_->sh_addralign); }
624
625 typename Elf_types<size>::Elf_WXword
626 get_sh_entsize() const
627 { return internal::convert_wxword<size, big_endian>(this->p_->sh_entsize); }
628
629 private:
630 const internal::Shdr_data<size>* p_;
631 };
632
633 // Accessor class for an ELF segment header.
634
635 template<int size, bool big_endian>
636 class Phdr
637 {
638 public:
639 Phdr(const unsigned char* p)
640 : p_(reinterpret_cast<const internal::Phdr_data<size>*>(p))
641 { }
642
643 Elf_Word
644 get_p_type() const
645 { return internal::convert_word<big_endian>(this->p_->p_type); }
646
647 typename Elf_types<size>::Elf_Off
648 get_p_offset() const
649 { return internal::convert_off<size, big_endian>(this->p_->p_offset); }
650
651 typename Elf_types<size>::Elf_Addr
652 get_p_vaddr() const
653 { return internal::convert_addr<size, big_endian>(this->p_->p_vaddr); }
654
655 typename Elf_types<size>::Elf_Addr
656 get_p_paddr() const
657 { return internal::convert_addr<size, big_endian>(this->p_->p_paddr); }
658
659 typename Elf_types<size>::Elf_WXword
660 get_p_filesz() const
661 { return internal::convert_wxword<size, big_endian>(this->p_->p_filesz); }
662
663 typename Elf_types<size>::Elf_WXword
664 get_p_memsz() const
665 { return internal::convert_wxword<size, big_endian>(this->p_->p_memsz); }
666
667 Elf_Word
668 get_p_flags() const
669 { return internal::convert_word<big_endian>(this->p_->p_flags); }
670
671 typename Elf_types<size>::Elf_WXword
672 get_p_align() const
673 { return internal::convert_wxword<size, big_endian>(this->p_->p_align); }
674
675 private:
676 const internal::Phdr_data<size>* p_;
677 };
678
679 // Accessor class for an ELF symbol table entry.
680
681 template<int size, bool big_endian>
682 class Sym
683 {
684 public:
685 Sym(const unsigned char* p)
686 : p_(reinterpret_cast<const internal::Sym_data<size>*>(p))
687 { }
688
689 Elf_Word
690 get_st_name() const
691 { return internal::convert_word<big_endian>(this->p_->st_name); }
692
693 typename Elf_types<size>::Elf_Addr
694 get_st_value() const
695 { return internal::convert_addr<size, big_endian>(this->p_->st_value); }
696
697 typename Elf_types<size>::Elf_WXword
698 get_st_size() const
699 { return internal::convert_wxword<size, big_endian>(this->p_->st_size); }
700
701 unsigned char
702 get_st_info() const
703 { return this->p_->st_info; }
704
705 STB
706 get_st_bind() const
707 { return elf_st_bind(this->get_st_info()); }
708
709 STT
710 get_st_type() const
711 { return elf_st_type(this->get_st_info()); }
712
713 unsigned char
714 get_st_other() const
715 { return this->p_->st_other; }
716
717 STV
718 get_st_visibility() const
719 { return elf_st_visibility(this->get_st_other()); }
720
721 unsigned char
722 get_st_nonvis() const
723 { return elf_st_nonvis(this->get_st_other()); }
724
725 Elf_Half
726 get_st_shndx() const
727 { return internal::convert_half<big_endian>(this->p_->st_shndx); }
728
729 private:
730 const internal::Sym_data<size>* p_;
731 };
732
733 // Writer class for an ELF symbol table entry.
734
735 template<int size, bool big_endian>
736 class Sym_write
737 {
738 public:
739 Sym_write(unsigned char* p)
740 : p_(reinterpret_cast<internal::Sym_data<size>*>(p))
741 { }
742
743 void
744 put_st_name(Elf_Word v)
745 { this->p_->st_name = internal::convert_word<big_endian>(v); }
746
747 void
748 put_st_value(typename Elf_types<size>::Elf_Addr v)
749 { this->p_->st_value = internal::convert_addr<size, big_endian>(v); }
750
751 void
752 put_st_size(typename Elf_types<size>::Elf_WXword v)
753 { this->p_->st_size = internal::convert_wxword<size, big_endian>(v); }
754
755 void
756 put_st_info(unsigned char v)
757 { this->p_->st_info = v; }
758
759 void
760 put_st_info(STB bind, STT type)
761 { this->p_->st_info = elf_st_info(bind, type); }
762
763 void
764 put_st_other(unsigned char v)
765 { this->p_->st_other = v; }
766
767 void
768 put_st_other(STV vis, unsigned char nonvis)
769 { this->p_->st_other = elf_st_other(vis, nonvis); }
770
771 void
772 put_st_shndx(Elf_Half v)
773 { this->p_->st_shndx = internal::convert_half<big_endian>(v); }
774
775 Sym<size, big_endian>
776 sym()
777 { return Sym<size, big_endian>(reinterpret_cast<unsigned char*>(this->p_)); }
778
779 private:
780 internal::Sym_data<size>* p_;
781 };
782
783 } // End namespace elfcpp.
784
785 #endif // !defined(ELFPCP_H)
This page took 0.04559 seconds and 5 git commands to generate.