ddn.elf.elf64

ELF64 data structures.

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

Types 16

ELF64 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 64 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)
ulong e_entryEntry point virtual address
ulong e_phoffProgram header table file offset
ulong 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.

ELF64 section header.

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

Fields
uint sh_nameSection name (string table index)
uint sh_typeSection type (SectionType)
ulong sh_flagsSection flags (SectionFlags)
ulong sh_addrSection virtual address at execution
ulong sh_offsetSection file offset
ulong sh_sizeSection size in bytes
uint sh_linkLink to another section
uint sh_infoAdditional section information
ulong sh_addralignSection alignment
ulong 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.

ELF64 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 56 bytes.

Note

Field order differs from ELF32 for better alignment.
Fields
uint p_typeSegment type (SegmentType)
uint p_flagsSegment flags (SegmentFlags)
ulong p_offsetSegment file offset
ulong p_vaddrSegment virtual address
ulong p_paddrSegment physical address
ulong p_fileszSegment size in file
ulong p_memszSegment size in memory
ulong 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.

ELF64 symbol table entry.

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

Note

Field order differs from ELF32 for better alignment.
Fields
uint st_nameSymbol name (string table index)
ubyte st_infoSymbol info (st_info)
ubyte st_otherSymbol visibility (st_other)
ushort st_shndxSection index
ulong st_valueSymbol value (address or offset)
ulong st_sizeSymbol size
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.

ELF64 relocation entry without addend.

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

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

Alias for backward compatibility.

ELF64 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 24 bytes.

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

Alias for backward compatibility.

ELF64 dynamic array entry.

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

Fields
long d_tagDynamic entry type (DynamicTag) — Elf64_Sxword in the ELF64 spec
Methods
DynamicTag getTag() pure nothrow @nogc @safe constGet the dynamic tag.
ulong getValue() pure nothrow @nogc @safe constGet the integer value.
ulong getPointer() pure nothrow @nogc @safe constGet the pointer value.

Alias for backward compatibility.

ELF64 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.