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 15

enumElfClass : ubyte

ELF file class (32-bit or 64-bit).

NONE = 0No class (invalid)
CLASS32 = 132-bit ELF file
CLASS64 = 264-bit ELF file
enumElfData : ubyte

ELF data encoding (endianness).

NONE = 0Invalid data encoding
LSB = 12's complement, little endian
MSB = 22's complement, big endian
enumElfVersion : ubyte

ELF file version.

NONE = 0Invalid version
CURRENT = 1Current ELF version (1)
enumElfOsAbi : ubyte

Operating system and ABI identification.

NONE = 0No extensions or unspecified
HPUX = 1Hewlett-Packard HP-UX
NETBSD = 2NetBSD
LINUX = 3GNU/Linux
HURD = 4GNU Hurd
SOLARIS = 6Sun Solaris
AIX = 7AIX
IRIX = 8IRIX
FREEBSD = 9FreeBSD
TRU64 = 10Tru64 UNIX
MODESTO = 11Novell Modesto
OPENBSD = 12OpenBSD
OPENVMS = 13Open VMS
NSK = 14Hewlett-Packard Non-Stop UX
AROS = 15Amiga Research OS
FENIXOS = 16Fenix OS
CLOUDABI = 17CloudABI
OPENVOS = 18Stratus Technologies OpenVOS
enumElfType : ushort

ELF object file type.

NONE = 0No file type (invalid)
REL = 1Relocatable object file
EXEC = 2Executable file
DYN = 3Shared object file
CORE = 4Core dump file
LOPROC = 0xff00Processor-specific value
HIPROC = 0xffffProcessor-specific value
enumElfMachine : ushort

ELF machine (architecture) type.

