LIEF: Library to Instrument Executable Formats Version
Loading...
Searching...
No Matches
ELF/enums.hpp
1/* Copyright 2017 - 2023 R. Thomas
2 * Copyright 2017 - 2023 Quarkslab
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef LIEF_ELF_ENUMS_H
17#define LIEF_ELF_ENUMS_H
18#include "LIEF/enums.hpp"
19#include "LIEF/ELF/undef.h"
20#include <cstdint>
21#include <cstddef>
22
23namespace LIEF {
24namespace ELF {
25
26
28enum class IDENTITY: size_t {
29 EI_MAG0 = 0,
30 EI_MAG1 = 1,
31 EI_MAG2 = 2,
32 EI_MAG3 = 3,
33 EI_CLASS = 4,
34 EI_DATA = 5,
35 EI_VERSION = 6,
36 EI_OSABI = 7,
37 EI_ABIVERSION = 8,
38 EI_PAD = 9,
39 EI_NIDENT = 16
40};
41
42
44enum class E_TYPE: size_t {
45 ET_NONE = 0,
46 ET_REL = 1,
47 ET_EXEC = 2,
48 ET_DYN = 3,
49 ET_CORE = 4,
50 ET_LOPROC = 0xff00,
51 ET_HIPROC = 0xffff
52};
53
54
56enum class VERSION: size_t {
57 EV_NONE = 0,
58 EV_CURRENT = 1
59};
60
61
67enum class ARCH: size_t {
68 EM_NONE = 0,
69 EM_M32 = 1,
70 EM_SPARC = 2,
71 EM_386 = 3,
72 EM_68K = 4,
73 EM_88K = 5,
74 EM_IAMCU = 6,
75 EM_860 = 7,
76 EM_MIPS = 8,
77 EM_S370 = 9,
78 EM_MIPS_RS3_LE = 10,
79 EM_PARISC = 15,
80 EM_VPP500 = 17,
81 EM_SPARC32PLUS = 18,
82 EM_960 = 19,
83 EM_PPC = 20,
84 EM_PPC64 = 21,
85 EM_S390 = 22,
86 EM_SPU = 23,
87 EM_V800 = 36,
88 EM_FR20 = 37,
89 EM_RH32 = 38,
90 EM_RCE = 39,
91 EM_ARM = 40,
92 EM_ALPHA = 41,
93 EM_SH = 42,
94 EM_SPARCV9 = 43,
95 EM_TRICORE = 44,
96 EM_ARC = 45,
97 EM_H8_300 = 46,
98 EM_H8_300H = 47,
99 EM_H8S = 48,
100 EM_H8_500 = 49,
101 EM_IA_64 = 50,
102 EM_MIPS_X = 51,
103 EM_COLDFIRE = 52,
104 EM_68HC12 = 53,
105 EM_MMA = 54,
106 EM_PCP = 55,
107 EM_NCPU = 56,
108 EM_NDR1 = 57,
109 EM_STARCORE = 58,
110 EM_ME16 = 59,
111 EM_ST100 = 60,
112 EM_TINYJ = 61,
113 EM_X86_64 = 62,
114 EM_PDSP = 63,
115 EM_PDP10 = 64,
116 EM_PDP11 = 65,
117 EM_FX66 = 66,
118 EM_ST9PLUS = 67,
119 EM_ST7 = 68,
120 EM_68HC16 = 69,
121 EM_68HC11 = 70,
122 EM_68HC08 = 71,
123 EM_68HC05 = 72,
124 EM_SVX = 73,
125 EM_ST19 = 74,
126 EM_VAX = 75,
127 EM_CRIS = 76,
128 EM_JAVELIN = 77,
129 EM_FIREPATH = 78,
130 EM_ZSP = 79,
131 EM_MMIX = 80,
132 EM_HUANY = 81,
133 EM_PRISM = 82,
134 EM_AVR = 83,
135 EM_FR30 = 84,
136 EM_D10V = 85,
137 EM_D30V = 86,
138 EM_V850 = 87,
139 EM_M32R = 88,
140 EM_MN10300 = 89,
141 EM_MN10200 = 90,
142 EM_PJ = 91,
143 EM_OPENRISC = 92,
144 EM_ARC_COMPACT = 93,
145 EM_XTENSA = 94,
146 EM_VIDEOCORE = 95,
147 EM_TMM_GPP = 96,
148 EM_NS32K = 97,
149 EM_TPC = 98,
150 EM_SNP1K = 99,
151 EM_ST200 = 100,
152 EM_IP2K = 101,
153 EM_MAX = 102,
154 EM_CR = 103,
155 EM_F2MC16 = 104,
156 EM_MSP430 = 105,
157 EM_BLACKFIN = 106,
158 EM_SE_C33 = 107,
159 EM_SEP = 108,
160 EM_ARCA = 109,
161 EM_UNICORE = 110,
162 EM_EXCESS = 111,
163 EM_DXP = 112,
164 EM_ALTERA_NIOS2 = 113,
165 EM_CRX = 114,
166 EM_XGATE = 115,
167 EM_C166 = 116,
168 EM_M16C = 117,
169 EM_DSPIC30F = 118,
170 /* Controller */
171 EM_CE = 119,
172 EM_M32C = 120,
173 EM_TSK3000 = 131,
174 EM_RS08 = 132,
175 EM_SHARC = 133,
176 /* processors */
177 EM_ECOG2 = 134,
178 EM_SCORE7 = 135,
179 EM_DSP24 = 136,
180 EM_VIDEOCORE3 = 137,
181 EM_LATTICEMICO32 = 138,
182 EM_SE_C17 = 139,
183 EM_TI_C6000 = 140,
184 EM_TI_C2000 = 141,
185 EM_TI_C5500 = 142,
186 EM_MMDSP_PLUS = 160,
187 EM_CYPRESS_M8C = 161,
188 EM_R32C = 162,
189 EM_TRIMEDIA = 163,
190 EM_HEXAGON = 164,
191 EM_8051 = 165,
192 EM_STXP7X = 166,
193 /* and extensible RISC processors */
194 EM_NDS32 = 167, /* Andes Technology compact code size embedded RISC */
195 /* processor family */
196 EM_ECOG1 = 168,
197 EM_ECOG1X = 168,
198 EM_MAXQ30 = 169,
199 EM_XIMO16 = 170,
200 EM_MANIK = 171,
201 EM_CRAYNV2 = 172,
202 EM_RX = 173,
203 EM_METAG = 174,
204 /* architecture */
205 EM_MCST_ELBRUS = 175,
206 EM_ECOG16 = 176,
207 EM_CR16 = 177,
208 /* microprocessor */
209 EM_ETPU = 178,
210 EM_SLE9X = 179,
211 EM_L10M = 180,
212 EM_K10M = 181,
213 EM_AARCH64 = 183,
214 EM_AVR32 = 185,
215 EM_STM8 = 186,
216 EM_TILE64 = 187,
217 EM_TILEPRO = 188,
218 EM_CUDA = 190,
219 EM_TILEGX = 191,
220 EM_CLOUDSHIELD = 192,
221 EM_COREA_1ST = 193,
222 EM_COREA_2ND = 194,
223 EM_ARC_COMPACT2 = 195,
224 EM_OPEN8 = 196,
225 EM_RL78 = 197,
226 EM_VIDEOCORE5 = 198,
227 EM_78KOR = 199,
228 EM_56800EX = 200,
229 EM_BA1 = 201,
230 EM_BA2 = 202,
231 EM_XCORE = 203,
232 EM_MCHP_PIC = 204,
233 EM_INTEL205 = 205,
234 EM_INTEL206 = 206,
235 EM_INTEL207 = 207,
236 EM_INTEL208 = 208,
237 EM_INTEL209 = 209,
238 EM_KM32 = 210,
239 EM_KMX32 = 211,
240 EM_KMX16 = 212,
241 EM_KMX8 = 213,
242 EM_KVARC = 214,
243 EM_CDP = 215,
244 EM_COGE = 216,
245 EM_COOL = 217,
246 EM_NORC = 218,
247 EM_CSR_KALIMBA = 219,
248 EM_AMDGPU = 224,
249 EM_RISCV = 243,
250 EM_BPF = 247,
251 EM_LOONGARCH = 258
252};
253
254
256enum class ELF_CLASS: size_t {
257 ELFCLASSNONE = 0,
258 ELFCLASS32 = 1,
259 ELFCLASS64 = 2
260};
261
263enum class ELF_DATA: size_t {
264 ELFDATANONE = 0,
265 ELFDATA2LSB = 1,
266 ELFDATA2MSB = 2
267};
268
270enum class OS_ABI: size_t {
271 ELFOSABI_SYSTEMV = 0,
272 ELFOSABI_HPUX = 1,
273 ELFOSABI_NETBSD = 2,
274 ELFOSABI_GNU = 3,
275 ELFOSABI_LINUX = 3,
276 ELFOSABI_HURD = 4,
277 ELFOSABI_SOLARIS = 6,
278 ELFOSABI_AIX = 7,
279 ELFOSABI_IRIX = 8,
280 ELFOSABI_FREEBSD = 9,
281 ELFOSABI_TRU64 = 10,
282 ELFOSABI_MODESTO = 11,
283 ELFOSABI_OPENBSD = 12,
284 ELFOSABI_OPENVMS = 13,
285 ELFOSABI_NSK = 14,
286 ELFOSABI_AROS = 15,
287 ELFOSABI_FENIXOS = 16,
288 ELFOSABI_CLOUDABI = 17,
292 ELFOSABI_ARM = 97,
294};
295
296/* ELF Relocations */
297
298#define ELF_RELOC(name, value) name = value,
299
301enum class RELOC_x86_64: size_t {
302 #include "LIEF/ELF/Relocations/x86_64.def"
303};
304
307 #include "LIEF/ELF/Relocations/i386.def"
308};
309
310/* ELF Relocation types for PPC32 */
311enum class RELOC_POWERPC32: size_t {
312 #include "LIEF/ELF/Relocations/PowerPC.def"
313};
314
315/* ELF Relocation types for PPC64 */
316enum class RELOC_POWERPC64: size_t {
317 #include "LIEF/ELF/Relocations/PowerPC64.def"
318};
319
320/* ELF Relocation types for AArch64 */
321enum class RELOC_AARCH64: size_t {
322 #include "LIEF/ELF/Relocations/AArch64.def"
323};
324
325/* ELF Relocation types for ARM */
326enum class RELOC_ARM: size_t {
327 #include "LIEF/ELF/Relocations/ARM.def"
328};
329
330/* ELF Relocation types for Mips */
331enum class RELOC_MIPS: size_t {
332 #include "LIEF/ELF/Relocations/Mips.def"
333};
334
335/* ELF Relocation types for Hexagon */
336enum class RELOC_HEXAGON: size_t {
337 #include "LIEF/ELF/Relocations/Hexagon.def"
338};
339
340/* ELF Relocation types for S390/zSeries */
341enum class RELOC_SYSTEMZ: size_t {
342 #include "LIEF/ELF/Relocations/SystemZ.def"
343};
344
345/* ELF Relocation type for Sparc. */
346enum class RELOC_SPARC: size_t {
347 #include "LIEF/ELF/Relocations/Sparc.def"
348};
349
350/* ELF Relocation types for LoongArch. */
351enum class RELOC_LOONGARCH: size_t {
352 #include "LIEF/ELF/Relocations/LoongArch.def"
353};
354
355#undef ELF_RELOC
356
357/* Specific e_flags for PPC64 */
358enum class PPC64_EFLAGS: size_t {
359 /* e_flags bits specifying ABI: */
360 /* 1 for original ABI using function descriptors, */
361 /* 2 for revised ABI without function descriptors, */
362 /* 0 for unspecified or not using any features affected by the differences. */
363 EF_PPC64_ABI = 3
364};
365
366/* ARM Specific e_flags */
367enum class ARM_EFLAGS: size_t {
368 EF_ARM_SOFT_FLOAT = 0x00000200U,
369 EF_ARM_VFP_FLOAT = 0x00000400U,
370 EF_ARM_EABI_UNKNOWN = 0x00000000U,
371 EF_ARM_EABI_VER1 = 0x01000000U,
372 EF_ARM_EABI_VER2 = 0x02000000U,
373 EF_ARM_EABI_VER3 = 0x03000000U,
374 EF_ARM_EABI_VER4 = 0x04000000U,
375 EF_ARM_EABI_VER5 = 0x05000000U,
376 EF_ARM_EABIMASK = 0xFF000000U
377};
378
379/* Mips Specific e_flags */
380enum class MIPS_EFLAGS: size_t {
381 EF_MIPS_NOREORDER = 0x00000001, /* Don't reorder instructions */
382 EF_MIPS_PIC = 0x00000002, /* Position independent code */
383 EF_MIPS_CPIC = 0x00000004, /* Call object with Position independent code */
384 EF_MIPS_ABI2 = 0x00000020, /* File uses N32 ABI */
385 EF_MIPS_32BITMODE = 0x00000100, /* Code compiled for a 64-bit machine */
386 /* in 32-bit mode */
387 EF_MIPS_FP64 = 0x00000200, /* Code compiled for a 32-bit machine */
388 /* but uses 64-bit FP registers */
389 EF_MIPS_NAN2008 = 0x00000400, /* Uses IEE 754-2008 NaN encoding */
390
391 /* ABI flags */
392 EF_MIPS_ABI_O32 = 0x00001000, /* This file follows the first MIPS 32 bit ABI */
393 EF_MIPS_ABI_O64 = 0x00002000, /* O32 ABI extended for 64-bit architecture. */
394 EF_MIPS_ABI_EABI32 = 0x00003000, /* EABI in 32 bit mode. */
395 EF_MIPS_ABI_EABI64 = 0x00004000, /* EABI in 64 bit mode. */
396 EF_MIPS_ABI = 0x0000f000, /* Mask for selecting EF_MIPS_ABI_ variant. */
397
398 /* MIPS machine variant */
399 EF_MIPS_MACH_3900 = 0x00810000, /* Toshiba R3900 */
400 EF_MIPS_MACH_4010 = 0x00820000, /* LSI R4010 */
401 EF_MIPS_MACH_4100 = 0x00830000, /* NEC VR4100 */
402 EF_MIPS_MACH_4650 = 0x00850000, /* MIPS R4650 */
403 EF_MIPS_MACH_4120 = 0x00870000, /* NEC VR4120 */
404 EF_MIPS_MACH_4111 = 0x00880000, /* NEC VR4111/VR4181 */
405 EF_MIPS_MACH_SB1 = 0x008a0000, /* Broadcom SB-1 */
406 EF_MIPS_MACH_OCTEON = 0x008b0000, /* Cavium Networks Octeon */
407 EF_MIPS_MACH_XLR = 0x008c0000, /* RMI Xlr */
408 EF_MIPS_MACH_OCTEON2 = 0x008d0000, /* Cavium Networks Octeon2 */
409 EF_MIPS_MACH_OCTEON3 = 0x008e0000, /* Cavium Networks Octeon3 */
410 EF_MIPS_MACH_5400 = 0x00910000, /* NEC VR5400 */
411 EF_MIPS_MACH_5900 = 0x00920000, /* MIPS R5900 */
412 EF_MIPS_MACH_5500 = 0x00980000, /* NEC VR5500 */
413 EF_MIPS_MACH_9000 = 0x00990000, /* Unknown */
414 EF_MIPS_MACH_LS2E = 0x00a00000, /* ST Microelectronics Loongson 2E */
415 EF_MIPS_MACH_LS2F = 0x00a10000, /* ST Microelectronics Loongson 2F */
416 EF_MIPS_MACH_LS3A = 0x00a20000, /* Loongson 3A */
417 EF_MIPS_MACH = 0x00ff0000, /* EF_MIPS_MACH_xxx selection mask */
418
419 /* ARCH_ASE */
420 EF_MIPS_MICROMIPS = 0x02000000, /* microMIPS */
421 EF_MIPS_ARCH_ASE_M16 = 0x04000000, /* Has Mips-16 ISA extensions */
422 EF_MIPS_ARCH_ASE_MDMX = 0x08000000, /* Has MDMX multimedia extensions */
423 EF_MIPS_ARCH_ASE = 0x0f000000, /* Mask for EF_MIPS_ARCH_ASE_xxx flags */
424
425 /* ARCH */
426 EF_MIPS_ARCH_1 = 0x00000000, /* MIPS1 instruction set */
427 EF_MIPS_ARCH_2 = 0x10000000, /* MIPS2 instruction set */
428 EF_MIPS_ARCH_3 = 0x20000000, /* MIPS3 instruction set */
429 EF_MIPS_ARCH_4 = 0x30000000, /* MIPS4 instruction set */
430 EF_MIPS_ARCH_5 = 0x40000000, /* MIPS5 instruction set */
431 EF_MIPS_ARCH_32 = 0x50000000, /* MIPS32 instruction set per linux not elf.h */
432 EF_MIPS_ARCH_64 = 0x60000000, /* MIPS64 instruction set per linux not elf.h */
433 EF_MIPS_ARCH_32R2 = 0x70000000, /* mips32r2, mips32r3, mips32r5 */
434 EF_MIPS_ARCH_64R2 = 0x80000000, /* mips64r2, mips64r3, mips64r5 */
435 EF_MIPS_ARCH_32R6 = 0x90000000, /* mips32r6 */
436 EF_MIPS_ARCH_64R6 = 0xa0000000, /* mips64r6 */
437 EF_MIPS_ARCH = 0xf0000000 /* Mask for applying EF_MIPS_ARCH_ variant */
438};
439
440/* Hexagon Specific e_flags */
441/* Release 5 ABI */
442enum class HEXAGON_EFLAGS: size_t {
443 /* Object processor version flags, bits[3:0] */
444 EF_HEXAGON_MACH_V2 = 0x00000001, /* Hexagon V2 */
445 EF_HEXAGON_MACH_V3 = 0x00000002, /* Hexagon V3 */
446 EF_HEXAGON_MACH_V4 = 0x00000003, /* Hexagon V4 */
447 EF_HEXAGON_MACH_V5 = 0x00000004, /* Hexagon V5 */
448
449 /* Highest ISA version flags */
450 EF_HEXAGON_ISA_MACH = 0x00000000, /* Same as specified in bits[3:0] */
451 /* of e_flags */
452 EF_HEXAGON_ISA_V2 = 0x00000010, /* Hexagon V2 ISA */
453 EF_HEXAGON_ISA_V3 = 0x00000020, /* Hexagon V3 ISA */
454 EF_HEXAGON_ISA_V4 = 0x00000030, /* Hexagon V4 ISA */
455 EF_HEXAGON_ISA_V5 = 0x00000040 /* Hexagon V5 ISA */
456};
457
458/* LoongArch Specific e_flags */
459enum class LOONGARCH_EFLAGS: size_t {
460 EF_LOONGARCH_ABI_SOFT_FLOAT = 0x1,
461 EF_LOONGARCH_ABI_SINGLE_FLOAT = 0x2,
462 EF_LOONGARCH_ABI_DOUBLE_FLOAT = 0x3
463};
464
465
467enum class SYMBOL_SECTION_INDEX: size_t {
468 SHN_UNDEF = 0,
469 SHN_LORESERVE = 0xff00,
470 SHN_LOPROC = 0xff00,
471 SHN_HIPROC = 0xff1f,
472 SHN_LOOS = 0xff20,
473 SHN_HIOS = 0xff3f,
474 SHN_ABS = 0xfff1,
475 SHN_COMMON = 0xfff2,
476 SHN_XINDEX = 0xffff,
477 SHN_HIRESERVE = 0xffff
478};
479
481enum class ELF_SECTION_TYPES: size_t {
482 SHT_NULL = 0,
483 SHT_PROGBITS = 1,
484 SHT_SYMTAB = 2,
485 SHT_STRTAB = 3,
486 SHT_RELA = 4,
487 SHT_HASH = 5,
488 SHT_DYNAMIC = 6,
489 SHT_NOTE = 7,
490 SHT_NOBITS = 8,
491 SHT_REL = 9,
492 SHT_SHLIB = 10,
493 SHT_DYNSYM = 11,
494 SHT_INIT_ARRAY = 14,
495 SHT_FINI_ARRAY = 15,
496 SHT_PREINIT_ARRAY = 16,
497 SHT_GROUP = 17,
498 SHT_SYMTAB_SHNDX = 18,
499 SHT_LOOS = 0x60000000,
500 SHT_ANDROID_REL = 0x60000001,
501 SHT_ANDROID_RELA = 0x60000002,
502 SHT_LLVM_ADDRSIG = 0x6fff4c03,
503 SHT_RELR = 0x6fffff00,
504 SHT_GNU_ATTRIBUTES = 0x6ffffff5,
505 SHT_GNU_HASH = 0x6ffffff6,
506 SHT_GNU_verdef = 0x6ffffffd,
507 SHT_GNU_verneed = 0x6ffffffe,
508 SHT_GNU_versym = 0x6fffffff,
509 SHT_HIOS = 0x6fffffff,
510 SHT_LOPROC = 0x70000000,
511 SHT_ARM_EXIDX = 0x70000001U,
512 SHT_ARM_PREEMPTMAP = 0x70000002U,
513 SHT_ARM_ATTRIBUTES = 0x70000003U,
514 SHT_ARM_DEBUGOVERLAY = 0x70000004U,
515 SHT_ARM_OVERLAYSECTION = 0x70000005U,
516 SHT_HEX_ORDERED = 0x70000000,
518 /* this section based on their sizes */
519 SHT_X86_64_UNWIND = 0x70000001,
520 SHT_MIPS_REGINFO = 0x70000006,
521 SHT_MIPS_OPTIONS = 0x7000000d,
522 SHT_MIPS_ABIFLAGS = 0x7000002a,
524 SHT_HIPROC = 0x7fffffff,
525 SHT_LOUSER = 0x80000000,
526 SHT_HIUSER = 0xffffffff
527};
528
529
530
532enum class ELF_SECTION_FLAGS: size_t {
533 SHF_NONE = 0x0,
534 SHF_WRITE = 0x1,
535 SHF_ALLOC = 0x2,
536 SHF_EXECINSTR = 0x4,
537 SHF_MERGE = 0x10,
538 SHF_STRINGS = 0x20,
539 SHF_INFO_LINK = 0x40U,
540 SHF_LINK_ORDER = 0x80U,
541 SHF_OS_NONCONFORMING = 0x100U,
542 SHF_GROUP = 0x200U,
543 SHF_TLS = 0x400U,
544 SHF_EXCLUDE = 0x80000000U,
545 /* Start of target-specific flags. */
546
547 /* XCORE_SHF_CP_SECTION - All sections with the "c" flag are grouped
548 * together by the linker to form the constant pool and the cp register is
549 * set to the start of the constant pool by the boot code.
550 */
551 XCORE_SHF_CP_SECTION = 0x800U,
552
553 /* XCORE_SHF_DP_SECTION - All sections with the "d" flag are grouped
554 * together by the linker to form the data section and the dp register is
555 * set to the start of the section by the boot code.
556 */
557 XCORE_SHF_DP_SECTION = 0x1000U,
558 SHF_MASKOS = 0x0ff00000,
559 SHF_MASKPROC = 0xf0000000,
561 /* If an object file section does not have this flag set, then it may not hold
562 * more than 2GB and can be freely referred to in objects using smaller code
563 * models. Otherwise, only objects using larger code models can refer to them.
564 * For example, a medium code model object can refer to data in a section that
565 * sets this flag besides being able to refer to data in a section that does
566 * not set it; likewise, a small code model object can refer only to code in a
567 * section that does not set this flag.
568 */
569 SHF_X86_64_LARGE = 0x10000000,
570
571 /* All sections with the GPREL flag are grouped into a global data area
572 * for faster accesses.
573 */
574 SHF_HEX_GPREL = 0x10000000,
575
576 /* Section contains text/data which may be replicated in other sections.
577 * Linker must retain only one copy.
578 */
579 SHF_MIPS_NODUPES = 0x01000000,
580
581 SHF_MIPS_NAMES = 0x02000000,
582 SHF_MIPS_LOCAL = 0x04000000,
583 SHF_MIPS_NOSTRIP = 0x08000000,
584 SHF_MIPS_GPREL = 0x10000000,
585 SHF_MIPS_MERGE = 0x20000000,
586 SHF_MIPS_ADDR = 0x40000000,
587 SHF_MIPS_STRING = 0x80000000
588};
589
590
592enum class SYMBOL_BINDINGS: size_t {
593 STB_LOCAL = 0,
594 STB_GLOBAL = 1,
595 STB_WEAK = 2,
596 STB_GNU_UNIQUE = 10,
597 STB_LOOS = 10,
598 STB_HIOS = 12,
599 STB_LOPROC = 13,
600 STB_HIPROC = 15
601};
602
603
604/* Symbol types. */
605enum class ELF_SYMBOL_TYPES: size_t {
606 STT_NOTYPE = 0, /* Symbol's type is not specified */
607 STT_OBJECT = 1, /* Symbol is a data object (variable, array, etc.) */
608 STT_FUNC = 2, /* Symbol is executable code (function, etc.) */
609 STT_SECTION = 3, /* Symbol refers to a section */
610 STT_FILE = 4, /* Local, absolute symbol that refers to a file */
611 STT_COMMON = 5, /* An uninitialized common block */
612 STT_TLS = 6, /* Thread local data object */
613 STT_GNU_IFUNC = 10, /* GNU indirect function */
614 STT_LOOS = 10, /* Lowest operating system-specific symbol type */
615 STT_HIOS = 12, /* Highest operating system-specific symbol type */
616 STT_LOPROC = 13, /* Lowest processor-specific symbol type */
617 STT_HIPROC = 15 /* Highest processor-specific symbol type */
618};
619
620enum class ELF_SYMBOL_VISIBILITY: size_t {
621 STV_DEFAULT = 0, /* Visibility is specified by binding type */
622 STV_INTERNAL = 1, /* Defined by processor supplements */
623 STV_HIDDEN = 2, /* Not visible to other components */
624 STV_PROTECTED = 3 /* Visible in other components but not preemptable */
625};
626
627
629enum class SEGMENT_TYPES: size_t {
630 PT_NULL = 0,
631 PT_LOAD = 1,
632 PT_DYNAMIC = 2,
633 PT_INTERP = 3,
634 PT_NOTE = 4,
635 PT_SHLIB = 5,
636 PT_PHDR = 6,
637 PT_TLS = 7,
638 PT_LOOS = 0x60000000,
639 PT_HIOS = 0x6fffffff,
640 PT_LOPROC = 0x70000000,
641 PT_HIPROC = 0x7fffffff,
643 /* x86-64 program header types. */
644 /* These all contain stack unwind tables. */
645 PT_GNU_EH_FRAME = 0x6474e550,
646 PT_SUNW_EH_FRAME = 0x6474e550,
647 PT_SUNW_UNWIND = 0x6464e550,
648
649 PT_GNU_STACK = 0x6474e551,
650 PT_GNU_PROPERTY = 0x6474e553,
651 PT_GNU_RELRO = 0x6474e552,
653 /* ARM program header types. */
654 PT_ARM_ARCHEXT = 0x70000000,
656 /* These all contain stack unwind tables. */
657 PT_ARM_EXIDX = 0x70000001,
658 PT_ARM_UNWIND = 0x70000001,
659
660 /* MIPS program header types. */
661 PT_MIPS_REGINFO = 0x70000000,
662 PT_MIPS_RTPROC = 0x70000001,
663 PT_MIPS_OPTIONS = 0x70000002,
664 PT_MIPS_ABIFLAGS = 0x70000003
665};
666
667
669enum class ELF_SEGMENT_FLAGS: size_t {
670 PF_NONE = 0,
671 PF_X = 1,
672 PF_W = 2,
673 PF_R = 4,
674 PF_MASKOS = 0x0ff00000,
675 PF_MASKPROC = 0xf0000000
676};
677
678
680enum class DYNAMIC_TAGS: size_t {
681 DT_NULL = 0,
682 DT_NEEDED = 1,
683 DT_PLTRELSZ = 2,
684 DT_PLTGOT = 3,
685 DT_HASH = 4,
686 DT_STRTAB = 5,
687 DT_SYMTAB = 6,
688 DT_RELA = 7,
689 DT_RELASZ = 8,
690 DT_RELAENT = 9,
691 DT_STRSZ = 10,
692 DT_SYMENT = 11,
693 DT_INIT = 12,
694 DT_FINI = 13,
695 DT_SONAME = 14,
696 DT_RPATH = 15,
697 DT_SYMBOLIC = 16,
698 DT_REL = 17,
699 DT_RELSZ = 18,
700 DT_RELENT = 19,
701 DT_PLTREL = 20,
702 DT_DEBUG = 21,
703 DT_TEXTREL = 22,
704 DT_JMPREL = 23,
705 DT_BIND_NOW = 24,
706 DT_INIT_ARRAY = 25,
707 DT_FINI_ARRAY = 26,
708 DT_INIT_ARRAYSZ = 27,
709 DT_FINI_ARRAYSZ = 28,
710 DT_RUNPATH = 29,
711 DT_FLAGS = 30,
712 DT_ENCODING = 32,
714 DT_PREINIT_ARRAY = 32,
715 DT_PREINIT_ARRAYSZ = 33,
716 DT_SYMTAB_SHNDX = 34,
717 DT_RELRSZ = 35,
718 DT_RELR = 36,
719 DT_RELRENT = 37,
721 DT_LOOS = 0x60000000,
722 DT_HIOS = 0x6FFFFFFF,
723 DT_LOPROC = 0x70000000,
724 DT_HIPROC = 0x7FFFFFFF,
726 DT_GNU_HASH = 0x6FFFFEF5,
727 DT_RELACOUNT = 0x6FFFFFF9,
728 DT_RELCOUNT = 0x6FFFFFFA,
730 DT_FLAGS_1 = 0x6FFFFFFB,
731 DT_VERSYM = 0x6FFFFFF0,
732 DT_VERDEF = 0x6FFFFFFC,
733 DT_VERDEFNUM = 0x6FFFFFFD,
734 DT_VERNEED = 0x6FFFFFFE,
735 DT_VERNEEDNUM = 0x6FFFFFFF,
737 /* Mips specific dynamic table entry tags. */
738 DT_MIPS_RLD_VERSION = 0x70000001,
739 DT_MIPS_TIME_STAMP = 0x70000002,
740 DT_MIPS_ICHECKSUM = 0x70000003,
741 DT_MIPS_IVERSION = 0x70000004,
742 DT_MIPS_FLAGS = 0x70000005,
743 DT_MIPS_BASE_ADDRESS = 0x70000006,
744 DT_MIPS_MSYM = 0x70000007,
745 DT_MIPS_CONFLICT = 0x70000008,
746 DT_MIPS_LIBLIST = 0x70000009,
747 DT_MIPS_LOCAL_GOTNO = 0x7000000a,
748 DT_MIPS_CONFLICTNO = 0x7000000b,
749 DT_MIPS_LIBLISTNO = 0x70000010,
750 DT_MIPS_SYMTABNO = 0x70000011,
751 DT_MIPS_UNREFEXTNO = 0x70000012,
752 DT_MIPS_GOTSYM = 0x70000013,
753 DT_MIPS_HIPAGENO = 0x70000014,
754 DT_MIPS_RLD_MAP = 0x70000016,
755 DT_MIPS_DELTA_CLASS = 0x70000017,
756 DT_MIPS_DELTA_CLASS_NO = 0x70000018,
757 DT_MIPS_DELTA_INSTANCE = 0x70000019,
758 DT_MIPS_DELTA_INSTANCE_NO = 0x7000001A,
759 DT_MIPS_DELTA_RELOC = 0x7000001B,
760 DT_MIPS_DELTA_RELOC_NO = 0x7000001C,
761 DT_MIPS_DELTA_SYM = 0x7000001D,
762 DT_MIPS_DELTA_SYM_NO = 0x7000001E,
763 DT_MIPS_DELTA_CLASSSYM = 0x70000020,
764 DT_MIPS_DELTA_CLASSSYM_NO = 0x70000021,
765 DT_MIPS_CXX_FLAGS = 0x70000022,
766 DT_MIPS_PIXIE_INIT = 0x70000023,
767 DT_MIPS_SYMBOL_LIB = 0x70000024,
768 DT_MIPS_LOCALPAGE_GOTIDX = 0x70000025,
769 DT_MIPS_LOCAL_GOTIDX = 0x70000026,
770 DT_MIPS_HIDDEN_GOTIDX = 0x70000027,
771 DT_MIPS_PROTECTED_GOTIDX = 0x70000028,
772 DT_MIPS_OPTIONS = 0x70000029,
773 DT_MIPS_INTERFACE = 0x7000002A,
774 DT_MIPS_DYNSTR_ALIGN = 0x7000002B,
775 DT_MIPS_INTERFACE_SIZE = 0x7000002C,
776 DT_MIPS_RLD_TEXT_RESOLVE_ADDR = 0x7000002D,
777 DT_MIPS_PERF_SUFFIX = 0x7000002E,
778 DT_MIPS_COMPACT_SIZE = 0x7000002F,
779 DT_MIPS_GP_VALUE = 0x70000030,
780 DT_MIPS_AUX_DYNAMIC = 0x70000031,
781 DT_MIPS_PLTGOT = 0x70000032,
782 DT_MIPS_RWPLT = 0x70000034,
784 /* Android specific dynamic table entry tags. */
785 DT_ANDROID_REL_OFFSET = 0x6000000D,
786 DT_ANDROID_REL_SIZE = 0x6000000E,
787 DT_ANDROID_REL = 0x6000000F,
788 DT_ANDROID_RELSZ = 0x60000010,
789 DT_ANDROID_RELA = 0x60000011,
790 DT_ANDROID_RELASZ = 0x60000012,
791 DT_ANDROID_RELR = 0x6FFFE000,
792 DT_ANDROID_RELRSZ = 0x6FFFE001,
793 DT_ANDROID_RELRENT = 0x6FFFE003,
794 DT_ANDROID_RELRCOUNT = 0x6FFFE005
795};
796
798enum class DYNAMIC_FLAGS: size_t {
799 DF_ORIGIN = 0x00000001,
800 DF_SYMBOLIC = 0x00000002,
801 DF_TEXTREL = 0x00000004,
802 DF_BIND_NOW = 0x00000008,
803 DF_STATIC_TLS = 0x00000010,
804};
805
806enum class DYNAMIC_FLAGS_1: size_t {
807 DF_1_NOW = 0x00000001,
808 DF_1_GLOBAL = 0x00000002,
809 DF_1_GROUP = 0x00000004,
810 DF_1_NODELETE = 0x00000008,
811 DF_1_LOADFLTR = 0x00000010,
812 DF_1_INITFIRST = 0x00000020,
813 DF_1_NOOPEN = 0x00000040,
814 DF_1_ORIGIN = 0x00000080,
815 DF_1_DIRECT = 0x00000100,
816 DF_1_TRANS = 0x00000200,
817 DF_1_INTERPOSE = 0x00000400,
818 DF_1_NODEFLIB = 0x00000800,
819 DF_1_NODUMP = 0x00001000,
820 DF_1_CONFALT = 0x00002000,
821 DF_1_ENDFILTEE = 0x00004000,
822 DF_1_DISPRELDNE = 0x00008000,
823 DF_1_DISPRELPND = 0x00010000,
824 DF_1_NODIRECT = 0x00020000,
825 DF_1_IGNMULDEF = 0x00040000,
826 DF_1_NOKSYMS = 0x00080000,
827 DF_1_NOHDR = 0x00100000,
828 DF_1_EDITED = 0x00200000,
829 DF_1_NORELOC = 0x00400000,
830 DF_1_SYMINTPOSE = 0x00800000,
831 DF_1_GLOBAUDIT = 0x01000000,
832 DF_1_SINGLETON = 0x02000000,
833 DF_1_PIE = 0x08000000
834};
835
836/* DT_MIPS_FLAGS values. */
837enum {
838 RHF_NONE = 0x00000000, /* No flags. */
839 RHF_QUICKSTART = 0x00000001, /* Uses shortcut pointers. */
840 RHF_NOTPOT = 0x00000002, /* Hash size is not a power of two. */
841 RHS_NO_LIBRARY_REPLACEMENT = 0x00000004, /* Ignore LD_LIBRARY_PATH. */
842 RHF_NO_MOVE = 0x00000008, /* DSO address may not be relocated. */
843 RHF_SGI_ONLY = 0x00000010, /* SGI specific features. */
844 RHF_GUARANTEE_INIT = 0x00000020, /* Guarantee that .init will finish */
845 /* executing before any non-init */
846 /* code in DSO is called. */
847 RHF_DELTA_C_PLUS_PLUS = 0x00000040, /* Contains Delta C++ code. */
848 RHF_GUARANTEE_START_INIT = 0x00000080, /* Guarantee that .init will start */
849 /* executing before any non-init */
850 /* code in DSO is called. */
851 RHF_PIXIE = 0x00000100, /* Generated by pixie. */
852 RHF_DEFAULT_DELAY_LOAD = 0x00000200, /* Delay-load DSO by default. */
853 RHF_REQUICKSTART = 0x00000400, /* Object may be requickstarted */
854 RHF_REQUICKSTARTED = 0x00000800, /* Object has been requickstarted */
855 RHF_CORD = 0x00001000, /* Generated by cord. */
856 RHF_NO_UNRES_UNDEF = 0x00002000, /* Object contains no unresolved */
857 /* undef symbols. */
858 RHF_RLD_ORDER_SAFE = 0x00004000 /* Symbol table is in a safe order. */
859};
860
862enum {
863 VER_DEF_NONE = 0,
864 VER_DEF_CURRENT = 1
865};
866
868enum {
869 VER_FLG_BASE = 0x1,
870 VER_FLG_WEAK = 0x2,
871 VER_FLG_INFO = 0x4
872};
873
875enum {
878 VERSYM_VERSION = 0x7fff,
879 VERSYM_HIDDEN = 0x8000
881
883enum {
884 VER_NEED_NONE = 0,
885 VER_NEED_CURRENT = 1
886};
887
890enum class DYNSYM_COUNT_METHODS: size_t {
891 COUNT_AUTO = 0,
892 COUNT_SECTION = 1,
893 COUNT_HASH = 2,
895};
896
897enum class RELOCATION_PURPOSES: size_t {
898 RELOC_PURPOSE_NONE = 0,
899 RELOC_PURPOSE_PLTGOT = 1,
900 RELOC_PURPOSE_DYNAMIC = 2,
901 RELOC_PURPOSE_OBJECT = 3,
902};
903
904}
905}
906
907ENABLE_BITMASK_OPERATORS(LIEF::ELF::ELF_SEGMENT_FLAGS)
908ENABLE_BITMASK_OPERATORS(LIEF::ELF::ARM_EFLAGS)
909ENABLE_BITMASK_OPERATORS(LIEF::ELF::MIPS_EFLAGS)
910ENABLE_BITMASK_OPERATORS(LIEF::ELF::HEXAGON_EFLAGS)
911ENABLE_BITMASK_OPERATORS(LIEF::ELF::LOONGARCH_EFLAGS)
912ENABLE_BITMASK_OPERATORS(LIEF::ELF::ELF_SECTION_FLAGS)
913ENABLE_BITMASK_OPERATORS(LIEF::ELF::DYNAMIC_FLAGS)
914ENABLE_BITMASK_OPERATORS(LIEF::ELF::DYNAMIC_FLAGS_1)
915
916#endif
ELF_SECTION_FLAGS
Definition ELF/enums.hpp:532
SEGMENT_TYPES
Segment types.
Definition ELF/enums.hpp:629
DYNAMIC_FLAGS
Definition ELF/enums.hpp:798
SYMBOL_BINDINGS
Definition ELF/enums.hpp:592
ELF_DATA
Definition ELF/enums.hpp:263
E_TYPE
Definition ELF/enums.hpp:44
OS_ABI
Definition ELF/enums.hpp:270
ARCH
Machine architectures See current registered ELF machine architectures at: http://www....
Definition ELF/enums.hpp:67
DYNSYM_COUNT_METHODS
Definition ELF/enums.hpp:890
RELOC_x86_64
Definition ELF/enums.hpp:301
SYMBOL_SECTION_INDEX
Definition ELF/enums.hpp:467
DYNAMIC_TAGS
Definition ELF/enums.hpp:680
RELOC_i386
Definition ELF/enums.hpp:306
@ VER_NDX_LOCAL
Definition ELF/enums.hpp:876
@ VERSYM_VERSION
Definition ELF/enums.hpp:878
@ VERSYM_HIDDEN
Definition ELF/enums.hpp:879
@ VER_NDX_GLOBAL
Definition ELF/enums.hpp:877
IDENTITY
Definition ELF/enums.hpp:28
ELF_SEGMENT_FLAGS
Definition ELF/enums.hpp:669
ELF_SECTION_TYPES
Definition ELF/enums.hpp:481
ELF_CLASS
Definition ELF/enums.hpp:256
DYNAMIC_FLAGS_1
Definition ELF/enums.hpp:806
VERSION
Definition ELF/enums.hpp:56
LIEF namespace.
Definition Abstract/Binary.hpp:32