ddn.elf.elf32

ELF32 data structures.

This module provides all ELF32-specific data structures as defined by the ELF specification. All structures are packed with align(1) to ensure proper binary layout.

Types 16

ELF32 file header.

The ELF file header appears at the beginning of every ELF file and describes the file's organization. It has a fixed size of 52 bytes.

Fields
ubyte[EI_NIDENT] e_identELF identification bytes
ushort e_typeObject file type (ElfType)
ushort e_machineArchitecture (ElfMachine)
uint e_versionObject file version (ElfVersion)
uint e_entryEntry point virtual address
uint e_phoffProgram header table file offset
uint e_shoffSection header table file offset
uint e_flagsProcessor-specific flags
ushort e_ehsizeELF header size in bytes
ushort e_phentsizeProgram header table entry size
ushort e_phnumProgram header table entry count
ushort e_shentsizeSection header table entry size
ushort e_shnumSection header table entry count
ushort e_shstrndxSection header string table index
Methods
ElfClass getClass() pure nothrow @nogc @safe constGet the ELF class from the identification bytes.
ElfData getDataEncoding() pure nothrow @nogc @safe constGet the data encoding from the identification bytes.
ElfVersion getVersion() pure nothrow @nogc @safe constGet the ELF version from the identification bytes.
ElfOsAbi getOsAbi() pure nothrow @nogc @safe constGet the OS/ABI from the identification bytes.
ubyte getAbiVersion() pure nothrow @nogc @safe constGet the ABI version from the identification bytes.
ElfType getType() pure nothrow @nogc @safe constGet the object file type.
ElfMachine getMachine() pure nothrow @nogc @safe constGet the machine architecture.
bool is64Bit() pure nothrow @nogc @safe constCheck if this is a 64-bit ELF header.

Alias for backward compatibility.

ELF32 section header.

Each section in an ELF file has a section header that describes the section. Section headers have a fixed size of 40 bytes.

Fields
uint sh_nameSection name (string table index)
uint sh_typeSection type (SectionType)
uint sh_flagsSection flags (SectionFlags)
uint sh_addrSection virtual address at execution
uint sh_offsetSection file offset
uint sh_sizeSection size in bytes
uint sh_linkLink to another section
uint sh_infoAdditional section information
uint sh_addralignSection alignment
uint sh_entsizeEntry size if section holds table
Methods
SectionType getType() pure nothrow @nogc @safe constGet the section type.
SectionFlags getFlags() pure nothrow @nogc @safe constGet the section flags.
bool isAllocatable() pure nothrow @nogc @safe constCheck if this section is allocatable (loaded into memory).
bool isWritable() pure nothrow @nogc @safe constCheck if this section is writable.
bool isExecutable() pure nothrow @nogc @safe constCheck if this section is executable.
bool isNoBits() pure nothrow @nogc @safe constCheck if this section has no file space (NOBITS).

Alias for backward compatibility.

ELF32 program header (segment header).

Each segment in an ELF file has a program header that describes the segment. Program headers have a fixed size of 32 bytes.

Fields
uint p_typeSegment type (SegmentType)
uint p_offsetSegment file offset
uint p_vaddrSegment virtual address
uint p_paddrSegment physical address
uint p_fileszSegment size in file
uint p_memszSegment size in memory
uint p_flagsSegment flags (SegmentFlags)
uint p_alignSegment alignment
Methods
SegmentType getType() pure nothrow @nogc @safe constGet the segment type.
SegmentFlags getFlags() pure nothrow @nogc @safe constGet the segment flags.
bool isReadable() pure nothrow @nogc @safe constCheck if this segment is readable.
bool isWritable() pure nothrow @nogc @safe constCheck if this segment is writable.
bool isExecutable() pure nothrow @nogc @safe constCheck if this segment is executable.
bool isLoadable() pure nothrow @nogc @safe constCheck if this is a loadable segment.
bool isDynamic() pure nothrow @nogc @safe constCheck if this is a dynamic segment.
bool isInterp() pure nothrow @nogc @safe constCheck if this is an interpreter segment.