NONE = 0No machine
M32 = 1AT&T WE 32100
SPARC = 2SUN SPARC
I386 = 3Intel 80386
M68K = 4Motorola m68k family
M88K = 5Motorola m88k family
IAMCU = 6Intel MCU
I860 = 7Intel 80860
MIPS = 8MIPS I Architecture
S370 = 9IBM System/370
RS3000 = 10MIPS RS3000 Little-endian
PARISC = 15Hewlett-Packard PA-RISC
VPP500 = 17Fujitsu VPP500
SPARC32PLUS = 18Enhanced instruction set SPARC
I960 = 19Intel 80960
PPC = 20PowerPC
PPC64 = 21PowerPC 64-bit
S390 = 22IBM System/390
SPU = 23IBM SPU/SPU
V800 = 36NEC V800 series
FR20 = 37Fujitsu FR20
RH32 = 38TRW RH-32
RCE = 39Motorola RCE
ARM = 40ARM 32-bit architecture (AARCH32)
ALPHA = 41Digital Alpha
SH = 42Hitachi SH
SPARCV9 = 43SPARC-V9 64-bit
TRICORE = 44Siemens TriCore embedded processor
ARC = 45Argonaut RISC Core, Argonaut Technologies Ltd.
H8_300 = 46Hitachi H8/300
H8_300H = 47Hitachi H8/300H
H8S = 48Hitachi H8S
H8_500 = 49Hitachi H8/500
IA_64 = 50Intel Merced Processor
MIPS_X = 51Stanford MIPS-X
COLDFIRE = 52Motorola ColdFire
M68HC12 = 53Motorola M68HC12
MMA = 54Fujitsu MMA Multimedia Accelerator
PCP = 55Siemens PCP
NCPU = 56Sony nCPU embedded RISC
NDR1 = 57Denso NDR1 microprocessor
STARCORE = 58Motorola Star*Core processor
ME16 = 59Toyota ME16 processor
ST100 = 60STMicroelectronics ST100 processor
TINYJ = 61Advanced Logic Corp. TinyJ embedded processor family
X86_64 = 62AMD x86-64 architecture
DSP = 63Sony DSP Processor
PDP10 = 64Digital Equipment Corp. PDP-10
PDP11 = 65Digital Equipment Corp. PDP-11
FX66 = 66Siemens FX66 microcontroller
ST9PLUS = 67STMicroelectronics ST9+ 8/16 bit microcontroller
ST7 = 68STMicroelectronics ST7 8-bit microcontroller
MC68HC16 = 69Motorola MC68HC16 Microcontroller
MC68HC11 = 70Motorola MC68HC11 Microcontroller
MC68HC08 = 71Motorola MC68HC08 Microcontroller
MC68HC05 = 72Motorola MC68HC05 Microcontroller
SVX = 73Silicon Graphics SVx
ST19 = 74STMicroelectronics ST19 8-bit microcontroller
VAX = 75Digital VAX
CRIS = 76Axis Communications 32-bit embedded processor
JAVELIN = 77Infineon Technologies 32-bit embedded processor
FIREPATH = 78Element 14 64-bit DSP Processor
ZSP = 79LSI Logic 16-bit DSP Processor
MMIX = 80Donald Knuth's educational 64-bit processor
HUANY = 81Harvard University machine-independent object format
PRISM = 82SiTera Prism
AVR = 83Atmel AVR 8-bit microcontroller
FR30 = 84Fujitsu FR30
D10V = 85D10V
D30V = 86D30V
V850 = 87NEC v850
M32R = 88Mitsubishi M32R
MN10300 = 89Matsushita MN10300
MN10200 = 90Matsushita MN10200
PICOJAVA = 91picoJava
OPENRISC = 92OpenRISC 32-bit embedded processor
ARC_COMPACT = 93ARC International ARCompact processor
XTENSA = 94Tensilica Xtensa Architecture
VIDEOCORE = 95Alphamosaic VideoCore processor
TMM_GPP = 96Thompson Multimedia General Purpose Processor
NS32K = 97National Semiconductor 32000 series
TPC = 98Tenor Network TPC processor
SNP1K = 99Trebia SNP 1000 processor
ST200 = 100STMicroelectronics ST200
IP2K = 101Ubicom IP2022 micro controller
MAX = 102MAX Processor
COMPACTRISC = 103National Semiconductor CompactRISC microprocessor
F2MC16 = 104Fujitsu F2MC16
MSP430 = 105Texas Instruments MSP430 microcontroller
BLACKFIN = 106Analog Devices Blackfin (DSP) processor
SE_C33 = 107S1C33 Family of Seiko Epson processors
SEP = 108Sharp embedded microprocessor
ARCA = 109Arca RISC Microprocessor
UNICORE = 110Microprocessor series from PKU-Unity Ltd. and MPRC of Peking University
EXCESS = 111eXcess: 64-bit RISC CPU from S&S Labs
IXP1200 = 112IXP12000
DT32 = 113Atmel Corporation 32-bit microprocessor family
OPEN8 = 114Open8 RISC
ST78K0S = 115STMicroelectronics STMicro 64-bit VLIW Data Signal Processor
NIOS2 = 116Altera Nios II soft-core processor
HPPA = 117Hewlett-Packard PA-RISC
BIGFOOT = 118Netronics BigFoot (16-bit microcontroller)
RISCV32 = 133RISC-V 32-bit
RISCV64 = 134RISC-V 64-bit
RISCV128 = 135RISC-V 128-bit
C17 = 136Seiko Epson C17 family
C6000 = 137Texas Instruments TMS320C6000 DSP family
C2000 = 138Texas Instruments TMS320C2000 DSP family
C5500 = 139Texas Instruments TMS320C55x DSP family
DSPIC33F = 140Freescale Communication Engine RISC core
M24K = 141MIPS MT
RISCV = 243RISC-V
RX = 144Renesas RX family
METAG = 145Imagination Technologies META processor architecture
MCST_ELBRUS = 146MCST Elbrus general purpose architecture
MCST_E1PC = 147MCST E1PC+ processor
MCST_E2K = 148MCST Elbrus 2K architecture
INTEL205 = 149Cavium Nitrox
INTEL206 = 150Cavium Nitrox+
INTEL207 = 151Loongson LoongArch 32-bit
INTEL208 = 152Loongson LoongArch 64-bit
INTEL209 = 153Loongson LoongArch 128-bit
AARCH64 = 183Generic
LOONGARCH32 = 258Loongson LoongArch 32-bit
LOONGARCH64 = 259Loongson LoongArch 64-bit
enumSectionType : uint

