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

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [elfcpp/] [elfcpp.h] - Blame information for rev 266

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 20 khays
// elfcpp.h -- main header file for elfcpp    -*- C++ -*-
2
 
3 166 khays
// Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012
4
// Free Software Foundation, Inc.
5 20 khays
// Written by Ian Lance Taylor <iant@google.com>.
6
 
7
// This file is part of elfcpp.
8
 
9
// This program is free software; you can redistribute it and/or
10
// modify it under the terms of the GNU Library General Public License
11
// as published by the Free Software Foundation; either version 2, or
12
// (at your option) any later version.
13
 
14
// In addition to the permissions in the GNU Library General Public
15
// License, the Free Software Foundation gives you unlimited
16
// permission to link the compiled version of this file into
17
// combinations with other programs, and to distribute those
18
// combinations without any restriction coming from the use of this
19
// file.  (The Library Public License restrictions do apply in other
20
// respects; for example, they cover modification of the file, and
21
// distribution when not linked into a combined executable.)
22
 
23
// This program is distributed in the hope that it will be useful, but
24
// WITHOUT ANY WARRANTY; without even the implied warranty of
25
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
26
// Library General Public License for more details.
27
 
28
// You should have received a copy of the GNU Library General Public
29
// License along with this program; if not, write to the Free Software
30
// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
31
// 02110-1301, USA.
32
 
33
// This is the external interface for elfcpp.
34
 
35
#ifndef ELFCPP_H
36
#define ELFCPP_H
37
 
38
#include "elfcpp_swap.h"
39
 
40
#include <stdint.h>
41
 
