ddn.elf.types
ELF type definitions and constants.
This module provides all core ELF (Executable and Linkable Format) type definitions and constants as specified by the ELF specification. All enumerations follow the UPPER_CASE naming convention for their fields.
Types 16
ELF file class (32-bit or 64-bit).
ELF data encoding (endianness).
ELF file version.
Operating system and ABI identification.
ELF object file type.
ELF machine (architecture) type.
ELF section header types.
ELF section header flags.
These flags can be bitwise OR'd together.
ELF program header types (segment types).
ELF program header segment flags.
These flags can be bitwise OR'd together.
ELF symbol binding.
The binding is encoded in the st_info field as the upper 4 bits.
ELF symbol types.
The type is encoded in the st_info field as the lower 4 bits.
ELF symbol visibility.
Visibility is encoded in the st_other field. The values follow the ELF ABI (STV_DEFAULT, STV_INTERNAL, STV_HIDDEN, STV_PROTECTED).
Special section indices.
Values follow the ELF ABI (SHN_* constants). Note that SHN_LOPROC and SHN_LORESERVE share the value 0xff00, and SHN_XINDEX and SHN_HIRESERVE share the value 0xffff.
ELF dynamic array tags.
Dynamic section flags (DF_*).
These flags appear in the d_val field of a DT_FLAGS dynamic entry.
Functions 19
bool isElfMagic(const(ubyte)[] data) pure nothrow @nogc @safeCheck if data starts with ELF magic number.ubyte makeStInfo(SymbolBinding binding, SymbolType type) pure nothrow @nogc @safeEncode symbol binding and type into st_info field.SymbolBinding getStBinding(ubyte info) pure nothrow @nogc @safeExtract symbol binding from st_info field.ubyte makeStOther(SymbolVisibility visibility) pure nothrow @nogc @safeEncode symbol visibility into st_other field.SymbolVisibility getStVisibility(ubyte other) pure nothrow @nogc @safeExtract symbol visibility from st_other field.bool isOsSpecificSection(SectionType type) pure nothrow @nogc @safeCheck if a section type is a valid OS-specific value.bool isProcSpecificSection(SectionType type) pure nothrow @nogc @safeCheck if a section type is a valid processor-specific value.bool isOsSpecificSegment(SegmentType type) pure nothrow @nogc @safeCheck if a segment type is a valid OS-specific value.bool isProcSpecificSegment(SegmentType type) pure nothrow @nogc @safeCheck if a segment type is a valid processor-specific value.bool isValidSymbolBinding(SymbolBinding binding) pure nothrow @nogc @safeCheck if a symbol binding is valid.Variables 16
EI_MAG0 = 0ELF identification array indices.
These indices correspond to positions in the e_ident array of the ELF header. File identification byte 0 (0x7F).
EI_MAG1 = 1File identification byte 1 ('E').
EI_MAG2 = 2File identification byte 2 ('L').
EI_MAG3 = 3File identification byte 3 ('F').
EI_CLASS = 4File class (32-bit or 64-bit).
EI_DATA = 5Data encoding (little or big endian).
EI_VERSION = 6File version.
EI_OSABI = 7Operating system/ABI identification.
EI_ABIVERSION = 8ABI version.
EI_PAD = 9Start of padding bytes.
EI_NIDENT = 16Size of e_ident array.
ELFMAG0 = 0x7fELF magic number bytes.
These form the string "\x7fELF" which identifies an ELF file. Magic byte 0 (0x7F).
ELFMAG1 = 'E'Magic byte 1 ('E').
ELFMAG2 = 'L'Magic byte 2 ('L').
ELFMAG3 = 'F'Magic byte 3 ('F').
PN_XNUM = 0xffffEscape value for e_phnum: the real program header count is stored in the sh_info field of section header zero.