Alias for backward compatibility.

ELF32 symbol table entry.

Symbol table entries describe symbols in the file. Each entry has a fixed size of 16 bytes.

Fields
uint st_nameSymbol name (string table index)
uint st_valueSymbol value (address or offset)
uint st_sizeSymbol size
ubyte st_infoSymbol type and binding info (st_info)
ubyte st_otherSymbol visibility (st_other)
ushort st_shndxSection index
Methods
SymbolBinding getBinding() pure nothrow @nogc @safe constExtract symbol binding from st_info field.
SymbolType getType() pure nothrow @nogc @safe constExtract symbol type from st_info field.
SymbolVisibility getVisibility() pure nothrow @nogc @safe constExtract symbol visibility from st_other field.
bool isLocal() pure nothrow @nogc @safe constCheck if this is a local symbol.
bool isGlobal() pure nothrow @nogc @safe constCheck if this is a global symbol.
bool isWeak() pure nothrow @nogc @safe constCheck if this is a weak symbol.
bool isFunction() pure nothrow @nogc @safe constCheck if this is a function symbol.
bool isObject() pure nothrow @nogc @safe constCheck if this is an object symbol.
bool isSection() pure nothrow @nogc @safe constCheck if this is a section symbol.
bool isFile() pure nothrow @nogc @safe constCheck if this is a file symbol.
bool isDefined() pure nothrow @nogc @safe constCheck if this symbol is defined.
bool isCommon() pure nothrow @nogc @safe constCheck if this is a common symbol.
bool isAbsolute() pure nothrow @nogc @safe constCheck if this is an absolute symbol.

Alias for backward compatibility.

ELF32 relocation entry without addend.

Relocations describe how to modify an address or offset in the file. Rel entries have a fixed size of 8 bytes.

Fields
uint r_offsetLocation where to apply relocation
uint r_infoRelocation type and symbol index
Methods
uint getSymbolIndex() pure nothrow @nogc @safe constExtract symbol index from r_info field.
ubyte getType() pure nothrow @nogc @safe constExtract relocation type from r_info field.
uint getInfo() pure nothrow @nogc @safe constGet the raw relocation info value.

Alias for backward compatibility.

ELF32 relocation entry with addend.

Relocations describe how to modify an address or offset in the file. Rela entries include an explicit addend. They have a fixed size of 12 bytes.

Fields
uint r_offsetLocation where to apply relocation
uint r_infoRelocation type and symbol index
int r_addendAddend
Methods
uint getSymbolIndex() pure nothrow @nogc @safe constExtract symbol index from r_info field.
ubyte getType() pure nothrow @nogc @safe constExtract relocation type from r_info field.
uint getInfo() pure nothrow @nogc @safe constGet the raw relocation info value.
int getAddend() pure nothrow @nogc @safe constGet the addend value.

Alias for backward compatibility.

ELF32 dynamic array entry.

Dynamic array entries describe dynamic linking information. Each entry has a fixed size of 8 bytes.

Fields
uint d_tagDynamic entry type (DynamicTag)
Methods
DynamicTag getTag() pure nothrow @nogc @safe constGet the dynamic tag.
uint getValue() pure nothrow @nogc @safe constGet the integer value.
uint getPointer() pure nothrow @nogc @safe constGet the pointer value.

Alias for backward compatibility.

ELF32 note header.

Note headers describe note sections which contain arbitrary information.

Fields
uint n_nameszNote name size
uint n_descszNote descriptor size
uint n_typeNote type
Methods
uint getNameSize() pure nothrow @nogc @safe constGet the note name size.
uint getDescSize() pure nothrow @nogc @safe constGet the note descriptor size.
uint getType() pure nothrow @nogc @safe constGet the note type.

Alias for backward compatibility.