ELF section header types.

NULL = 0Inactive section
PROGBITS = 1Program-defined contents
SYMTAB = 2Symbol table
STRTAB = 3String table
RELA = 4Relocation entries with explicit addends
HASH = 5Symbol hash table
DYNAMIC = 6Dynamic linking information
NOTE = 7Note section
NOBITS = 8Program space with no data (bss)
REL = 9Relocation entries without addends
SHLIB = 10Reserved
DYNSYM = 11Dynamic symbol table
INIT_ARRAY = 14Array of constructors
FINI_ARRAY = 15Array of destructors
PREINIT_ARRAY = 16Array of pre-constructors
GROUP = 17Section group
SYMTAB_SHNDX = 18Extended section index
GNU_ATTRIBUTES = 0x6ffffff5OS-specific
GNU_HASH = 0x6ffffff6GNU object-specific
GNU_LIBLIST = 0x6ffffff7GNU version definitions
CHECKSUM = 0x6ffffff8Object section data check
SUNW_MOVE = 0x6ffffffaSUN compatibility versioning
SUNW_COMDAT = 0x6ffffffbSUN compatibility versioning
SUNW_SYMINFO = 0x6ffffffcSUN debug info
GNU_VERDEF = 0x6ffffffdGNU version symbol table
GNU_VERNEED = 0x6ffffffeGNU version needs
GNU_VERSYM = 0x6fffffffGNU version symbol table
LOOS = 0x60000000OS-specific range start
LOPROC = 0x70000000Processor-specific range start
HIPROC = 0x7fffffffProcessor-specific range end
LOSTART = 0xff00Reserved value
HIEND = 0xffffReserved value
enumSectionFlags : ulong

ELF section header flags.

These flags can be bitwise OR'd together.

