elflib
Version:
ELF file reader and writer
367 lines (366 loc) • 8.8 kB
TypeScript
/** The architecture of the ELF file, either 32 or 64 bits. //* uint8 */
export declare enum Class {
None = 0,
ELF32 = 1,
ELF64 = 2
}
/** The endianness of the data in the ELF file. //* uint8 */
export declare enum Endian {
None = 0,
Little = 1,
Big = 2
}
/** The version of the ELF file. There is currently only one version. //* uint8 */
export declare enum Version {
None = 0,
Current = 1
}
/** The type of Application Binary Interface. //* uint8 */
export declare enum ABI {
SystemV = 0,
HPUX = 1,
NetBSD = 2,
Linux = 3,
GNUHurd = 4,
Solaris = 6,
AIX = 7,
IRIX = 8,
FreeBSD = 9,
Tru64 = 10,
NovelloModesto = 11,
OpenBSD = 12,
OpenVMS = 13,
NonStopKernel = 14,
AROS = 15,
FenixOS = 16,
CloudABI = 17,
ARMEABI = 64,
ARM = 97,
CafeOS = 202,
Standalone = 255
}
/** The type of ELF file. Executables are ELF files, while some other files (like .o or .so files)
* are also ELF files but of different types. //? uint16 */
export declare enum Type {
None = 0,
Relocatable = 1,
Executable = 2,
Shared = 3,
Core = 4,
RPL = 65025
}
/** The type of Instruction Set Architecture. //? uint16 */
export declare enum ISA {
None = 0,
M32 = 1,
SPARC = 2,
x86 = 3,
ISA68K = 4,
ISA88K = 5,
IAMCU = 6,
ISA860 = 7,
MIPS = 8,
S370 = 9,
MIPS_RS3_LE = 10,
PARISC = 15,
VPP500 = 17,
SPARC32PLUS = 18,
ISA960 = 19,
PPC = 20,
PPC64 = 21,
S390 = 22,
SPU = 23,
V800 = 36,
FR20 = 37,
RH32 = 38,
RCE = 39,
ARM = 40,
FAKE_ALPHA = 41,
SH = 42,
SPARCV9 = 43,
TRICORE = 44,
ARC = 45,
H8_300 = 46,
H8_300H = 47,
H8S = 48,
H8_500 = 49,
IA_64 = 50,
MIPS_X = 51,
COLDFIRE = 52,
ISA68HC12 = 53,
MMA = 54,
PCP = 55,
NCPU = 56,
NDR1 = 57,
STARCORE = 58,
ME16 = 59,
ST100 = 60,
TINYJ = 61,
X86_64 = 62,
PDSP = 63,
PDP10 = 64,
PDP11 = 65,
FX66 = 66,
ST9PLUS = 67,
ST7 = 68,
ISA68HC16 = 69,
ISA68HC11 = 70,
ISA68HC08 = 71,
ISA68HC05 = 72,
SVX = 73,
ST19 = 74,
VAX = 75,
CRIS = 76,
JAVELIN = 77,
FIREPATH = 78,
ZSP = 79,
MMIX = 80,
HUANY = 81,
PRISM = 82,
AVR = 83,
FR30 = 84,
D10V = 85,
D30V = 86,
V850 = 87,
M32R = 88,
MN10300 = 89,
MN10200 = 90,
PJ = 91,
OPENRISC = 92,
ARC_COMPACT = 93,
XTENSA = 94,
VIDEOCORE = 95,
TMM_GPP = 96,
NS32K = 97,
TPC = 98,
SNP1K = 99,
ST200 = 100,
IP2K = 101,
MAX = 102,
CR = 103,
F2MC16 = 104,
MSP430 = 105,
BLACKFIN = 106,
SE_C33 = 107,
SEP = 108,
ARCA = 109,
UNICORE = 110,
EXCESS = 111,
DXP = 112,
ALTERA_NIOS2 = 113,
CRX = 114,
XGATE = 115,
C166 = 116,
M16C = 117,
DSPIC30F = 118,
CE = 119,
M32C = 120,
TSK3000 = 131,
RS08 = 132,
SHARC = 133,
ECOG2 = 134,
SCORE7 = 135,
DSP24 = 136,
VIDEOCORE3 = 137,
LATTICEMICO32 = 138,
SE_C17 = 139,
TI_C6000 = 140,
TI_C2000 = 141,
TI_C5500 = 142,
TI_ARP32 = 143,
TI_PRU = 144,
MMDSP_PLUS = 160,
CYPRESS_M8C = 161,
R32C = 162,
TRIMEDIA = 163,
QDSP6 = 164,
ISA8051 = 165,
STXP7X = 166,
NDS32 = 167,
ECOG1X = 168,
MAXQ30 = 169,
XIMO16 = 170,
MANIK = 171,
CRAYNV2 = 172,
RX = 173,
METAG = 174,
MCST_ELBRUS = 175,
ECOG16 = 176,
CR16 = 177,
ETPU = 178,
SLE9X = 179,
L10M = 180,
K10M = 181,
AARCH64 = 183,
AVR32 = 185,
STM8 = 186,
TILE64 = 187,
TILEPRO = 188,
MICROBLAZE = 189,
CUDA = 190,
TILEGX = 191,
CLOUDSHIELD = 192,
COREA_1ST = 193,
COREA_2ND = 194,
ARC_COMPACT2 = 195,
OPEN8 = 196,
RL78 = 197,
VIDEOCORE5 = 198,
ISA78KOR = 199,
ISA56800EX = 200,
BA1 = 201,
BA2 = 202,
XCORE = 203,
MCHP_PIC = 204,
KM32 = 210,
KMX32 = 211,
EMX16 = 212,
EMX8 = 213,
KVARC = 214,
CDP = 215,
COGE = 216,
COOL = 217,
NORC = 218,
CSR_KALIMBA = 219,
Z80 = 220,
VISIUM = 221,
FT32 = 222,
MOXIE = 223,
AMDGPU = 224,
RISCV = 243,
BPF = 247,
CSKY = 252
}
/** The type of a segment (program header entry). //! uint32 */
export declare enum SegmentType {
Null = 0,
Load = 1,
Dynamic = 2,
Interp = 3,
Note = 4,
ShLib = 5,
ProgHeaderTable = 6,
GnuEhFrame = 1685382480,
GnuStack = 1685382481,
GnuRelRo = 1685382482
}
/** The type of section (section header entry). //! uint32 */
export declare enum SectionType {
/** Inactive section with undefined values (SHT_NULL) */
Null = 0,
/** Information defined by the program, includes executable code and data (SHT_PROGBITS) */
ProgBits = 1,
/** Section data contains a symbol table (SHT_SYMTAB) */
SymTab = 2,
/** Section data contains a string table (SHT_STRTAB) */
StrTab = 3,
/** Section data contains relocation entries with explicit addends (SHT_RELA) */
Rela = 4,
/** Section data contains a symbol hash table. Must be present for dynamic linking (SHT_HASH) */
Hash = 5,
/** Section data contains information for dynamic linking (SHT_DYNAMIC) */
Dynamic = 6,
/** Section data contains information that marks the file in some way (SHT_NOTE) */
Note = 7,
/** Section data occupies no space in the file but otherwise resembles SHT_PROGBITS (SHT_NOBITS) */
NoBits = 8,
/** Section data contains relocation entries without explicit addends (SHT_REL) */
Rel = 9,
/** Section is reserved but has unspecified semantics (SHT_SHLIB) */
ShLib = 10,
/** Section data contains a minimal set of dynamic linking symbols (SHT_DYNSYM) */
DynSym = 11,
/** Section data contains an array of constructors (SHT_INIT_ARRAY) */
InitArray = 14,
/** Section data contains an array of destructors (SHT_FINI_ARRAY) */
FiniArray = 15,
/** Section data contains an array of pre-constructors (SHT_PREINIT_ARRAY) */
PreInitArray = 16,
/** Section group (SHT_GROUP) */
Group = 17,
/** Extended symbol table section index (SHT_SYMTAB_SHNDX) */
ShNdx = 18,
/** Number of reserved SHT_* values (SHT_NUM) */
Num = 19,
/** Object attributes (SHT_GNU_ATTRIBUTES) */
GnuAttributes = 1879048181,
/** GNU-style hash section (SHT_GNU_HASH) */
GnuHash = 1879048182,
/** Pre-link library list (SHT_GNU_LIBLIST) */
GnuLibList = 1879048183,
/** Version definition section (SHT_GNU_verdef) */
GnuVerDef = 1879048189,
/** Version needs section (SHT_GNU_verdneed) */
GnuVerNeed = 1879048190,
/** Version symbol table (SHT_GNU_versym) */
GnuVerSym = 1879048191,
/** RPL exports table (SHT_RPL_EXPORTS) */
RPLExports = 2147483649,
/** RPL imports table (SHT_RPL_IMPORTS) */
RPLImports = 2147483650,
/** RPL file CRC hashes (SHT_RPL_CRCS) */
RPLCrcs = 2147483651,
/** RPL file information (SHT_RPL_FILEINFO) */
RPLFileInfo = 2147483652
}
/** Section header flags //! uint32 */
export declare enum SectionFlags {
None = 0,
/** (SHF_WRITE) */
Write = 1,
/** (SHF_ALLOC) */
Alloc = 2,
/** (SHF_EXECINSTR) */
Executable = 4,
/** (SHF_MERGE) */
Merge = 16,
/** (SHF_STRINGS) */
Strings = 32,
/** (SHF_INFO_LINK) */
InfoLink = 64,
/** (SHF_LINK_ORDER) */
LinkOrder = 128,
/** (SHF_OS_NONCONFORMING) */
Nonconforming = 256,
/** (SHF_GROUP) */
Group = 512,
/** (SHF_TLS) */
TLS = 1024,
/** (SHF_COMPRESSED) */
Compressed = 134217728,
/** (SHF_AMD64_LARGE) */
AMD64Large = 268435456,
/** (SHF_ORDERED) */
Ordered = 1073741824,
/** (SHF_EXCLUDE) */
Exclude = 2147483648
}
/** The scope of the symbol. //* nybble */
export declare enum SymbolBinding {
/** A local symbol is akin to a local variable. */
Local = 0,
/** A global symbol is akin to a global variable or function. */
Global = 1,
/** A weak symbol is a symbol that can be replaced by a non-weak symbol in another object file when linking. */
Weak = 2
}
/** The type of symbol. The most common symbol is a function or object,
* but other kinds of symbols exist for keeping track of various things. //* nybble */
export declare enum SymbolType {
None = 0,
Object = 1,
Function = 2,
Section = 3,
File = 4,
Common = 5,
ThreadLocalStorage = 6,
RelocationExpression = 7,
SignedRelocationExpression = 8
}
/** The visibility of a symbol. //* uint8 */
export declare enum SymbolVisibility {
Default = 0,
Internal = 1,
Hidden = 2,
Protected = 3
}