42
namespace elfcpp
43
{
44
 
45
// Basic ELF types.
46
 
47
// These types are always the same size.
48
 
49
typedef uint16_t Elf_Half;
50
typedef uint32_t Elf_Word;
51
typedef int32_t Elf_Sword;
52
typedef uint64_t Elf_Xword;
53
typedef int64_t Elf_Sxword;
54
 
55
// These types vary in size depending on the ELF file class.  The
56
// template parameter should be 32 or 64.
57
 
58
template<int size>
59
struct Elf_types;
60
 
61
template<>
62
struct Elf_types<32>
63
{
64
  typedef uint32_t Elf_Addr;
65
  typedef uint32_t Elf_Off;
66
  typedef uint32_t Elf_WXword;
67
  typedef int32_t Elf_Swxword;
68
};
69
 
70
template<>
71
struct Elf_types<64>
72
{
73
  typedef uint64_t Elf_Addr;
74
  typedef uint64_t Elf_Off;
75
  typedef uint64_t Elf_WXword;
76
  typedef int64_t Elf_Swxword;
77
};
78
 
79
// Offsets within the Ehdr e_ident field.
80
 
81
const int EI_MAG0 = 0;
82
const int EI_MAG1 = 1;
83
const int EI_MAG2 = 2;
84
const int EI_MAG3 = 3;
85
const int EI_CLASS = 4;
86
const int EI_DATA = 5;
87
const int EI_VERSION = 6;
88
const int EI_OSABI = 7;
89
const int EI_ABIVERSION = 8;
90
const int EI_PAD = 9;
91
const int EI_NIDENT = 16;
92
 
93
// The valid values found in Ehdr e_ident[EI_MAG0 through EI_MAG3].
94
 
95
const int ELFMAG0 = 0x7f;
96
const int ELFMAG1 = 'E';
97
const int ELFMAG2 = 'L';
98
const int ELFMAG3 = 'F';
99
 
100
// The valid values found in Ehdr e_ident[EI_CLASS].
101
 
102
enum
103
{
104
  ELFCLASSNONE = 0,
105
  ELFCLASS32 = 1,
106
  ELFCLASS64 = 2
107
};
108
 
109
// The valid values found in Ehdr e_ident[EI_DATA].
110
 
111
enum
112
{
113
  ELFDATANONE = 0,
114
  ELFDATA2LSB = 1,
115
  ELFDATA2MSB = 2
116
};
117
 
118
// The valid values found in Ehdr e_ident[EI_VERSION] and e_version.
119
 
120
enum
121
{
122
  EV_NONE = 0,
123
  EV_CURRENT = 1
124
};
125
 
126
// The valid values found in Ehdr e_ident[EI_OSABI].
127
 
128
enum ELFOSABI
129
{
130
  ELFOSABI_NONE = 0,
131
  ELFOSABI_HPUX = 1,
132
  ELFOSABI_NETBSD = 2,
133 161 khays
  ELFOSABI_GNU = 3,
134
  // ELFOSABI_LINUX is an alias for ELFOSABI_GNU.
135 20 khays
  ELFOSABI_LINUX = 3,
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
  /* Open8/ARClite/V8.  */
273
  EM_OPEN8 = 196,
274
  // The Morph MT.
275
  EM_MT = 0x2530,
276
  // DLX.
277
  EM_DLX = 0x5aa5,
278
  // FRV.
279
  EM_FRV = 0x5441,
280
  // Infineon Technologies 16-bit microcontroller with C166-V2 core.
281
  EM_X16X = 0x4688,
282
  // Xstorym16
283
  EM_XSTORMY16 = 0xad45,
284
  // Renesas M32C
285
  EM_M32C = 0xfeb0,
286
  // Vitesse IQ2000
287
  EM_IQ2000 = 0xfeba,
288
  // NIOS
289
  EM_NIOS32 = 0xfebb
290
  // Old AVR objects used 0x1057 (EM_AVR is correct).
291
  // Old MSP430 objects used 0x1059 (EM_MSP430 is correct).
292
  // Old FR30 objects used 0x3330 (EM_FR30 is correct).
293
  // Old OpenRISC objects used 0x3426 and 0x8472 (EM_OPENRISC is correct).
294
  // Old D10V objects used 0x7650 (EM_D10V is correct).
295
  // Old D30V objects used 0x7676 (EM_D30V is correct).
296
  // Old IP2X objects used 0x8217 (EM_IP2K is correct).
297
  // Old PowerPC objects used 0x9025 (EM_PPC is correct).
298
  // Old Alpha objects used 0x9026 (EM_ALPHA is correct).
299
  // Old M32R objects used 0x9041 (EM_M32R is correct).
300
  // Old V850 objects used 0x9080 (EM_V850 is correct).
301
  // Old S/390 objects used 0xa390 (EM_S390 is correct).
302
  // Old Xtensa objects used 0xabc7 (EM_XTENSA is correct).
303
  // Old MN10300 objects used 0xbeef (EM_MN10300 is correct).
304
  // Old MN10200 objects used 0xdead (EM_MN10200 is correct).
305
};
306
 
307
// A special value found in the Ehdr e_phnum field.
308
 
309
enum
310
{
311
  // Number of program segments stored in sh_info field of first
312
  // section headre.
313
  PN_XNUM = 0xffff
314
};
315
 
316
// Special section indices.
317
 
318
enum
319
{
320
  SHN_UNDEF = 0,
321
  SHN_LORESERVE = 0xff00,
322
  SHN_LOPROC = 0xff00,
323
  SHN_HIPROC = 0xff1f,
324
  SHN_LOOS = 0xff20,
325
  SHN_HIOS = 0xff3f,
326
  SHN_ABS = 0xfff1,
327
  SHN_COMMON = 0xfff2,
328
  SHN_XINDEX = 0xffff,
329
  SHN_HIRESERVE = 0xffff,
330
 
331
  // Provide for initial and final section ordering in conjunction
332
  // with the SHF_LINK_ORDER and SHF_ORDERED section flags.
333
  SHN_BEFORE = 0xff00,
334
  SHN_AFTER = 0xff01,
335
 
336
  // x86_64 specific large common symbol.
337
  SHN_X86_64_LCOMMON = 0xff02
338
};
339
 
340
// The valid values found in the Shdr sh_type field.
341
 
342
enum SHT
343
{
344
  SHT_NULL = 0,
345
  SHT_PROGBITS = 1,
346
  SHT_SYMTAB = 2,
347
  SHT_STRTAB = 3,
348
  SHT_RELA = 4,
349
  SHT_HASH = 5,
350
  SHT_DYNAMIC = 6,
351
  SHT_NOTE = 7,
352
  SHT_NOBITS = 8,
353
  SHT_REL = 9,
354
  SHT_SHLIB = 10,
355
  SHT_DYNSYM = 11,
356
  SHT_INIT_ARRAY = 14,
357
  SHT_FINI_ARRAY = 15,
358
  SHT_PREINIT_ARRAY = 16,
359
  SHT_GROUP = 17,
360
  SHT_SYMTAB_SHNDX = 18,
361
  SHT_LOOS = 0x60000000,
362
  SHT_HIOS = 0x6fffffff,
363
  SHT_LOPROC = 0x70000000,
364
  SHT_HIPROC = 0x7fffffff,
365
  SHT_LOUSER = 0x80000000,
366
  SHT_HIUSER = 0xffffffff,
367
  // The remaining values are not in the standard.
368
  // Incremental build data.
369
  SHT_GNU_INCREMENTAL_INPUTS = 0x6fff4700,
370
  SHT_GNU_INCREMENTAL_SYMTAB = 0x6fff4701,
371
  SHT_GNU_INCREMENTAL_RELOCS = 0x6fff4702,
372
  SHT_GNU_INCREMENTAL_GOT_PLT = 0x6fff4703,
373
  // Object attributes.
374
  SHT_GNU_ATTRIBUTES = 0x6ffffff5,
375
  // GNU style dynamic hash table.
376
  SHT_GNU_HASH = 0x6ffffff6,
377
  // List of prelink dependencies.
378
  SHT_GNU_LIBLIST = 0x6ffffff7,
379
  // Versions defined by file.
380
  SHT_SUNW_verdef = 0x6ffffffd,
381
  SHT_GNU_verdef = 0x6ffffffd,
382
  // Versions needed by file.
383
  SHT_SUNW_verneed = 0x6ffffffe,
384
  SHT_GNU_verneed = 0x6ffffffe,
385
  // Symbol versions,
386
  SHT_SUNW_versym = 0x6fffffff,
387
  SHT_GNU_versym = 0x6fffffff,
388
 
389
  SHT_SPARC_GOTDATA = 0x70000000,
390
 
391
  // ARM-specific section types.
392
  // Exception Index table.
393
  SHT_ARM_EXIDX = 0x70000001,
394
  // BPABI DLL dynamic linking pre-emption map.
395
  SHT_ARM_PREEMPTMAP = 0x70000002,
396
  // Object file compatibility attributes.
397
  SHT_ARM_ATTRIBUTES = 0x70000003,
398
  // Support for debugging overlaid programs.
399
  SHT_ARM_DEBUGOVERLAY = 0x70000004,
400
  SHT_ARM_OVERLAYSECTION = 0x70000005,
401
 
402
  // x86_64 unwind information.
403
  SHT_X86_64_UNWIND = 0x70000001,
404
 
405 166 khays
  //MIPS-specific section types.
406
  // Register info section
407
  SHT_MIPS_REGINFO = 0x70000006,
408
 
409 20 khays
  // Link editor is to sort the entries in this section based on the
410
  // address specified in the associated symbol table entry.
411
  SHT_ORDERED = 0x7fffffff
412
};
413
 
414
// The valid bit flags found in the Shdr sh_flags field.
415
 
416
enum SHF
417
{
418
  SHF_WRITE = 0x1,
419
  SHF_ALLOC = 0x2,
420
  SHF_EXECINSTR = 0x4,
421
  SHF_MERGE = 0x10,
422
  SHF_STRINGS = 0x20,
423
  SHF_INFO_LINK = 0x40,
424
  SHF_LINK_ORDER = 0x80,
425
  SHF_OS_NONCONFORMING = 0x100,
426
  SHF_GROUP = 0x200,
427
  SHF_TLS = 0x400,
428
  SHF_MASKOS = 0x0ff00000,
429
  SHF_MASKPROC = 0xf0000000,
430
 
431
  // Indicates this section requires ordering in relation to
432
  // other sections of the same type.  Ordered sections are
433
  // combined within the section pointed to by the sh_link entry.
434
  // The sh_info values SHN_BEFORE and SHN_AFTER imply that the
435
  // sorted section is to precede or follow, respectively, all
436
  // other sections in the set being ordered.
437
  SHF_ORDERED = 0x40000000,
438
  // This section is excluded from input to the link-edit of an
439
  // executable or shared object.  This flag is ignored if SHF_ALLOC
440
  // is also set, or if relocations exist against the section.
441
  SHF_EXCLUDE = 0x80000000,
442
 
443 166 khays
  // Section with data that is GP relative addressable.
444
  SHF_MIPS_GPREL = 0x10000000,
445
 
446 20 khays
  // x86_64 specific large section.
447
  SHF_X86_64_LARGE = 0x10000000
448
};
449
 
450
// Bit flags which appear in the first 32-bit word of the section data
451
// of a SHT_GROUP section.
452
 
453
enum
454
{
455
  GRP_COMDAT = 0x1,
456
  GRP_MASKOS = 0x0ff00000,
457
  GRP_MASKPROC = 0xf0000000
458
};
459
 
460
// The valid values found in the Phdr p_type field.
461
 
462
enum PT
463
{
464
  PT_NULL = 0,
465
  PT_LOAD = 1,
466
  PT_DYNAMIC = 2,
467
  PT_INTERP = 3,
468
  PT_NOTE = 4,
469
  PT_SHLIB = 5,
470
  PT_PHDR = 6,
471
  PT_TLS = 7,
472
  PT_LOOS = 0x60000000,
473
  PT_HIOS = 0x6fffffff,
474
  PT_LOPROC = 0x70000000,
475
  PT_HIPROC = 0x7fffffff,
476
  // The remaining values are not in the standard.
477
  // Frame unwind information.
478
  PT_GNU_EH_FRAME = 0x6474e550,
479
  PT_SUNW_EH_FRAME = 0x6474e550,
480
  // Stack flags.
481
  PT_GNU_STACK = 0x6474e551,
482
  // Read only after relocation.
483
  PT_GNU_RELRO = 0x6474e552,
484
  // Platform architecture compatibility information
485
  PT_ARM_ARCHEXT = 0x70000000,
486
  // Exception unwind tables
487 166 khays
  PT_ARM_EXIDX = 0x70000001,
488
  // Register usage information.  Identifies one .reginfo section.
489
  PT_MIPS_REGINFO =0x70000000,
490
  // Runtime procedure table.
491
  PT_MIPS_RTPROC = 0x70000001,
492
  // .MIPS.options section.
493
  PT_MIPS_OPTIONS = 0x70000002
494 20 khays
};
495
 
496
// The valid bit flags found in the Phdr p_flags field.
497
 
498
enum PF
499
{
500
  PF_X = 0x1,
501
  PF_W = 0x2,
502
  PF_R = 0x4,
503
  PF_MASKOS = 0x0ff00000,
504
  PF_MASKPROC = 0xf0000000
505
};
506
 
507
// Symbol binding from Sym st_info field.
508
 
509
enum STB
510
{
511
  STB_LOCAL = 0,
512
  STB_GLOBAL = 1,
513
  STB_WEAK = 2,
514
  STB_LOOS = 10,
515
  STB_GNU_UNIQUE = 10,
516
  STB_HIOS = 12,
517
  STB_LOPROC = 13,
518
  STB_HIPROC = 15
519
};
520
 
521
// Symbol types from Sym st_info field.
522
 
523
enum STT
524
{
525
  STT_NOTYPE = 0,
526
  STT_OBJECT = 1,
527
  STT_FUNC = 2,
528
  STT_SECTION = 3,
529
  STT_FILE = 4,
530
  STT_COMMON = 5,
531
  STT_TLS = 6,
532 166 khays
 
533
  // GNU extension: symbol value points to a function which is called
534
  // at runtime to determine the final value of the symbol.
535
  STT_GNU_IFUNC = 10,
536
 
537 20 khays
  STT_LOOS = 10,
538
  STT_HIOS = 12,
539
  STT_LOPROC = 13,
540
  STT_HIPROC = 15,
541
 
542
  // The section type that must be used for register symbols on
543
  // Sparc.  These symbols initialize a global register.
544
  STT_SPARC_REGISTER = 13,
545
 
546
  // ARM: a THUMB function.  This is not defined in ARM ELF Specification but
547
  // used by the GNU tool-chain.
548
  STT_ARM_TFUNC = 13
549
};
550
 
551
inline STB
552
elf_st_bind(unsigned char info)
553
{
554
  return static_cast<STB>(info >> 4);
555
}
556
 
557
inline STT
558
elf_st_type(unsigned char info)
559
{
560
  return static_cast<STT>(info & 0xf);
561
}
562
 
563
inline unsigned char
564
elf_st_info(STB bind, STT type)
565
{
566
  return ((static_cast<unsigned char>(bind) << 4)
567
          + (static_cast<unsigned char>(type) & 0xf));
568
}
569
 
570
// Symbol visibility from Sym st_other field.
571
 
572
enum STV
573
{
574
  STV_DEFAULT = 0,
575
  STV_INTERNAL = 1,
576
  STV_HIDDEN = 2,
577
  STV_PROTECTED = 3
578
};
579
 
580
inline STV
581
elf_st_visibility(unsigned char other)
582
{
583
  return static_cast<STV>(other & 0x3);
584
}
585
 
586
inline unsigned char
587
elf_st_nonvis(unsigned char other)
588
{
589
  return static_cast<STV>(other >> 2);
590
}
591
 
592
inline unsigned char
593
elf_st_other(STV vis, unsigned char nonvis)
594
{
595
  return ((nonvis << 2)
596
          + (static_cast<unsigned char>(vis) & 3));
597
}
598
 
599
// Reloc information from Rel/Rela r_info field.
600
 
601
template<int size>
602
unsigned int
603
elf_r_sym(typename Elf_types<size>::Elf_WXword);
604
 
605
template<>
606
inline unsigned int
607
elf_r_sym<32>(Elf_Word v)
608
{
609
  return v >> 8;
610
}
611
 
612
template<>
613
inline unsigned int
614
elf_r_sym<64>(Elf_Xword v)
615
{
616
  return v >> 32;
617
}
618
 
619
template<int size>
620
unsigned int
621
elf_r_type(typename Elf_types<size>::Elf_WXword);
622
 
623
template<>
624
inline unsigned int
625
elf_r_type<32>(Elf_Word v)
626
{
627
  return v & 0xff;
628
}
629
 
630
template<>
631
inline unsigned int
632
elf_r_type<64>(Elf_Xword v)
633
{
634
  return v & 0xffffffff;
635
}
636
 
637
template<int size>
638
typename Elf_types<size>::Elf_WXword
639
elf_r_info(unsigned int s, unsigned int t);
640
 
641
template<>
642
inline Elf_Word
643
elf_r_info<32>(unsigned int s, unsigned int t)
644
{
645
  return (s << 8) + (t & 0xff);
646
}
647
 
648
template<>
649
inline Elf_Xword
650
elf_r_info<64>(unsigned int s, unsigned int t)
651
{
652
  return (static_cast<Elf_Xword>(s) << 32) + (t & 0xffffffff);
653
}
654
 
655
// Dynamic tags found in the PT_DYNAMIC segment.
656
 
657
enum DT
658
{
659
  DT_NULL = 0,
660
  DT_NEEDED = 1,
661
  DT_PLTRELSZ = 2,
662
  DT_PLTGOT = 3,
663
  DT_HASH = 4,
664
  DT_STRTAB = 5,
665
  DT_SYMTAB = 6,
666
  DT_RELA = 7,
667
  DT_RELASZ = 8,
668
  DT_RELAENT = 9,
669
  DT_STRSZ = 10,
670
  DT_SYMENT = 11,
671
  DT_INIT = 12,
672
  DT_FINI = 13,
673
  DT_SONAME = 14,
674
  DT_RPATH = 15,
675
  DT_SYMBOLIC = 16,
676
  DT_REL = 17,
677
  DT_RELSZ = 18,
678
  DT_RELENT = 19,
679
  DT_PLTREL = 20,
680
  DT_DEBUG = 21,
681
  DT_TEXTREL = 22,
682
  DT_JMPREL = 23,
683
  DT_BIND_NOW = 24,
684
  DT_INIT_ARRAY = 25,
685
  DT_FINI_ARRAY = 26,
686
  DT_INIT_ARRAYSZ = 27,
687
  DT_FINI_ARRAYSZ = 28,
688
  DT_RUNPATH = 29,
689
  DT_FLAGS = 30,
690
 
691
  // This is used to mark a range of dynamic tags.  It is not really
692
  // a tag value.
693
  DT_ENCODING = 32,
694
 
695
  DT_PREINIT_ARRAY = 32,
696
  DT_PREINIT_ARRAYSZ = 33,
697
  DT_LOOS = 0x6000000d,
698
  DT_HIOS = 0x6ffff000,
699
  DT_LOPROC = 0x70000000,
700
  DT_HIPROC = 0x7fffffff,
701
 
702
  // The remaining values are extensions used by GNU or Solaris.
703
  DT_VALRNGLO = 0x6ffffd00,
704
  DT_GNU_PRELINKED = 0x6ffffdf5,
705
  DT_GNU_CONFLICTSZ = 0x6ffffdf6,
706
  DT_GNU_LIBLISTSZ = 0x6ffffdf7,
707
  DT_CHECKSUM = 0x6ffffdf8,
708
  DT_PLTPADSZ = 0x6ffffdf9,
709
  DT_MOVEENT = 0x6ffffdfa,
710
  DT_MOVESZ = 0x6ffffdfb,
711
  DT_FEATURE = 0x6ffffdfc,
712
  DT_POSFLAG_1 = 0x6ffffdfd,
713
  DT_SYMINSZ = 0x6ffffdfe,
714
  DT_SYMINENT = 0x6ffffdff,
715
  DT_VALRNGHI = 0x6ffffdff,
716
 
717
  DT_ADDRRNGLO = 0x6ffffe00,
718
  DT_GNU_HASH = 0x6ffffef5,
719
  DT_TLSDESC_PLT = 0x6ffffef6,
720
  DT_TLSDESC_GOT = 0x6ffffef7,
721
  DT_GNU_CONFLICT = 0x6ffffef8,
722
  DT_GNU_LIBLIST = 0x6ffffef9,
723
  DT_CONFIG = 0x6ffffefa,
724
  DT_DEPAUDIT = 0x6ffffefb,
725
  DT_AUDIT = 0x6ffffefc,
726
  DT_PLTPAD = 0x6ffffefd,
727
  DT_MOVETAB = 0x6ffffefe,
728
  DT_SYMINFO = 0x6ffffeff,
729
  DT_ADDRRNGHI = 0x6ffffeff,
730
 
731
  DT_RELACOUNT = 0x6ffffff9,
732
  DT_RELCOUNT = 0x6ffffffa,
733
  DT_FLAGS_1 = 0x6ffffffb,
734
  DT_VERDEF = 0x6ffffffc,
735
  DT_VERDEFNUM = 0x6ffffffd,
736
  DT_VERNEED = 0x6ffffffe,
737
  DT_VERNEEDNUM = 0x6fffffff,
738
 
739
  DT_VERSYM = 0x6ffffff0,
740
 
741
  // Specify the value of _GLOBAL_OFFSET_TABLE_.
742
  DT_PPC_GOT = 0x70000000,
743
 
744
  // Specify the start of the .glink section.
745
  DT_PPC64_GLINK = 0x70000000,
746
 
747
  // Specify the start and size of the .opd section.
748
  DT_PPC64_OPD = 0x70000001,
749
  DT_PPC64_OPDSZ = 0x70000002,
750
 
751
  // The index of an STT_SPARC_REGISTER symbol within the DT_SYMTAB
752
  // symbol table.  One dynamic entry exists for every STT_SPARC_REGISTER
753
  // symbol in the symbol table.
754
  DT_SPARC_REGISTER = 0x70000001,
755
 
756 166 khays
  // MIPS specific dynamic array tags.
757
  // 32 bit version number for runtime linker interface.
758
  DT_MIPS_RLD_VERSION = 0x70000001,
759
  // Time stamp.
760
  DT_MIPS_TIME_STAMP = 0x70000002,
761
  // Checksum of external strings and common sizes.
762
  DT_MIPS_ICHECKSUM = 0x70000003,
763
  // Index of version string in string table.
764
  DT_MIPS_IVERSION = 0x70000004,
765
  // 32 bits of flags.
766
  DT_MIPS_FLAGS = 0x70000005,
767
  // Base address of the segment.
768
  DT_MIPS_BASE_ADDRESS = 0x70000006,
769
  // ???
770
  DT_MIPS_MSYM = 0x70000007,
771
  // Address of .conflict section.
772
  DT_MIPS_CONFLICT = 0x70000008,
773
  // Address of .liblist section.
774
  DT_MIPS_LIBLIST = 0x70000009,
775
  // Number of local global offset table entries.
776
  DT_MIPS_LOCAL_GOTNO = 0x7000000a,
777
  // Number of entries in the .conflict section.
778
  DT_MIPS_CONFLICTNO = 0x7000000b,
779
  // Number of entries in the .liblist section.
780
  DT_MIPS_LIBLISTNO = 0x70000010,
781
  // Number of entries in the .dynsym section.
782
  DT_MIPS_SYMTABNO = 0x70000011,
783
  // Index of first external dynamic symbol not referenced locally.
784
  DT_MIPS_UNREFEXTNO = 0x70000012,
785
  // Index of first dynamic symbol in global offset table.
786
  DT_MIPS_GOTSYM = 0x70000013,
787
  // Number of page table entries in global offset table.
788
  DT_MIPS_HIPAGENO = 0x70000014,
789
  // Address of run time loader map, used for debugging.
790
  DT_MIPS_RLD_MAP = 0x70000016,
791
  // Delta C++ class definition.
792
  DT_MIPS_DELTA_CLASS = 0x70000017,
793
  // Number of entries in DT_MIPS_DELTA_CLASS.
794
  DT_MIPS_DELTA_CLASS_NO = 0x70000018,
795
  // Delta C++ class instances.
796
  DT_MIPS_DELTA_INSTANCE = 0x70000019,
797
  // Number of entries in DT_MIPS_DELTA_INSTANCE.
798
  DT_MIPS_DELTA_INSTANCE_NO = 0x7000001a,
799
  // Delta relocations.
800
  DT_MIPS_DELTA_RELOC = 0x7000001b,
801
  // Number of entries in DT_MIPS_DELTA_RELOC.
802
  DT_MIPS_DELTA_RELOC_NO = 0x7000001c,
803
  // Delta symbols that Delta relocations refer to.
804
  DT_MIPS_DELTA_SYM = 0x7000001d,
805
  // Number of entries in DT_MIPS_DELTA_SYM.
806
  DT_MIPS_DELTA_SYM_NO = 0x7000001e,
807
  // Delta symbols that hold class declarations.
808
  DT_MIPS_DELTA_CLASSSYM = 0x70000020,
809
  // Number of entries in DT_MIPS_DELTA_CLASSSYM.
810
  DT_MIPS_DELTA_CLASSSYM_NO = 0x70000021,
811
  // Flags indicating information about C++ flavor.
812
  DT_MIPS_CXX_FLAGS = 0x70000022,
813
  // Pixie information (???).
814
  DT_MIPS_PIXIE_INIT = 0x70000023,
815
  // Address of .MIPS.symlib
816
  DT_MIPS_SYMBOL_LIB = 0x70000024,
817
  // The GOT index of the first PTE for a segment
818
  DT_MIPS_LOCALPAGE_GOTIDX = 0x70000025,
819
  // The GOT index of the first PTE for a local symbol
820
  DT_MIPS_LOCAL_GOTIDX = 0x70000026,
821
  // The GOT index of the first PTE for a hidden symbol
822
  DT_MIPS_HIDDEN_GOTIDX = 0x70000027,
823
  // The GOT index of the first PTE for a protected symbol
824
  DT_MIPS_PROTECTED_GOTIDX = 0x70000028,
825
  // Address of `.MIPS.options'.
826
  DT_MIPS_OPTIONS = 0x70000029,
827
  // Address of `.interface'.
828
  DT_MIPS_INTERFACE = 0x7000002a,
829
  // ???
830
  DT_MIPS_DYNSTR_ALIGN = 0x7000002b,
831
  // Size of the .interface section.
832
  DT_MIPS_INTERFACE_SIZE = 0x7000002c,
833
  // Size of rld_text_resolve function stored in the GOT.
834
  DT_MIPS_RLD_TEXT_RESOLVE_ADDR = 0x7000002d,
835
  // Default suffix of DSO to be added by rld on dlopen() calls.
836
  DT_MIPS_PERF_SUFFIX = 0x7000002e,
837
  // Size of compact relocation section (O32).
838
  DT_MIPS_COMPACT_SIZE = 0x7000002f,
839
  // GP value for auxiliary GOTs.
840
  DT_MIPS_GP_VALUE = 0x70000030,
841
  // Address of auxiliary .dynamic.
842
  DT_MIPS_AUX_DYNAMIC = 0x70000031,
843
  // Address of the base of the PLTGOT.
844
  DT_MIPS_PLTGOT = 0x70000032,
845
  // Points to the base of a writable PLT.
846
  DT_MIPS_RWPLT = 0x70000034,
847
 
848 20 khays
  DT_AUXILIARY = 0x7ffffffd,
849
  DT_USED = 0x7ffffffe,
850
  DT_FILTER = 0x7fffffff
851
};
852
 
853
// Flags found in the DT_FLAGS dynamic element.
854
 
855
enum DF
856
{
857
  DF_ORIGIN = 0x1,
858
  DF_SYMBOLIC = 0x2,
859
  DF_TEXTREL = 0x4,
860
  DF_BIND_NOW = 0x8,
861
  DF_STATIC_TLS = 0x10
862
};
863
 
864
// Flags found in the DT_FLAGS_1 dynamic element.
865
 
866
enum DF_1
867
{
868
  DF_1_NOW = 0x1,
869
  DF_1_GLOBAL = 0x2,
870
  DF_1_GROUP = 0x4,
871
  DF_1_NODELETE = 0x8,
872
  DF_1_LOADFLTR = 0x10,
873
  DF_1_INITFIRST = 0x20,
874
  DF_1_NOOPEN = 0x40,
875
  DF_1_ORIGIN = 0x80,
876
  DF_1_DIRECT = 0x100,
877
  DF_1_TRANS = 0x200,
878
  DF_1_INTERPOSE = 0x400,
879
  DF_1_NODEFLIB = 0x800,
880
  DF_1_NODUMP = 0x1000,
881
  DF_1_CONLFAT = 0x2000
882
};
883
 
884
// Version numbers which appear in the vd_version field of a Verdef
885
// structure.
886
 
887
const int VER_DEF_NONE = 0;
888
const int VER_DEF_CURRENT = 1;
889
 
890
// Version numbers which appear in the vn_version field of a Verneed
891
// structure.
892
 
893
const int VER_NEED_NONE = 0;
894
const int VER_NEED_CURRENT = 1;
895
 
896
// Bit flags which appear in vd_flags of Verdef and vna_flags of
897
// Vernaux.
898
 
899
const int VER_FLG_BASE = 0x1;
900
const int VER_FLG_WEAK = 0x2;
901
const int VER_FLG_INFO = 0x4;
902
 
903
// Special constants found in the SHT_GNU_versym entries.
904
 
905
const int VER_NDX_LOCAL = 0;
906
const int VER_NDX_GLOBAL = 1;
907
 
908
// A SHT_GNU_versym section holds 16-bit words.  This bit is set if
909
// the symbol is hidden and can only be seen when referenced using an
910
// explicit version number.  This is a GNU extension.
911
 
912
const int VERSYM_HIDDEN = 0x8000;
913
 
914
// This is the mask for the rest of the data in a word read from a
915
// SHT_GNU_versym section.
916
 
917
const int VERSYM_VERSION = 0x7fff;
918
 
919
// Note descriptor type codes for notes in a non-core file with an
920
// empty name.
921
 
922
enum
923
{
924
  // A version string.
925
  NT_VERSION = 1,
926
  // An architecture string.
927
  NT_ARCH = 2
928
};
929
 
930
// Note descriptor type codes for notes in a non-core file with the
931
// name "GNU".
932
 
933
enum
934
{
935
  // The minimum ABI level.  This is used by the dynamic linker to
936
  // describe the minimal kernel version on which a shared library may
937
  // be used.  Th value should be four words.  Word 0 is an OS
938
  // descriptor (see below).  Word 1 is the major version of the ABI.
939
  // Word 2 is the minor version.  Word 3 is the subminor version.
940
  NT_GNU_ABI_TAG = 1,
941
  // Hardware capabilities information.  Word 0 is the number of
942
  // entries.  Word 1 is a bitmask of enabled entries.  The rest of
943
  // the descriptor is a series of entries, where each entry is a
944
  // single byte followed by a nul terminated string.  The byte gives
945
  // the bit number to test if enabled in the bitmask.
946
  NT_GNU_HWCAP = 2,
947
  // The build ID as set by the linker's --build-id option.  The
948
  // format of the descriptor depends on the build ID style.
949
  NT_GNU_BUILD_ID = 3,
950
  // The version of gold used to link.  Th descriptor is just a
951
  // string.
952
  NT_GNU_GOLD_VERSION = 4
953
};
954
 
955
// The OS values which may appear in word 0 of a NT_GNU_ABI_TAG note.
956
 
957
enum
958
{
959
  ELF_NOTE_OS_LINUX = 0,
960
  ELF_NOTE_OS_GNU = 1,
961
  ELF_NOTE_OS_SOLARIS2 = 2,
962
  ELF_NOTE_OS_FREEBSD = 3,
963
  ELF_NOTE_OS_NETBSD = 4,
964
  ELF_NOTE_OS_SYLLABLE = 5
965
};
966
 
967
} // End namespace elfcpp.
968
 