NONE = 0x0Unused
WRITE = 0x1Writable
ALLOC = 0x2Occupies memory during execution
EXECINSTR = 0x4Executable
MERGE = 0x10Might be merged
STRINGS = 0x20Contains nul-terminated strings
INFO_LINK = 0x40`sh_info' holds SHT index
LINK_ORDER = 0x80Preserve order for combining sections
OS_NONCONFORMING = 0x100Non-standard OS specific handling required
GROUP = 0x200Section is member of a group
TLS = 0x400Section holds thread-local storage
MASKOS = 0x0ff00000OS-specific (mask is for ELF32; ELF64 uses a wider range)
MASKPROC = 0xf0000000Processor-specific (mask is for ELF32; ELF64 uses a wider range)
enumSegmentType : uint

ELF program header types (segment types).

NULL = 0Unused entry
LOAD = 1Loadable segment
DYNAMIC = 2Dynamic linking information
INTERP = 3Interpreter program path
NOTE = 4Auxiliary information
SHLIB = 5Reserved
PHDR = 6Segment containing program header table
TLS = 7Thread-local storage template
LOPROC = 0x70000000Processor-specific range start
HIPROC = 0x7fffffffProcessor-specific range end
LOOS = 0x60000000OS-specific range start
HIOS = 0x6fffffffOS-specific range end
enumSegmentFlags : uint

ELF program header segment flags.

These flags can be bitwise OR'd together.

X = 0x1Segment is executable
W = 0x2Segment is writable
R = 0x4Segment is readable
NONE = 0x0Unused flag
MASKOS = 0x0ff00000OS-specific
MASKPROC = 0xf0000000Processor-specific
enumSymbolBinding : ubyte

ELF symbol binding.

The binding is encoded in the st_info field as the upper 4 bits.

LOCAL = 0Local symbol
GLOBAL = 1Global symbol
WEAK = 2Weak symbol
NUM = 3Number of defined types.
LOOS = 10Start of OS-specific
UNIQUE = 10Unique symbol
HIOS = 12End of OS-specific
LOPROC = 13Start of processor-specific
HIPROC = 15End of processor-specific
enumSymbolType : ubyte

ELF symbol types.

The type is encoded in the st_info field as the lower 4 bits.

NOTYPE = 0No type specified
OBJECT = 1Object (variable, array, etc.)
FUNC = 2Function
SECTION = 3Section
FILE = 4File name
COMMON = 5Common object
TLS = 6Thread-local data object
NUM = 7Number of defined types
LOOS = 10Start of OS-specific
HIOS = 12End of OS-specific
LOPROC = 13Start of processor-specific
HIPROC = 15End of processor-specific
enumSymbolVisibility : ubyte

ELF symbol visibility.

Visibility is encoded in the st_other field.

DEFAULT = 0Default visibility
HIDDEN = 1Hidden
PROTECTED = 2Protected
INTERNAL = 3Internal
enumSpecialSectionIndex : ushort

Special section indices.

UNDEF = 0Undefined section index
ABS = 0xfff1Absolute symbol value
COMMON = 0xfff2Common symbol
LOPROC = 0xff00Start of processor-specific
HIPROC = 0xff1fEnd of processor-specific
LOOS = 0xff20Start of OS-specific
HIRESERVE = 0xff3fEnd of OS-specific
enumDynamicTag : uint

ELF dynamic array tags.

NULL = 0End of dynamic array
NEEDED = 1Name of needed library
PLTRELSZ = 2Size in bytes of PLT entries
PLTGOT = 3Processor-dependent value
HASH = 4Address of symbol hash table
STRTAB = 5Address of string table
SYMTAB = 6Address of symbol table
RELA = 7Address of Rela relocation entries
RELASZ = 8Total size of Rela entries
RELAENT = 9Size of one Rela entry
STRSZ = 10Size of string table
SYMENT = 11Size of one symbol table entry
INIT = 12Address of initialization function
FINI = 13Address of termination function
SONAME = 14Name of shared object
RPATH = 15Library search path (deprecated)
SYMBOLIC = 16Start of symbol search range
REL = 17Address of Rel entries
RELSZ = 18Total size of Rel entries
RELENT = 19Size of one Rel entry
PLTREL = 20Type of relocation table entries
DEBUG = 21Debugging (unused)
TEXTREL = 22Relocation may modify text
JMPREL = 23Address of jump table
BIND_NOW = 24Process-dependent
INIT_ARRAY = 25Array with addresses of init functions
FINI_ARRAY = 26Array with addresses of fini functions
INIT_ARRAYSZ = 27Size of INIT_ARRAY
FINI_ARRAYSZ = 28Size of FINI_ARRAY
RUNPATH = 29Run-time search path
FLAGS = 30Flags for dynamic loading
PREINIT_ARRAY = 32Pre-link library identifier
PREINIT_ARRAYSZ = 33Array with addresses of preinit functions
MAXPOSTAGS = 34Maximum DT_* tag
GNU_HASH = 0x6ffffef5GNU hash table
GNU_VERSYM = 0x6ffffff0GNU version symbol table
GNU_VERNEED = 0x6ffffffeGNU version requirements
GNU_VERNEEDNUM = 0x6fffffffGNU version requirements count
GNU_VERDEF = 0x6ffffffdGNU version definitions
GNU_VERDEFNUM = 0x6ffffffcGNU version definitions count
GNU_FILTER = 0x6ffffffaShared object filter
GNU_AUXV = 0x6ffffffbAuxiliary vector
GNU_PRELINKED = 0x6ffffdf5GNU prelink timestamp
GNU_CONFLICT = 0x6ffffef6GNU conflict relocations
SUNW_CHECKSUM = 0x6ffffef8Checksum of DYN contents
GNU_PLTREL = 0x6ffffef9PLT relocation type
GNU_CONFLICTSZ = 0x6ffffefaGNU conflict relocation size
GNU_LIBLIST = 0x6ffffefbGNU library list
LOOS = 0x6000000dOS-specific range start
HIOS = 0x6ffff000OS-specific range end
LOPROC = 0x70000000Processor-specific range start
HIPROC = 0x7fffffffProcessor-specific range end

Functions 19

fnubyte[4] elfMagic() pure nothrow @nogc @safeGet the ELF magic number as a byte array.
fnbool isElfMagic(const(ubyte)[] data) pure nothrow @nogc @safeCheck if data starts with ELF magic number.
fnubyte makeStInfo(SymbolBinding binding, SymbolType type) pure nothrow @nogc @safeEncode symbol binding and type into st_info field.
fnSymbolBinding getStBinding(ubyte info) pure nothrow @nogc @safeExtract symbol binding from st_info field.
fnSymbolType getStType(ubyte info) pure nothrow @nogc @safeExtract symbol type from st_info field.
fnubyte makeStOther(SymbolVisibility visibility) pure nothrow @nogc @safeEncode symbol visibility into st_other field.
fnSymbolVisibility getStVisibility(ubyte other) pure nothrow @nogc @safeExtract symbol visibility from st_other field.
fnbool isOsSpecificSection(SectionType type) pure nothrow @nogc @safeCheck if a section type is a valid OS-specific value.
fnbool isProcSpecificSection(SectionType type) pure nothrow @nogc @safeCheck if a section type is a valid processor-specific value.
fnbool isOsSpecificSegment(SegmentType type) pure nothrow @nogc @safeCheck if a segment type is a valid OS-specific value.
fnbool isProcSpecificSegment(SegmentType type) pure nothrow @nogc @safeCheck if a segment type is a valid processor-specific value.
fnbool isValidSymbolBinding(SymbolBinding binding) pure nothrow @nogc @safeCheck if a symbol binding is valid.
fnbool isValidSymbolType(SymbolType type) pure nothrow @nogc @safeCheck if a symbol type is valid.
fnbool isValidDynamicTag(DynamicTag tag) pure nothrow @nogc @safeCheck if a dynamic tag is valid.
fnstring getMachineName(ElfMachine machine) pure @safeGet the name of an ELF machine architecture.
fnstring getSectionTypeName(SectionType type) pure @safeGet the name of an ELF section type.
fnstring getSegmentTypeName(SegmentType type) pure @safeGet the name of an ELF segment type.
fnstring getElfTypeName(ElfType type) pure @safeGet the name of an ELF file type.
fnstring getElfClassName(ElfClass class_) pure @safeGet the name of an ELF class.

Variables 15

enumvarEI_MAG0 = 0

ELF identification array indices.

These indices correspond to positions in the e_ident array of the ELF header. File identification byte 0 (0x7F)

enumvarEI_MAG1 = 1

File identification byte 1 ('E')

enumvarEI_MAG2 = 2

File identification byte 2 ('L')

enumvarEI_MAG3 = 3

File identification byte 3 ('F')

enumvarEI_CLASS = 4

File class (32-bit or 64-bit)

enumvarEI_DATA = 5

Data encoding (little or big endian)

enumvarEI_VERSION = 6

File version

enumvarEI_OSABI = 7

Operating system/ABI identification

enumvarEI_ABIVERSION = 8

ABI version

enumvarEI_PAD = 9

Start of padding bytes

enumvarEI_NIDENT = 16

Size of e_ident array

enumvarELFMAG0 = 0x7f

ELF magic number bytes.

These form the string "\x7fELF" which identifies an ELF file. Magic byte 0

enumvarELFMAG1 = 'E'

Magic byte 1

enumvarELFMAG2 = 'L'

Magic byte 2

enumvarELFMAG3 = 'F'

Magic byte 3