CLRX
1
An unofficial OpenCL extensions designed for Radeon GPUs
Main Page
Namespaces
Classes
Files
File List
File Members
CLRX
amdbin
Elf.h
Go to the documentation of this file.
1
/* This file defines standard ELF types, structures, and macros.
2
Copyright (C) 1995-2014 Free Software Foundation, Inc.
3
This file is part of the GNU C Library.
4
5
The GNU C Library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Lesser General Public
7
License as published by the Free Software Foundation; either
8
version 2.1 of the License, or (at your option) any later version.
9
10
The GNU C Library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Lesser General Public License for more details.
14
15
You should have received a copy of the GNU Lesser General Public
16
License along with the GNU C Library; if not, see
17
<http://www.gnu.org/licenses/>. */
18
19
/* Original file 'elf.h' from GLIBC 2.2. Adapted for CLRadeonExtender */
20
25
#ifndef _ELF_H
26
#define _ELF_H 1
27
28
#ifdef __cplusplus
29
extern
"C"
{
30
#endif
31
32
/* Standard ELF types. */
33
34
#include <stdint.h>
35
36
/* Type for a 16-bit quantity. */
37
typedef
uint16_t Elf32_Half;
38
typedef
uint16_t Elf64_Half;
39
40
/* Types for signed and unsigned 32-bit quantities. */
41
typedef
uint32_t Elf32_Word;
42
typedef
int32_t Elf32_Sword;
43
typedef
uint32_t Elf64_Word;
44
typedef
int32_t Elf64_Sword;
45
46
/* Types for signed and unsigned 64-bit quantities. */
47
typedef
uint64_t Elf32_Xword;
48
typedef
int64_t Elf32_Sxword;
49
typedef
uint64_t Elf64_Xword;
50
typedef
int64_t Elf64_Sxword;
51
52
/* Type of addresses. */
53
typedef
uint32_t Elf32_Addr;
54
typedef
uint64_t Elf64_Addr;
55
56
/* Type of file offsets. */
57
typedef
uint32_t Elf32_Off;
58
typedef
uint64_t Elf64_Off;
59
60
/* Type for section indices, which are 16-bit quantities. */
61
typedef
uint16_t Elf32_Section;
62
typedef
uint16_t Elf64_Section;
63
64
/* Type for version symbol information. */
65
typedef
Elf32_Half Elf32_Versym;
66
typedef
Elf64_Half Elf64_Versym;
67
68
69
/* The ELF file header. This appears at the start of every ELF file. */
70
71
#define EI_NIDENT (16)
72
73
typedef
struct
74
{
75
unsigned
char
e_ident[EI_NIDENT];
/* Magic number and other info */
76
Elf32_Half e_type;
/* Object file type */
77
Elf32_Half e_machine;
/* Architecture */
78
Elf32_Word e_version;
/* Object file version */
79
Elf32_Addr e_entry;
/* Entry point virtual address */
80
Elf32_Off e_phoff;
/* Program header table file offset */
81
Elf32_Off e_shoff;
/* Section header table file offset */
82
Elf32_Word e_flags;
/* Processor-specific flags */
83
Elf32_Half e_ehsize;
/* ELF header size in bytes */
84
Elf32_Half e_phentsize;
/* Program header table entry size */
85
Elf32_Half e_phnum;
/* Program header table entry count */
86
Elf32_Half e_shentsize;
/* Section header table entry size */
87
Elf32_Half e_shnum;
/* Section header table entry count */
88
Elf32_Half e_shstrndx;
/* Section header string table index */
89
}
Elf32_Ehdr
;
90
91
typedef
struct
92
{
93
unsigned
char
e_ident[EI_NIDENT];
/* Magic number and other info */
94
Elf64_Half e_type;
/* Object file type */
95
Elf64_Half e_machine;
/* Architecture */
96
Elf64_Word e_version;
/* Object file version */
97
Elf64_Addr e_entry;
/* Entry point virtual address */
98
Elf64_Off e_phoff;
/* Program header table file offset */
99
Elf64_Off e_shoff;
/* Section header table file offset */
100
Elf64_Word e_flags;
/* Processor-specific flags */
101
Elf64_Half e_ehsize;
/* ELF header size in bytes */
102
Elf64_Half e_phentsize;
/* Program header table entry size */
103
Elf64_Half e_phnum;
/* Program header table entry count */
104
Elf64_Half e_shentsize;
/* Section header table entry size */
105
Elf64_Half e_shnum;
/* Section header table entry count */
106
Elf64_Half e_shstrndx;
/* Section header string table index */
107
}
Elf64_Ehdr
;
108
109
/* Fields in the e_ident array. The EI_* macros are indices into the
110
array. The macros under each EI_* macro are the values the byte
111
may have. */
112
113
#define EI_MAG0 0
/* File identification byte 0 index */
114
#define ELFMAG0 0x7f
/* Magic number byte 0 */
115
116
#define EI_MAG1 1
/* File identification byte 1 index */
117
#define ELFMAG1 'E'
/* Magic number byte 1 */
118
119
#define EI_MAG2 2
/* File identification byte 2 index */
120
#define ELFMAG2 'L'
/* Magic number byte 2 */
121
122
#define EI_MAG3 3
/* File identification byte 3 index */
123
#define ELFMAG3 'F'
/* Magic number byte 3 */
124
125
/* Conglomeration of the identification bytes, for easy testing as a word. */
126
#define ELFMAG "\177ELF"
127
#define SELFMAG 4
128
129
#define EI_CLASS 4
/* File class byte index */
130
#define ELFCLASSNONE 0
/* Invalid class */
131
#define ELFCLASS32 1
/* 32-bit objects */
132
#define ELFCLASS64 2
/* 64-bit objects */
133
#define ELFCLASSNUM 3
134
135
#define EI_DATA 5
/* Data encoding byte index */
136
#define ELFDATANONE 0
/* Invalid data encoding */
137
#define ELFDATA2LSB 1
/* 2's complement, little endian */
138
#define ELFDATA2MSB 2
/* 2's complement, big endian */
139
#define ELFDATANUM 3
140
141
#define EI_VERSION 6
/* File version byte index */
142
/* Value must be EV_CURRENT */
143
144
#define EI_OSABI 7
/* OS ABI identification */
145
#define ELFOSABI_NONE 0
/* UNIX System V ABI */
146
#define ELFOSABI_SYSV 0
/* Alias. */
147
#define ELFOSABI_HPUX 1
/* HP-UX */
148
#define ELFOSABI_NETBSD 2
/* NetBSD. */
149
#define ELFOSABI_GNU 3
/* Object uses GNU ELF extensions. */
150
#define ELFOSABI_LINUX ELFOSABI_GNU
/* Compatibility alias. */
151
#define ELFOSABI_SOLARIS 6
/* Sun Solaris. */
152
#define ELFOSABI_AIX 7
/* IBM AIX. */
153
#define ELFOSABI_IRIX 8
/* SGI Irix. */
154
#define ELFOSABI_FREEBSD 9
/* FreeBSD. */
155
#define ELFOSABI_TRU64 10
/* Compaq TRU64 UNIX. */
156
#define ELFOSABI_MODESTO 11
/* Novell Modesto. */
157
#define ELFOSABI_OPENBSD 12
/* OpenBSD. */
158
#define ELFOSABI_ARM_AEABI 64
/* ARM EABI */
159
#define ELFOSABI_ARM 97
/* ARM */
160
#define ELFOSABI_STANDALONE 255
/* Standalone (embedded) application */
161
162
#define EI_ABIVERSION 8
/* ABI version */
163
164
#define EI_PAD 9
/* Byte index of padding bytes */
165
166
/* Legal values for e_type (object file type). */
167
168
#define ET_NONE 0
/* No file type */
169
#define ET_REL 1
/* Relocatable file */
170
#define ET_EXEC 2
/* Executable file */
171
#define ET_DYN 3
/* Shared object file */
172
#define ET_CORE 4
/* Core file */
173
#define ET_NUM 5
/* Number of defined types */
174
#define ET_LOOS 0xfe00
/* OS-specific range start */
175
#define ET_HIOS 0xfeff
/* OS-specific range end */
176
#define ET_LOPROC 0xff00
/* Processor-specific range start */
177
#define ET_HIPROC 0xffff
/* Processor-specific range end */
178
179
/* Legal values for e_machine (architecture). */
180
181
#define EM_NONE 0
/* No machine */
182
#define EM_M32 1
/* AT&T WE 32100 */
183
#define EM_SPARC 2
/* SUN SPARC */
184
#define EM_386 3
/* Intel 80386 */
185
#define EM_68K 4
/* Motorola m68k family */
186
#define EM_88K 5
/* Motorola m88k family */
187
#define EM_860 7
/* Intel 80860 */
188
#define EM_MIPS 8
/* MIPS R3000 big-endian */
189
#define EM_S370 9
/* IBM System/370 */
190
#define EM_MIPS_RS3_LE 10
/* MIPS R3000 little-endian */
191
192
#define EM_PARISC 15
/* HPPA */
193
#define EM_VPP500 17
/* Fujitsu VPP500 */
194
#define EM_SPARC32PLUS 18
/* Sun's "v8plus" */
195
#define EM_960 19
/* Intel 80960 */
196
#define EM_PPC 20
/* PowerPC */
197
#define EM_PPC64 21
/* PowerPC 64-bit */
198
#define EM_S390 22
/* IBM S390 */
199
200
#define EM_V800 36
/* NEC V800 series */
201
#define EM_FR20 37
/* Fujitsu FR20 */
202
#define EM_RH32 38
/* TRW RH-32 */
203
#define EM_RCE 39
/* Motorola RCE */
204
#define EM_ARM 40
/* ARM */
205
#define EM_FAKE_ALPHA 41
/* Digital Alpha */
206
#define EM_SH 42
/* Hitachi SH */
207
#define EM_SPARCV9 43
/* SPARC v9 64-bit */
208
#define EM_TRICORE 44
/* Siemens Tricore */
209
#define EM_ARC 45
/* Argonaut RISC Core */
210
#define EM_H8_300 46
/* Hitachi H8/300 */
211
#define EM_H8_300H 47
/* Hitachi H8/300H */
212
#define EM_H8S 48
/* Hitachi H8S */
213
#define EM_H8_500 49
/* Hitachi H8/500 */
214
#define EM_IA_64 50
/* Intel Merced */
215
#define EM_MIPS_X 51
/* Stanford MIPS-X */
216
#define EM_COLDFIRE 52
/* Motorola Coldfire */
217
#define EM_68HC12 53
/* Motorola M68HC12 */
218
#define EM_MMA 54
/* Fujitsu MMA Multimedia Accelerator*/
219
#define EM_PCP 55
/* Siemens PCP */
220
#define EM_NCPU 56
/* Sony nCPU embeeded RISC */
221
#define EM_NDR1 57
/* Denso NDR1 microprocessor */
222
#define EM_STARCORE 58
/* Motorola Start*Core processor */
223
#define EM_ME16 59
/* Toyota ME16 processor */
224
#define EM_ST100 60
/* STMicroelectronic ST100 processor */
225
#define EM_TINYJ 61
/* Advanced Logic Corp. Tinyj emb.fam*/
226
#define EM_X86_64 62
/* AMD x86-64 architecture */
227
#define EM_PDSP 63
/* Sony DSP Processor */
228
#define EM_NUM 192
229
230
/* If it is necessary to assign new unofficial EM_* values, please
231
pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the
232
chances of collision with official or non-GNU unofficial values. */
233
234
#define EM_ALPHA 0x9026
235
236
/* Legal values for e_version (version). */
237
238
#define EV_NONE 0
/* Invalid ELF version */
239
#define EV_CURRENT 1
/* Current version */
240
#define EV_NUM 2
241
242
/* Section header. */
243
244
typedef
struct
245
{
246
Elf32_Word sh_name;
/* Section name (string tbl index) */
247
Elf32_Word sh_type;
/* Section type */
248
Elf32_Word sh_flags;
/* Section flags */
249
Elf32_Addr sh_addr;
/* Section virtual addr at execution */
250
Elf32_Off sh_offset;
/* Section file offset */
251
Elf32_Word sh_size;
/* Section size in bytes */
252
Elf32_Word sh_link;
/* Link to another section */
253
Elf32_Word sh_info;
/* Additional section information */
254
Elf32_Word sh_addralign;
/* Section alignment */
255
Elf32_Word sh_entsize;
/* Entry size if section holds table */
256
}
Elf32_Shdr
;
257
258
typedef
struct
259
{
260
Elf64_Word sh_name;
/* Section name (string tbl index) */
261
Elf64_Word sh_type;
/* Section type */
262
Elf64_Xword sh_flags;
/* Section flags */
263
Elf64_Addr sh_addr;
/* Section virtual addr at execution */
264
Elf64_Off sh_offset;
/* Section file offset */
265
Elf64_Xword sh_size;
/* Section size in bytes */
266
Elf64_Word sh_link;
/* Link to another section */
267
Elf64_Word sh_info;
/* Additional section information */
268
Elf64_Xword sh_addralign;
/* Section alignment */
269
Elf64_Xword sh_entsize;
/* Entry size if section holds table */
270
}
Elf64_Shdr
;
271
272
/* Special section indices. */
273
274
#define SHN_UNDEF 0
/* Undefined section */
275
#define SHN_LORESERVE 0xff00
/* Start of reserved indices */
276
#define SHN_LOPROC 0xff00
/* Start of processor-specific */
277
#define SHN_BEFORE 0xff00
/* Order section before all others
278
(Solaris). */
279
#define SHN_AFTER 0xff01
/* Order section after all others
280
(Solaris). */
281
#define SHN_HIPROC 0xff1f
/* End of processor-specific */
282
#define SHN_LOOS 0xff20
/* Start of OS-specific */
283
#define SHN_HIOS 0xff3f
/* End of OS-specific */
284
#define SHN_ABS 0xfff1
/* Associated symbol is absolute */
285
#define SHN_COMMON 0xfff2
/* Associated symbol is common */
286
#define SHN_XINDEX 0xffff
/* Index is in extra table. */
287
#define SHN_HIRESERVE 0xffff
/* End of reserved indices */
288
289
/* Legal values for sh_type (section type). */
290
291
#define SHT_NULL 0
/* Section header table entry unused */
292
#define SHT_PROGBITS 1
/* Program data */
293
#define SHT_SYMTAB 2
/* Symbol table */
294
#define SHT_STRTAB 3
/* String table */
295
#define SHT_RELA 4
/* Relocation entries with addends */
296
#define SHT_HASH 5
/* Symbol hash table */
297
#define SHT_DYNAMIC 6
/* Dynamic linking information */
298
#define SHT_NOTE 7
/* Notes */
299
#define SHT_NOBITS 8
/* Program space with no data (bss) */
300
#define SHT_REL 9
/* Relocation entries, no addends */
301
#define SHT_SHLIB 10
/* Reserved */
302
#define SHT_DYNSYM 11
/* Dynamic linker symbol table */
303
#define SHT_INIT_ARRAY 14
/* Array of constructors */
304
#define SHT_FINI_ARRAY 15
/* Array of destructors */
305
#define SHT_PREINIT_ARRAY 16
/* Array of pre-constructors */
306
#define SHT_GROUP 17
/* Section group */
307
#define SHT_SYMTAB_SHNDX 18
/* Extended section indeces */
308
#define SHT_NUM 19
/* Number of defined types. */
309
#define SHT_LOOS 0x60000000
/* Start OS-specific. */
310
#define SHT_GNU_ATTRIBUTES 0x6ffffff5
/* Object attributes. */
311
#define SHT_GNU_HASH 0x6ffffff6
/* GNU-style hash table. */
312
#define SHT_GNU_LIBLIST 0x6ffffff7
/* Prelink library list */
313
#define SHT_CHECKSUM 0x6ffffff8
/* Checksum for DSO content. */
314
#define SHT_LOSUNW 0x6ffffffa
/* Sun-specific low bound. */
315
#define SHT_SUNW_move 0x6ffffffa
316
#define SHT_SUNW_COMDAT 0x6ffffffb
317
#define SHT_SUNW_syminfo 0x6ffffffc
318
#define SHT_GNU_verdef 0x6ffffffd
/* Version definition section. */
319
#define SHT_GNU_verneed 0x6ffffffe
/* Version needs section. */
320
#define SHT_GNU_versym 0x6fffffff
/* Version symbol table. */
321
#define SHT_HISUNW 0x6fffffff
/* Sun-specific high bound. */
322
#define SHT_HIOS 0x6fffffff
/* End OS-specific type */
323
#define SHT_LOPROC 0x70000000
/* Start of processor-specific */
324
#define SHT_HIPROC 0x7fffffff
/* End of processor-specific */
325
#define SHT_LOUSER 0x80000000
/* Start of application-specific */
326
#define SHT_HIUSER 0x8fffffff
/* End of application-specific */
327
328
/* Legal values for sh_flags (section flags). */
329
330
#define SHF_WRITE (1 << 0)
/* Writable */
331
#define SHF_ALLOC (1 << 1)
/* Occupies memory during execution */
332
#define SHF_EXECINSTR (1 << 2)
/* Executable */
333
#define SHF_MERGE (1 << 4)
/* Might be merged */
334
#define SHF_STRINGS (1 << 5)
/* Contains nul-terminated strings */
335
#define SHF_INFO_LINK (1 << 6)
/* `sh_info' contains SHT index */
336
#define SHF_LINK_ORDER (1 << 7)
/* Preserve order after combining */
337
#define SHF_OS_NONCONFORMING (1 << 8)
/* Non-standard OS specific handling
338
required */
339
#define SHF_GROUP (1 << 9)
/* Section is member of a group. */
340
#define SHF_TLS (1 << 10)
/* Section hold thread-local data. */
341
#define SHF_MASKOS 0x0ff00000
/* OS-specific. */
342
#define SHF_MASKPROC 0xf0000000
/* Processor-specific */
343
#define SHF_ORDERED (1 << 30)
/* Special ordering requirement
344
(Solaris). */
345
#define SHF_EXCLUDE (1 << 31)
/* Section is excluded unless
346
referenced or allocated (Solaris).*/
347
348
/* Section group handling. */
349
#define GRP_COMDAT 0x1
/* Mark group as COMDAT. */
350
351
/* Symbol table entry. */
352
353
typedef
struct
354
{
355
Elf32_Word st_name;
/* Symbol name (string tbl index) */
356
Elf32_Addr st_value;
/* Symbol value */
357
Elf32_Word st_size;
/* Symbol size */
358
unsigned
char
st_info;
/* Symbol type and binding */
359
unsigned
char
st_other;
/* Symbol visibility */
360
Elf32_Section st_shndx;
/* Section index */
361
}
Elf32_Sym
;
362
363
typedef
struct
364
{
365
Elf64_Word st_name;
/* Symbol name (string tbl index) */
366
unsigned
char
st_info;
/* Symbol type and binding */
367
unsigned
char
st_other;
/* Symbol visibility */
368
Elf64_Section st_shndx;
/* Section index */
369
Elf64_Addr st_value;
/* Symbol value */
370
Elf64_Xword st_size;
/* Symbol size */
371
}
Elf64_Sym
;
372
373
/* How to extract and insert information held in the st_info field. */
374
375
#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4)
376
#define ELF32_ST_TYPE(val) ((val) & 0xf)
377
#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
378
379
/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */
380
#define ELF64_ST_BIND(val) ELF32_ST_BIND (val)
381
#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val)
382
#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type))
383
384
/* Legal values for ST_BIND subfield of st_info (symbol binding). */
385
386
#define STB_LOCAL 0
/* Local symbol */
387
#define STB_GLOBAL 1
/* Global symbol */
388
#define STB_WEAK 2
/* Weak symbol */
389
#define STB_NUM 3
/* Number of defined types. */
390
#define STB_LOOS 10
/* Start of OS-specific */
391
#define STB_GNU_UNIQUE 10
/* Unique symbol. */
392
#define STB_HIOS 12
/* End of OS-specific */
393
#define STB_LOPROC 13
/* Start of processor-specific */
394
#define STB_HIPROC 15
/* End of processor-specific */
395
396
/* Legal values for ST_TYPE subfield of st_info (symbol type). */
397
398
#define STT_NOTYPE 0
/* Symbol type is unspecified */
399
#define STT_OBJECT 1
/* Symbol is a data object */
400
#define STT_FUNC 2
/* Symbol is a code object */
401
#define STT_SECTION 3
/* Symbol associated with a section */
402
#define STT_FILE 4
/* Symbol's name is file name */
403
#define STT_COMMON 5
/* Symbol is a common data object */
404
#define STT_TLS 6
/* Symbol is thread-local data object*/
405
#define STT_NUM 7
/* Number of defined types. */
406
#define STT_LOOS 10
/* Start of OS-specific */
407
#define STT_GNU_IFUNC 10
/* Symbol is indirect code object */
408
#define STT_HIOS 12
/* End of OS-specific */
409
#define STT_LOPROC 13
/* Start of processor-specific */
410
#define STT_HIPROC 15
/* End of processor-specific */
411
412
413
/* Symbol table indices are found in the hash buckets and chain table
414
of a symbol hash table section. This special index value indicates
415
the end of a chain, meaning no further symbols are found in that bucket. */
416
417
#define STN_UNDEF 0
/* End of a chain. */
418
419
420
/* How to extract and insert information held in the st_other field. */
421
422
#define ELF32_ST_VISIBILITY(o) ((o) & 0x03)
423
424
/* For ELF64 the definitions are the same. */
425
#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o)
426
427
/* Symbol visibility specification encoded in the st_other field. */
428
#define STV_DEFAULT 0
/* Default symbol visibility rules */
429
#define STV_INTERNAL 1
/* Processor specific hidden class */
430
#define STV_HIDDEN 2
/* Sym unavailable in other modules */
431
#define STV_PROTECTED 3
/* Not preemptible, not exported */
432
433
434
/* Relocation table entry without addend (in section of type SHT_REL). */
435
436
typedef
struct
437
{
438
Elf32_Addr r_offset;
/* Address */
439
Elf32_Word r_info;
/* Relocation type and symbol index */
440
}
Elf32_Rel
;
441
442
/* I have seen two different definitions of the Elf64_Rel and
443
Elf64_Rela structures, so we'll leave them out until Novell (or
444
whoever) gets their act together. */
445
/* The following, at least, is used on Sparc v9, MIPS, and Alpha. */
446
447
typedef
struct
448
{
449
Elf64_Addr r_offset;
/* Address */
450
Elf64_Xword r_info;
/* Relocation type and symbol index */
451
}
Elf64_Rel
;
452
453
/* Relocation table entry with addend (in section of type SHT_RELA). */
454
455
typedef
struct
456
{
457
Elf32_Addr r_offset;
/* Address */
458
Elf32_Word r_info;
/* Relocation type and symbol index */
459
Elf32_Sword r_addend;
/* Addend */
460
}
Elf32_Rela
;
461
462
typedef
struct
463
{
464
Elf64_Addr r_offset;
/* Address */
465
Elf64_Xword r_info;
/* Relocation type and symbol index */
466
Elf64_Sxword r_addend;
/* Addend */
467
}
Elf64_Rela
;
468
469
/* How to extract and insert information held in the r_info field. */
470
471
#define ELF32_R_SYM(val) ((val) >> 8)
472
#define ELF32_R_TYPE(val) ((val) & 0xff)
473
#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff))
474
475
#define ELF64_R_SYM(i) ((i) >> 32)
476
#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
477
#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type))
478
479
/* Program segment header. */
480
481
typedef
struct
482
{
483
Elf32_Word p_type;
/* Segment type */
484
Elf32_Off p_offset;
/* Segment file offset */
485
Elf32_Addr p_vaddr;
/* Segment virtual address */
486
Elf32_Addr p_paddr;
/* Segment physical address */
487
Elf32_Word p_filesz;
/* Segment size in file */
488
Elf32_Word p_memsz;
/* Segment size in memory */
489
Elf32_Word p_flags;
/* Segment flags */
490
Elf32_Word p_align;
/* Segment alignment */
491
}
Elf32_Phdr
;
492
493
typedef
struct
494
{
495
Elf64_Word p_type;
/* Segment type */
496
Elf64_Word p_flags;
/* Segment flags */
497
Elf64_Off p_offset;
/* Segment file offset */
498
Elf64_Addr p_vaddr;
/* Segment virtual address */
499
Elf64_Addr p_paddr;
/* Segment physical address */
500
Elf64_Xword p_filesz;
/* Segment size in file */
501
Elf64_Xword p_memsz;
/* Segment size in memory */
502
Elf64_Xword p_align;
/* Segment alignment */
503
}
Elf64_Phdr
;
504
505
/* Special value for e_phnum. This indicates that the real number of
506
program headers is too large to fit into e_phnum. Instead the real
507
value is in the field sh_info of section 0. */
508
509
#define PN_XNUM 0xffff
510
511
/* Legal values for p_type (segment type). */
512
513
#define PT_NULL 0
/* Program header table entry unused */
514
#define PT_LOAD 1
/* Loadable program segment */
515
#define PT_DYNAMIC 2
/* Dynamic linking information */
516
#define PT_INTERP 3
/* Program interpreter */
517
#define PT_NOTE 4
/* Auxiliary information */
518
#define PT_SHLIB 5
/* Reserved */
519
#define PT_PHDR 6
/* Entry for header table itself */
520
#define PT_TLS 7
/* Thread-local storage segment */
521
#define PT_NUM 8
/* Number of defined types */
522
#define PT_LOOS 0x60000000
/* Start of OS-specific */
523
#define PT_GNU_EH_FRAME 0x6474e550
/* GCC .eh_frame_hdr segment */
524
#define PT_GNU_STACK 0x6474e551
/* Indicates stack executability */
525
#define PT_GNU_RELRO 0x6474e552
/* Read-only after relocation */
526
#define PT_LOSUNW 0x6ffffffa
527
#define PT_SUNWBSS 0x6ffffffa
/* Sun Specific segment */
528
#define PT_SUNWSTACK 0x6ffffffb
/* Stack segment */
529
#define PT_HISUNW 0x6fffffff
530
#define PT_HIOS 0x6fffffff
/* End of OS-specific */
531
#define PT_LOPROC 0x70000000
/* Start of processor-specific */
532
#define PT_HIPROC 0x7fffffff
/* End of processor-specific */
533
534
/* Legal values for p_flags (segment flags). */
535
536
#define PF_X (1 << 0)
/* Segment is executable */
537
#define PF_W (1 << 1)
/* Segment is writable */
538
#define PF_R (1 << 2)
/* Segment is readable */
539
#define PF_MASKOS 0x0ff00000
/* OS-specific */
540
#define PF_MASKPROC 0xf0000000
/* Processor-specific */
541
542
/* Note section contents. Each entry in the note section begins with
543
a header of a fixed form. */
544
545
typedef
struct
546
{
547
Elf32_Word n_namesz;
/* Length of the note's name. */
548
Elf32_Word n_descsz;
/* Length of the note's descriptor. */
549
Elf32_Word n_type;
/* Type of the note. */
550
}
Elf32_Nhdr
;
551
552
typedef
struct
553
{
554
Elf64_Word n_namesz;
/* Length of the note's name. */
555
Elf64_Word n_descsz;
/* Length of the note's descriptor. */
556
Elf64_Word n_type;
/* Type of the note. */
557
}
Elf64_Nhdr
;
558
559
/* Known names of notes. */
560
561
/* Solaris entries in the note section have this name. */
562
#define ELF_NOTE_SOLARIS "SUNW Solaris"
563
564
/* Note entries for GNU systems have this name. */
565
#define ELF_NOTE_GNU "GNU"
566
567
568
/* Defined types of notes for Solaris. */
569
570
/* Value of descriptor (one word) is desired pagesize for the binary. */
571
#define ELF_NOTE_PAGESIZE_HINT 1
572
573
574
/* Defined note types for GNU systems. */
575
576
/* ABI information. The descriptor consists of words:
577
word 0: OS descriptor
578
word 1: major version of the ABI
579
word 2: minor version of the ABI
580
word 3: subminor version of the ABI
581
*/
582
#define NT_GNU_ABI_TAG 1
583
#define ELF_NOTE_ABI NT_GNU_ABI_TAG
/* Old name. */
584
585
/* Known OSes. These values can appear in word 0 of an
586
NT_GNU_ABI_TAG note section entry. */
587
#define ELF_NOTE_OS_LINUX 0
588
#define ELF_NOTE_OS_GNU 1
589
#define ELF_NOTE_OS_SOLARIS2 2
590
#define ELF_NOTE_OS_FREEBSD 3
591
592
/* Synthetic hwcap information. The descriptor begins with two words:
593
word 0: number of entries
594
word 1: bitmask of enabled entries
595
Then follow variable-length entries, one byte followed by a
596
'\0'-terminated hwcap name string. The byte gives the bit
597
number to test if enabled, (1U << bit) & bitmask. */
598
#define NT_GNU_HWCAP 2
599
600
/* Build ID bits as generated by ld --build-id.
601
The descriptor consists of any nonzero number of bytes. */
602
#define NT_GNU_BUILD_ID 3
603
604
/* Version note generated by GNU gold containing a version string. */
605
#define NT_GNU_GOLD_VERSION 4
606
607
/* Dynamic section entry. */
608
609
typedef
struct
610
{
611
Elf32_Sword d_tag;
/* Dynamic entry type */
612
union
613
{
614
Elf32_Word d_val;
/* Integer value */
615
Elf32_Addr d_ptr;
/* Address value */
616
} d_un;
617
}
Elf32_Dyn
;
618
619
typedef
struct
620
{
621
Elf64_Sxword d_tag;
/* Dynamic entry type */
622
union
623
{
624
Elf64_Xword d_val;
/* Integer value */
625
Elf64_Addr d_ptr;
/* Address value */
626
} d_un;
627
}
Elf64_Dyn
;
628
629
#define DT_NULL 0
/* Marks end of dynamic section */
630
#define DT_NEEDED 1
/* Name of needed library */
631
#define DT_PLTRELSZ 2
/* Size in bytes of PLT relocs */
632
#define DT_PLTGOT 3
/* Processor defined value */
633
#define DT_HASH 4
/* Address of symbol hash table */
634
#define DT_STRTAB 5
/* Address of string table */
635
#define DT_SYMTAB 6
/* Address of symbol table */
636
#define DT_RELA 7
/* Address of Rela relocs */
637
#define DT_RELASZ 8
/* Total size of Rela relocs */
638
#define DT_RELAENT 9
/* Size of one Rela reloc */
639
#define DT_STRSZ 10
/* Size of string table */
640
#define DT_SYMENT 11
/* Size of one symbol table entry */
641
#define DT_INIT 12
/* Address of init function */
642
#define DT_FINI 13
/* Address of termination function */
643
#define DT_SONAME 14
/* Name of shared object */
644
#define DT_RPATH 15
/* Library search path (deprecated) */
645
#define DT_SYMBOLIC 16
/* Start symbol search here */
646
#define DT_REL 17
/* Address of Rel relocs */
647
#define DT_RELSZ 18
/* Total size of Rel relocs */
648
#define DT_RELENT 19
/* Size of one Rel reloc */
649
#define DT_PLTREL 20
/* Type of reloc in PLT */
650
#define DT_DEBUG 21
/* For debugging; unspecified */
651
#define DT_TEXTREL 22
/* Reloc might modify .text */
652
#define DT_JMPREL 23
/* Address of PLT relocs */
653
#define DT_BIND_NOW 24
/* Process relocations of object */
654
#define DT_INIT_ARRAY 25
/* Array with addresses of init fct */
655
#define DT_FINI_ARRAY 26
/* Array with addresses of fini fct */
656
#define DT_INIT_ARRAYSZ 27
/* Size in bytes of DT_INIT_ARRAY */
657
#define DT_FINI_ARRAYSZ 28
/* Size in bytes of DT_FINI_ARRAY */
658
#define DT_RUNPATH 29
/* Library search path */
659
#define DT_FLAGS 30
/* Flags for the object being loaded */
660
#define DT_ENCODING 32
/* Start of encoded range */
661
#define DT_PREINIT_ARRAY 32
/* Array with addresses of preinit fct*/
662
#define DT_PREINIT_ARRAYSZ 33
/* size in bytes of DT_PREINIT_ARRAY */
663
#define DT_NUM 34
/* Number used */
664
#define DT_LOOS 0x6000000d
/* Start of OS-specific */
665
#define DT_HIOS 0x6ffff000
/* End of OS-specific */
666
#define DT_LOPROC 0x70000000
/* Start of processor-specific */
667
#define DT_HIPROC 0x7fffffff
/* End of processor-specific */
668
#define DT_PROCNUM DT_MIPS_NUM
/* Most used by any processor */
669
670
/* NOTE: Further definitions has been deleted from this file, because was obsolete */
671
672
#ifdef __cplusplus
673
}
674
#endif
675
676
#endif
/* elf.h */
Elf32_Ehdr
Definition:
Elf.h:73
Elf32_Shdr
Definition:
Elf.h:244
Elf32_Sym
Definition:
Elf.h:353
Elf32_Rela
Definition:
Elf.h:455
Elf64_Rela
Definition:
Elf.h:462
Elf32_Dyn
Definition:
Elf.h:609
Elf32_Rel
Definition:
Elf.h:436
Elf64_Nhdr
Definition:
Elf.h:552
Elf32_Nhdr
Definition:
Elf.h:545
Elf64_Dyn
Definition:
Elf.h:619
Elf64_Rel
Definition:
Elf.h:447
Elf64_Phdr
Definition:
Elf.h:493
Elf64_Sym
Definition:
Elf.h:363
Elf32_Phdr
Definition:
Elf.h:481
Elf64_Ehdr
Definition:
Elf.h:91
Elf64_Shdr
Definition:
Elf.h:258
Generated by
1.8.11