969
// Include internal details after defining the types.
970
#include "elfcpp_internal.h"
971
 
972
namespace elfcpp
973
{
974
 
975
// The offset of the ELF file header in the ELF file.
976
 
977
const int file_header_offset = 0;
978
 
979
// ELF structure sizes.
980
 
981
template<int size>
982
struct Elf_sizes
983
{
984
  // Size of ELF file header.
985
  static const int ehdr_size = sizeof(internal::Ehdr_data<size>);
986
  // Size of ELF segment header.
987
  static const int phdr_size = sizeof(internal::Phdr_data<size>);
988
  // Size of ELF section header.
989
  static const int shdr_size = sizeof(internal::Shdr_data<size>);
990
  // Size of ELF symbol table entry.
991
  static const int sym_size = sizeof(internal::Sym_data<size>);
992
  // Sizes of ELF reloc entries.
993
  static const int rel_size = sizeof(internal::Rel_data<size>);
994
  static const int rela_size = sizeof(internal::Rela_data<size>);
995
  // Size of ELF dynamic entry.
996
  static const int dyn_size = sizeof(internal::Dyn_data<size>);
997
  // Size of ELF version structures.
998
  static const int verdef_size = sizeof(internal::Verdef_data);
999
  static const int verdaux_size = sizeof(internal::Verdaux_data);
1000
  static const int verneed_size = sizeof(internal::Verneed_data);
1001
  static const int vernaux_size = sizeof(internal::Vernaux_data);
1002
};
1003
 
1004
// Accessor class for the ELF file header.
1005
 
1006
template<int size, bool big_endian>
1007
class Ehdr
1008
{
1009
 public:
1010
  Ehdr(const unsigned char* p)
1011
    : p_(reinterpret_cast<const internal::Ehdr_data<size>*>(p))
1012
  { }
1013
 
1014
  template<typename File>
1015
  Ehdr(File* file, typename File::Location loc)
1016
    : p_(reinterpret_cast<const internal::Ehdr_data<size>*>(
1017
           file->view(loc.file_offset, loc.data_size).data()))
1018
  { }
1019
 
1020
  const unsigned char*
1021
  get_e_ident() const
1022
  { return this->p_->e_ident; }
1023
 
1024
  Elf_Half
1025
  get_e_type() const
1026
  { return Convert<16, big_endian>::convert_host(this->p_->e_type); }
1027
 
1028
  Elf_Half
1029
  get_e_machine() const
1030
  { return Convert<16, big_endian>::convert_host(this->p_->e_machine); }
1031
 
1032
  Elf_Word
1033
  get_e_version() const
1034
  { return Convert<32, big_endian>::convert_host(this->p_->e_version); }
1035
 
1036
  typename Elf_types<size>::Elf_Addr
1037
  get_e_entry() const
1038
  { return Convert<size, big_endian>::convert_host(this->p_->e_entry); }
1039
 
1040
  typename Elf_types<size>::Elf_Off
1041
  get_e_phoff() const
1042
  { return Convert<size, big_endian>::convert_host(this->p_->e_phoff); }
1043
 
1044
  typename Elf_types<size>::Elf_Off
1045
  get_e_shoff() const
1046
  { return Convert<size, big_endian>::convert_host(this->p_->e_shoff); }
1047
 
1048
  Elf_Word
1049
  get_e_flags() const
1050
  { return Convert<32, big_endian>::convert_host(this->p_->e_flags); }
1051
 
1052
  Elf_Half
1053
  get_e_ehsize() const
1054
  { return Convert<16, big_endian>::convert_host(this->p_->e_ehsize); }
1055
 
1056
  Elf_Half
1057
  get_e_phentsize() const
1058
  { return Convert<16, big_endian>::convert_host(this->p_->e_phentsize); }
1059
 
1060
  Elf_Half
1061
  get_e_phnum() const
1062
  { return Convert<16, big_endian>::convert_host(this->p_->e_phnum); }
1063
 
1064
  Elf_Half
1065
  get_e_shentsize() const
1066
  { return Convert<16, big_endian>::convert_host(this->p_->e_shentsize); }
1067
 
1068
  Elf_Half
1069
  get_e_shnum() const
1070
  { return Convert<16, big_endian>::convert_host(this->p_->e_shnum); }
1071
 
1072
  Elf_Half
1073
  get_e_shstrndx() const
1074
  { return Convert<16, big_endian>::convert_host(this->p_->e_shstrndx); }
1075
 
1076
 private:
1077
  const internal::Ehdr_data<size>* p_;
1078
};
1079
 
1080
// Write class for the ELF file header.
1081
 
1082
template<int size, bool big_endian>
1083
class Ehdr_write
1084
{
1085
 public:
1086
  Ehdr_write(unsigned char* p)
1087
    : p_(reinterpret_cast<internal::Ehdr_data<size>*>(p))
1088
  { }
1089
 
1090
  void
1091
  put_e_ident(const unsigned char v[EI_NIDENT]) const
1092
  { memcpy(this->p_->e_ident, v, EI_NIDENT); }
1093
 
1094
  void
1095
  put_e_type(Elf_Half v)
1096
  { this->p_->e_type = Convert<16, big_endian>::convert_host(v); }
1097
 
1098
  void
1099
  put_e_machine(Elf_Half v)
1100
  { this->p_->e_machine = Convert<16, big_endian>::convert_host(v); }
1101
 
1102
  void
1103
  put_e_version(Elf_Word v)
1104
  { this->p_->e_version = Convert<32, big_endian>::convert_host(v); }
1105
 
1106
  void
1107
  put_e_entry(typename Elf_types<size>::Elf_Addr v)
1108
  { this->p_->e_entry = Convert<size, big_endian>::convert_host(v); }
1109
 
1110
  void
1111
  put_e_phoff(typename Elf_types<size>::Elf_Off v)
1112
  { this->p_->e_phoff = Convert<size, big_endian>::convert_host(v); }
1113
 
1114
  void
1115
  put_e_shoff(typename Elf_types<size>::Elf_Off v)
1116
  { this->p_->e_shoff = Convert<size, big_endian>::convert_host(v); }
1117
 
1118
  void
1119
  put_e_flags(Elf_Word v)
1120
  { this->p_->e_flags = Convert<32, big_endian>::convert_host(v); }
1121
 
1122
  void
1123
  put_e_ehsize(Elf_Half v)
1124
  { this->p_->e_ehsize = Convert<16, big_endian>::convert_host(v); }
1125
 
1126
  void
1127
  put_e_phentsize(Elf_Half v)
1128
  { this->p_->e_phentsize = Convert<16, big_endian>::convert_host(v); }
1129
 
1130
  void
1131
  put_e_phnum(Elf_Half v)
1132
  { this->p_->e_phnum = Convert<16, big_endian>::convert_host(v); }
1133
 
1134
  void
1135
  put_e_shentsize(Elf_Half v)
1136
  { this->p_->e_shentsize = Convert<16, big_endian>::convert_host(v); }
1137
 
1138
  void
1139
  put_e_shnum(Elf_Half v)
1140
  { this->p_->e_shnum = Convert<16, big_endian>::convert_host(v); }
1141
 
1142
  void
1143
  put_e_shstrndx(Elf_Half v)
1144
  { this->p_->e_shstrndx = Convert<16, big_endian>::convert_host(v); }
1145
 
1146
 private:
1147
  internal::Ehdr_data<size>* p_;
1148
};
1149
 
1150
// Accessor class for an ELF section header.
1151
 
1152
template<int size, bool big_endian>
1153
class Shdr
1154
{
1155
 public:
1156
  Shdr(const unsigned char* p)
1157
    : p_(reinterpret_cast<const internal::Shdr_data<size>*>(p))
1158
  { }
1159
 
1160
  template<typename File>
1161
  Shdr(File* file, typename File::Location loc)
1162
    : p_(reinterpret_cast<const internal::Shdr_data<size>*>(
1163
           file->view(loc.file_offset, loc.data_size).data()))
1164
  { }
1165
 
1166
  Elf_Word
1167
  get_sh_name() const
1168
  { return Convert<32, big_endian>::convert_host(this->p_->sh_name); }
1169
 
1170
  Elf_Word
1171
  get_sh_type() const
1172
  { return Convert<32, big_endian>::convert_host(this->p_->sh_type); }
1173
 
1174
  typename Elf_types<size>::Elf_WXword
1175
  get_sh_flags() const
1176
  { return Convert<size, big_endian>::convert_host(this->p_->sh_flags); }
1177
 
1178
  typename Elf_types<size>::Elf_Addr
1179
  get_sh_addr() const
1180
  { return Convert<size, big_endian>::convert_host(this->p_->sh_addr); }
1181
 
1182
  typename Elf_types<size>::Elf_Off
1183
  get_sh_offset() const
1184
  { return Convert<size, big_endian>::convert_host(this->p_->sh_offset); }
1185
 
1186
  typename Elf_types<size>::Elf_WXword
1187
  get_sh_size() const
1188
  { return Convert<size, big_endian>::convert_host(this->p_->sh_size); }
1189
 
1190
  Elf_Word
1191
  get_sh_link() const
1192
  { return Convert<32, big_endian>::convert_host(this->p_->sh_link); }
1193
 
1194
  Elf_Word
1195
  get_sh_info() const
1196
  { return Convert<32, big_endian>::convert_host(this->p_->sh_info); }
1197
 
1198
  typename Elf_types<size>::Elf_WXword
1199
  get_sh_addralign() const
1200
  { return
1201
      Convert<size, big_endian>::convert_host(this->p_->sh_addralign); }
1202
 
1203
  typename Elf_types<size>::Elf_WXword
1204
  get_sh_entsize() const
1205
  { return Convert<size, big_endian>::convert_host(this->p_->sh_entsize); }
1206
 
1207
 private:
1208
  const internal::Shdr_data<size>* p_;
1209
};
1210
 
1211
// Write class for an ELF section header.
1212
 
1213
template<int size, bool big_endian>
1214
class Shdr_write
1215
{
1216
 public:
1217
  Shdr_write(unsigned char* p)
1218
    : p_(reinterpret_cast<internal::Shdr_data<size>*>(p))
1219
  { }
1220
 
1221
  void
1222
  put_sh_name(Elf_Word v)
1223
  { this->p_->sh_name = Convert<32, big_endian>::convert_host(v); }
1224
 
1225
  void
1226
  put_sh_type(Elf_Word v)
1227
  { this->p_->sh_type = Convert<32, big_endian>::convert_host(v); }
1228
 
1229
  void
1230
  put_sh_flags(typename Elf_types<size>::Elf_WXword v)
1231
  { this->p_->sh_flags = Convert<size, big_endian>::convert_host(v); }
1232
 
1233
  void
1234
  put_sh_addr(typename Elf_types<size>::Elf_Addr v)
1235
  { this->p_->sh_addr = Convert<size, big_endian>::convert_host(v); }
1236
 
1237
  void
1238
  put_sh_offset(typename Elf_types<size>::Elf_Off v)
1239
  { this->p_->sh_offset = Convert<size, big_endian>::convert_host(v); }
1240
 
1241
  void
1242
  put_sh_size(typename Elf_types<size>::Elf_WXword v)
1243
  { this->p_->sh_size = Convert<size, big_endian>::convert_host(v); }
1244
 
1245
  void
1246
  put_sh_link(Elf_Word v)
1247
  { this->p_->sh_link = Convert<32, big_endian>::convert_host(v); }
1248
 
1249
  void
1250
  put_sh_info(Elf_Word v)
1251
  { this->p_->sh_info = Convert<32, big_endian>::convert_host(v); }
1252
 
1253
  void
1254
  put_sh_addralign(typename Elf_types<size>::Elf_WXword v)
1255
  { this->p_->sh_addralign = Convert<size, big_endian>::convert_host(v); }
1256
 
1257
  void
1258
  put_sh_entsize(typename Elf_types<size>::Elf_WXword v)
1259
  { this->p_->sh_entsize = Convert<size, big_endian>::convert_host(v); }
1260
 
1261
 private:
1262
  internal::Shdr_data<size>* p_;
1263
};
1264
 
1265
// Accessor class for an ELF segment header.
1266
 
1267
template<int size, bool big_endian>
1268
class Phdr
1269
{
1270
 public:
1271
  Phdr(const unsigned char* p)
1272
    : p_(reinterpret_cast<const internal::Phdr_data<size>*>(p))
1273
  { }
1274
 
1275
  template<typename File>
1276
  Phdr(File* file, typename File::Location loc)
1277
    : p_(reinterpret_cast<internal::Phdr_data<size>*>(
1278
           file->view(loc.file_offset, loc.data_size).data()))
1279
  { }
1280
 
1281
  Elf_Word
1282
  get_p_type() const
1283
  { return Convert<32, big_endian>::convert_host(this->p_->p_type); }
1284
 
1285
  typename Elf_types<size>::Elf_Off
1286
  get_p_offset() const
1287
  { return Convert<size, big_endian>::convert_host(this->p_->p_offset); }
1288
 
1289
  typename Elf_types<size>::Elf_Addr
1290
  get_p_vaddr() const
1291
  { return Convert<size, big_endian>::convert_host(this->p_->p_vaddr); }
1292
 
1293
  typename Elf_types<size>::Elf_Addr
1294
  get_p_paddr() const
1295
  { return Convert<size, big_endian>::convert_host(this->p_->p_paddr); }
1296
 
1297
  typename Elf_types<size>::Elf_WXword
1298
  get_p_filesz() const
1299
  { return Convert<size, big_endian>::convert_host(this->p_->p_filesz); }
1300
 
1301
  typename Elf_types<size>::Elf_WXword
1302
  get_p_memsz() const
1303
  { return Convert<size, big_endian>::convert_host(this->p_->p_memsz); }
1304
 
1305
  Elf_Word
1306
  get_p_flags() const
1307
  { return Convert<32, big_endian>::convert_host(this->p_->p_flags); }
1308
 
1309
  typename Elf_types<size>::Elf_WXword
1310
  get_p_align() const
1311
  { return Convert<size, big_endian>::convert_host(this->p_->p_align); }
1312
 
1313
 private:
1314
  const internal::Phdr_data<size>* p_;
1315
};
1316
 
1317
// Write class for an ELF segment header.
1318
 
1319
template<int size, bool big_endian>
1320
class Phdr_write
1321
{
1322
 public:
1323
  Phdr_write(unsigned char* p)
1324
    : p_(reinterpret_cast<internal::Phdr_data<size>*>(p))
1325
  { }
1326
 
1327
  void
1328
  put_p_type(Elf_Word v)
1329
  { this->p_->p_type = Convert<32, big_endian>::convert_host(v); }
1330
 
1331
  void
1332
  put_p_offset(typename Elf_types<size>::Elf_Off v)
1333
  { this->p_->p_offset = Convert<size, big_endian>::convert_host(v); }
1334
 
1335
  void
1336
  put_p_vaddr(typename Elf_types<size>::Elf_Addr v)
1337
  { this->p_->p_vaddr = Convert<size, big_endian>::convert_host(v); }
1338
 
1339
  void
1340
  put_p_paddr(typename Elf_types<size>::Elf_Addr v)
1341
  { this->p_->p_paddr = Convert<size, big_endian>::convert_host(v); }
1342
 
1343
  void
1344
  put_p_filesz(typename Elf_types<size>::Elf_WXword v)
1345
  { this->p_->p_filesz = Convert<size, big_endian>::convert_host(v); }
1346
 
1347
  void
1348
  put_p_memsz(typename Elf_types<size>::Elf_WXword v)
1349
  { this->p_->p_memsz = Convert<size, big_endian>::convert_host(v); }
1350
 
1351
  void
1352
  put_p_flags(Elf_Word v)
1353
  { this->p_->p_flags = Convert<32, big_endian>::convert_host(v); }
1354
 
1355
  void
1356
  put_p_align(typename Elf_types<size>::Elf_WXword v)
1357
  { this->p_->p_align = Convert<size, big_endian>::convert_host(v); }
1358
 
1359
 private:
1360
  internal::Phdr_data<size>* p_;
1361
};
1362
 
1363
// Accessor class for an ELF symbol table entry.
1364
 
1365
template<int size, bool big_endian>
1366
class Sym
1367
{
1368
 public:
1369
  Sym(const unsigned char* p)
1370
    : p_(reinterpret_cast<const internal::Sym_data<size>*>(p))
1371
  { }
1372
 
1373
  template<typename File>
1374
  Sym(File* file, typename File::Location loc)
1375
    : p_(reinterpret_cast<const internal::Sym_data<size>*>(
1376
           file->view(loc.file_offset, loc.data_size).data()))
1377
  { }
1378
 
1379
  Elf_Word
1380
  get_st_name() const
1381
  { return Convert<32, big_endian>::convert_host(this->p_->st_name); }
1382
 
1383
  typename Elf_types<size>::Elf_Addr
1384
  get_st_value() const
1385
  { return Convert<size, big_endian>::convert_host(this->p_->st_value); }
1386
 
1387
  typename Elf_types<size>::Elf_WXword
1388
  get_st_size() const
1389
  { return Convert<size, big_endian>::convert_host(this->p_->st_size); }
1390
 
1391
  unsigned char
1392
  get_st_info() const
1393
  { return this->p_->st_info; }
1394
 
1395
  STB
1396
  get_st_bind() const
1397
  { return elf_st_bind(this->get_st_info()); }
1398
 
1399
  STT
1400
  get_st_type() const
1401
  { return elf_st_type(this->get_st_info()); }
1402
 
1403
  unsigned char
1404
  get_st_other() const
1405
  { return this->p_->st_other; }
1406
 
1407
  STV
1408
  get_st_visibility() const
1409
  { return elf_st_visibility(this->get_st_other()); }
1410
 
1411
  unsigned char
1412
  get_st_nonvis() const
1413
  { return elf_st_nonvis(this->get_st_other()); }
1414
 
1415
  Elf_Half
1416
  get_st_shndx() const
1417
  { return Convert<16, big_endian>::convert_host(this->p_->st_shndx); }
1418
 
1419
 private:
1420
  const internal::Sym_data<size>* p_;
1421
};
1422
 
1423
// Writer class for an ELF symbol table entry.
1424
 
1425
template<int size, bool big_endian>
1426
class Sym_write
1427
{
1428
 public:
1429
  Sym_write(unsigned char* p)
1430
    : p_(reinterpret_cast<internal::Sym_data<size>*>(p))
1431
  { }
1432
 
1433
  void
1434
  put_st_name(Elf_Word v)
1435
  { this->p_->st_name = Convert<32, big_endian>::convert_host(v); }
1436
 
1437
  void
1438
  put_st_value(typename Elf_types<size>::Elf_Addr v)
1439
  { this->p_->st_value = Convert<size, big_endian>::convert_host(v); }
1440
 
1441
  void
1442
  put_st_size(typename Elf_types<size>::Elf_WXword v)
1443
  { this->p_->st_size = Convert<size, big_endian>::convert_host(v); }
1444
 
1445
  void
1446
  put_st_info(unsigned char v)
1447
  { this->p_->st_info = v; }
1448
 
1449
  void
1450
  put_st_info(STB bind, STT type)
1451
  { this->p_->st_info = elf_st_info(bind, type); }
1452
 
1453
  void
1454
  put_st_other(unsigned char v)
1455
  { this->p_->st_other = v; }
1456
 
1457
  void
1458
  put_st_other(STV vis, unsigned char nonvis)
1459
  { this->p_->st_other = elf_st_other(vis, nonvis); }
1460
 
1461
  void
1462
  put_st_shndx(Elf_Half v)
1463
  { this->p_->st_shndx = Convert<16, big_endian>::convert_host(v); }
1464
 
1465
  Sym<size, big_endian>
1466
  sym()
1467
  { return Sym<size, big_endian>(reinterpret_cast<unsigned char*>(this->p_)); }
1468
 
1469
 private:
1470
  internal::Sym_data<size>* p_;
1471
};
1472
 
1473
// Accessor classes for an ELF REL relocation entry.
1474
 
1475
template<int size, bool big_endian>
1476
class Rel
1477
{
1478
 public:
1479
  Rel(const unsigned char* p)
1480
    : p_(reinterpret_cast<const internal::Rel_data<size>*>(p))
1481
  { }
1482
 
1483
  template<typename File>
1484
  Rel(File* file, typename File::Location loc)
1485
    : p_(reinterpret_cast<const internal::Rel_data<size>*>(
1486
           file->view(loc.file_offset, loc.data_size).data()))
1487
  { }
1488
 
1489
  typename Elf_types<size>::Elf_Addr
1490
  get_r_offset() const
1491
  { return Convert<size, big_endian>::convert_host(this->p_->r_offset); }
1492
 
1493
  typename Elf_types<size>::Elf_WXword
1494
  get_r_info() const
1495
  { return Convert<size, big_endian>::convert_host(this->p_->r_info); }
1496
 
1497
 private:
1498
  const internal::Rel_data<size>* p_;
1499
};
1500
 
1501
// Writer class for an ELF Rel relocation.
1502
 
1503
template<int size, bool big_endian>
1504
class Rel_write
1505
{
1506
 public:
1507
  Rel_write(unsigned char* p)
1508
    : p_(reinterpret_cast<internal::Rel_data<size>*>(p))
1509
  { }
1510
 
1511
  void
1512
  put_r_offset(typename Elf_types<size>::Elf_Addr v)
1513
  { this->p_->r_offset = Convert<size, big_endian>::convert_host(v); }
1514
 
1515
  void
1516
  put_r_info(typename Elf_types<size>::Elf_WXword v)
1517
  { this->p_->r_info = Convert<size, big_endian>::convert_host(v); }
1518
 
1519
 private:
1520
  internal::Rel_data<size>* p_;
1521
};
1522
 
1523
// Accessor class for an ELF Rela relocation.
1524
 
1525
template<int size, bool big_endian>
1526
class Rela
1527
{
1528
 public:
1529
  Rela(const unsigned char* p)
1530
    : p_(reinterpret_cast<const internal::Rela_data<size>*>(p))
1531
  { }
1532
 
1533
  template<typename File>
1534
  Rela(File* file, typename File::Location loc)
1535
    : p_(reinterpret_cast<const internal::Rela_data<size>*>(
1536
           file->view(loc.file_offset, loc.data_size).data()))
1537
  { }
1538
 
1539
  typename Elf_types<size>::Elf_Addr
1540
  get_r_offset() const
1541
  { return Convert<size, big_endian>::convert_host(this->p_->r_offset); }
1542
 
1543
  typename Elf_types<size>::Elf_WXword
1544
  get_r_info() const
1545
  { return Convert<size, big_endian>::convert_host(this->p_->r_info); }
1546
 
1547
  typename Elf_types<size>::Elf_Swxword
1548
  get_r_addend() const
1549
  { return Convert<size, big_endian>::convert_host(this->p_->r_addend); }
1550
 
1551
 private:
1552
  const internal::Rela_data<size>* p_;
1553
};
1554
 
1555
// Writer class for an ELF Rela relocation.
1556
 
1557
template<int size, bool big_endian>
1558
class Rela_write
1559
{
1560
 public:
1561
  Rela_write(unsigned char* p)
1562
    : p_(reinterpret_cast<internal::Rela_data<size>*>(p))
1563
  { }
1564
 
1565
  void
1566
  put_r_offset(typename Elf_types<size>::Elf_Addr v)
1567
  { this->p_->r_offset = Convert<size, big_endian>::convert_host(v); }
1568
 
1569
  void
1570
  put_r_info(typename Elf_types<size>::Elf_WXword v)
1571
  { this->p_->r_info = Convert<size, big_endian>::convert_host(v); }
1572
 
1573
  void
1574
  put_r_addend(typename Elf_types<size>::Elf_Swxword v)
1575
  { this->p_->r_addend = Convert<size, big_endian>::convert_host(v); }
1576
 
1577
 private:
1578
  internal::Rela_data<size>* p_;
1579
};
1580
 
1581
// Accessor classes for entries in the ELF SHT_DYNAMIC section aka
1582
// PT_DYNAMIC segment.
1583
 
1584
template<int size, bool big_endian>
1585
class Dyn
1586
{
1587
 public:
1588
  Dyn(const unsigned char* p)
1589
    : p_(reinterpret_cast<const internal::Dyn_data<size>*>(p))
1590
  { }
1591
 
1592
  template<typename File>
1593
  Dyn(File* file, typename File::Location loc)
1594
    : p_(reinterpret_cast<const internal::Dyn_data<size>*>(
1595
           file->view(loc.file_offset, loc.data_size).data()))
1596
  { }
1597
 
1598
  typename Elf_types<size>::Elf_Swxword
1599
  get_d_tag() const
1600
  { return Convert<size, big_endian>::convert_host(this->p_->d_tag); }
1601
 
1602
  typename Elf_types<size>::Elf_WXword
1603
  get_d_val() const
1604
  { return Convert<size, big_endian>::convert_host(this->p_->d_val); }
1605
 
1606
  typename Elf_types<size>::Elf_Addr
1607
  get_d_ptr() const
1608
  { return Convert<size, big_endian>::convert_host(this->p_->d_val); }
1609
 
1610
 private:
1611
  const internal::Dyn_data<size>* p_;
1612
};
1613
 
1614
// Write class for an entry in the SHT_DYNAMIC section.
1615
 
1616
template<int size, bool big_endian>
1617
class Dyn_write
1618
{
1619
 public:
1620
  Dyn_write(unsigned char* p)
1621
    : p_(reinterpret_cast<internal::Dyn_data<size>*>(p))
1622
  { }
1623
 
1624
  void
1625
  put_d_tag(typename Elf_types<size>::Elf_Swxword v)
1626
  { this->p_->d_tag = Convert<size, big_endian>::convert_host(v); }
1627
 
1628
  void
1629
  put_d_val(typename Elf_types<size>::Elf_WXword v)
1630
  { this->p_->d_val = Convert<size, big_endian>::convert_host(v); }
1631
 
1632
  void
1633
  put_d_ptr(typename Elf_types<size>::Elf_Addr v)
1634
  { this->p_->d_val = Convert<size, big_endian>::convert_host(v); }
1635
 
1636
 private:
1637
  internal::Dyn_data<size>* p_;
1638
};
1639
 
1640
// Accessor classes for entries in the ELF SHT_GNU_verdef section.
1641
 
1642
template<int size, bool big_endian>
1643
class Verdef
1644
{
1645
 public:
1646
  Verdef(const unsigned char* p)
1647
    : p_(reinterpret_cast<const internal::Verdef_data*>(p))
1648
  { }
1649
 
1650
  template<typename File>
1651
  Verdef(File* file, typename File::Location loc)
1652
    : p_(reinterpret_cast<const internal::Verdef_data*>(
1653
           file->view(loc.file_offset, loc.data_size).data()))
1654
  { }
1655
 
1656
  Elf_Half
1657
  get_vd_version() const
1658
  { return Convert<16, big_endian>::convert_host(this->p_->vd_version); }
1659
 
1660
  Elf_Half
1661
  get_vd_flags() const
1662
  { return Convert<16, big_endian>::convert_host(this->p_->vd_flags); }
1663
 
1664
  Elf_Half
1665
  get_vd_ndx() const
1666
  { return Convert<16, big_endian>::convert_host(this->p_->vd_ndx); }
1667
 
1668
  Elf_Half
1669
  get_vd_cnt() const
1670
  { return Convert<16, big_endian>::convert_host(this->p_->vd_cnt); }
1671
 
1672
  Elf_Word
1673
  get_vd_hash() const
1674
  { return Convert<32, big_endian>::convert_host(this->p_->vd_hash); }
1675
 
1676
  Elf_Word
1677
  get_vd_aux() const
1678
  { return Convert<32, big_endian>::convert_host(this->p_->vd_aux); }
1679
 
1680
  Elf_Word
1681
  get_vd_next() const
1682
  { return Convert<32, big_endian>::convert_host(this->p_->vd_next); }
1683
 
1684
 private:
1685
  const internal::Verdef_data* p_;
1686
};
1687
 
1688
template<int size, bool big_endian>
1689
class Verdef_write
1690
{
1691
 public:
1692
  Verdef_write(unsigned char* p)
1693
    : p_(reinterpret_cast<internal::Verdef_data*>(p))
1694
  { }
1695
 
1696
  void
1697
  set_vd_version(Elf_Half v)
1698
  { this->p_->vd_version = Convert<16, big_endian>::convert_host(v); }
1699
 
1700
  void
1701
  set_vd_flags(Elf_Half v)
1702
  { this->p_->vd_flags = Convert<16, big_endian>::convert_host(v); }
1703
 
1704
  void
1705
  set_vd_ndx(Elf_Half v)
1706
  { this->p_->vd_ndx = Convert<16, big_endian>::convert_host(v); }
1707
 
1708
  void
1709
  set_vd_cnt(Elf_Half v)
1710
  { this->p_->vd_cnt = Convert<16, big_endian>::convert_host(v); }
1711
 
1712
  void
1713
  set_vd_hash(Elf_Word v)
1714
  { this->p_->vd_hash = Convert<32, big_endian>::convert_host(v); }
1715
 
1716
  void
1717
  set_vd_aux(Elf_Word v)
1718
  { this->p_->vd_aux = Convert<32, big_endian>::convert_host(v); }
1719
 
1720
  void
1721
  set_vd_next(Elf_Word v)
1722
  { this->p_->vd_next = Convert<32, big_endian>::convert_host(v); }
1723
 
1724
 private:
1725
  internal::Verdef_data* p_;
1726
};
1727
 
1728
// Accessor classes for auxiliary entries in the ELF SHT_GNU_verdef
1729
// section.
1730
 
1731
template<int size, bool big_endian>
1732
class Verdaux
1733
{
1734
 public:
1735
  Verdaux(const unsigned char* p)
1736
    : p_(reinterpret_cast<const internal::Verdaux_data*>(p))
1737
  { }
1738
 
1739
  template<typename File>
1740
  Verdaux(File* file, typename File::Location loc)
1741
    : p_(reinterpret_cast<const internal::Verdaux_data*>(
1742
           file->view(loc.file_offset, loc.data_size).data()))
1743
  { }
1744
 
1745
  Elf_Word
1746
  get_vda_name() const
1747
  { return Convert<32, big_endian>::convert_host(this->p_->vda_name); }
1748
 
1749
  Elf_Word
1750
  get_vda_next() const
1751
  { return Convert<32, big_endian>::convert_host(this->p_->vda_next); }
1752
 
1753
 private:
1754
  const internal::Verdaux_data* p_;
1755
};
1756
 
1757
template<int size, bool big_endian>
1758
class Verdaux_write
1759
{
1760
 public:
1761
  Verdaux_write(unsigned char* p)
1762
    : p_(reinterpret_cast<internal::Verdaux_data*>(p))
1763
  { }
1764
 
1765
  void
1766
  set_vda_name(Elf_Word v)
1767
  { this->p_->vda_name = Convert<32, big_endian>::convert_host(v); }
1768
 
1769
  void
1770
  set_vda_next(Elf_Word v)
1771
  { this->p_->vda_next = Convert<32, big_endian>::convert_host(v); }
1772
 
1773
 private:
1774
  internal::Verdaux_data* p_;
1775
};
1776
 
1777
// Accessor classes for entries in the ELF SHT_GNU_verneed section.
1778
 
1779
template<int size, bool big_endian>
1780
class Verneed
1781
{
1782
 public:
1783
  Verneed(const unsigned char* p)
1784
    : p_(reinterpret_cast<const internal::Verneed_data*>(p))
1785
  { }
1786
 
1787
  template<typename File>
1788
  Verneed(File* file, typename File::Location loc)
1789
    : p_(reinterpret_cast<const internal::Verneed_data*>(
1790
           file->view(loc.file_offset, loc.data_size).data()))
1791
  { }
1792
 
1793
  Elf_Half
1794
  get_vn_version() const
1795
  { return Convert<16, big_endian>::convert_host(this->p_->vn_version); }
1796
 
1797
  Elf_Half
1798
  get_vn_cnt() const
1799
  { return Convert<16, big_endian>::convert_host(this->p_->vn_cnt); }
1800
 
1801
  Elf_Word
1802
  get_vn_file() const
1803
  { return Convert<32, big_endian>::convert_host(this->p_->vn_file); }
1804
 
1805
  Elf_Word
1806
  get_vn_aux() const
1807
  { return Convert<32, big_endian>::convert_host(this->p_->vn_aux); }
1808
 
1809
  Elf_Word
1810
  get_vn_next() const
1811
  { return Convert<32, big_endian>::convert_host(this->p_->vn_next); }
1812
 
1813
 private:
1814
  const internal::Verneed_data* p_;
1815
};
1816
 
1817
template<int size, bool big_endian>
1818
class Verneed_write
1819
{
1820
 public:
1821
  Verneed_write(unsigned char* p)
1822
    : p_(reinterpret_cast<internal::Verneed_data*>(p))
1823
  { }
1824
 
1825
  void
1826
  set_vn_version(Elf_Half v)
1827
  { this->p_->vn_version = Convert<16, big_endian>::convert_host(v); }
1828
 
1829
  void
1830
  set_vn_cnt(Elf_Half v)
1831
  { this->p_->vn_cnt = Convert<16, big_endian>::convert_host(v); }
1832
 
1833
  void
1834
  set_vn_file(Elf_Word v)
1835
  { this->p_->vn_file = Convert<32, big_endian>::convert_host(v); }
1836
 
1837
  void
1838
  set_vn_aux(Elf_Word v)
1839
  { this->p_->vn_aux = Convert<32, big_endian>::convert_host(v); }
1840
 
1841
  void
1842
  set_vn_next(Elf_Word v)
1843
  { this->p_->vn_next = Convert<32, big_endian>::convert_host(v); }
1844
 
1845
 private:
1846
  internal::Verneed_data* p_;
1847
};
1848
 
1849
// Accessor classes for auxiliary entries in the ELF SHT_GNU_verneed
1850
// section.
1851
 
1852
template<int size, bool big_endian>
1853
class Vernaux
1854
{
1855
 public:
1856
  Vernaux(const unsigned char* p)
1857
    : p_(reinterpret_cast<const internal::Vernaux_data*>(p))
1858
  { }
1859
 
1860
  template<typename File>
1861
  Vernaux(File* file, typename File::Location loc)
1862
    : p_(reinterpret_cast<const internal::Vernaux_data*>(
1863
           file->view(loc.file_offset, loc.data_size).data()))
1864
  { }
1865
 
1866
  Elf_Word
1867
  get_vna_hash() const
1868
  { return Convert<32, big_endian>::convert_host(this->p_->vna_hash); }
1869
 
1870
  Elf_Half
1871
  get_vna_flags() const
1872
  { return Convert<16, big_endian>::convert_host(this->p_->vna_flags); }
1873
 
1874
  Elf_Half
1875
  get_vna_other() const
1876
  { return Convert<16, big_endian>::convert_host(this->p_->vna_other); }
1877
 
1878
  Elf_Word
1879
  get_vna_name() const
1880
  { return Convert<32, big_endian>::convert_host(this->p_->vna_name); }
1881
 
1882
  Elf_Word
1883
  get_vna_next() const
1884
  { return Convert<32, big_endian>::convert_host(this->p_->vna_next); }
1885
 
1886
 private:
1887
  const internal::Vernaux_data* p_;
1888
};
1889
 
1890
template<int size, bool big_endian>
1891
class Vernaux_write
1892
{
1893
 public:
1894
  Vernaux_write(unsigned char* p)
1895
    : p_(reinterpret_cast<internal::Vernaux_data*>(p))
1896
  { }
1897
 
1898
  void
1899
  set_vna_hash(Elf_Word v)
1900
  { this->p_->vna_hash = Convert<32, big_endian>::convert_host(v); }
1901
 
1902
  void
1903
  set_vna_flags(Elf_Half v)
1904
  { this->p_->vna_flags = Convert<16, big_endian>::convert_host(v); }
1905
 
1906
  void
1907
  set_vna_other(Elf_Half v)
1908
  { this->p_->vna_other = Convert<16, big_endian>::convert_host(v); }
1909
 
1910
  void
1911
  set_vna_name(Elf_Word v)
1912
  { this->p_->vna_name = Convert<32, big_endian>::convert_host(v); }
1913
 
1914
  void
1915
  set_vna_next(Elf_Word v)
1916
  { this->p_->vna_next = Convert<32, big_endian>::convert_host(v); }
1917
 
1918
 private:
1919
  internal::Vernaux_data* p_;
1920
};
1921
 
1922
} // End namespace elfcpp.
1923
 
1924
#endif // !defined(ELFPCP_H)

powered by: WebSVN 2.1.0

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