ddn.elf.gelf
GELF (Generic ELF) abstraction layer.
This module provides a unified interface for both ELF32 and ELF64 formats. GELF structures use 64-bit fields to accommodate both formats, following the pattern established by libelf's gelf_* functions.
Types 14
Generic ELF file header.
Uses 64-bit fields to accommodate both ELF32 and ELF64.
ubyte[EI_NIDENT] e_identELF identification bytesushort e_typeObject file type (ElfType)ushort e_machineArchitecture (ElfMachine)uint e_versionObject file version (ElfVersion)ulong e_entryEntry point virtual address (64-bit)ulong e_phoffProgram header table file offset (64-bit)ulong e_shoffSection header table file offset (64-bit)uint e_flagsProcessor-specific flagsushort e_ehsizeELF header size in bytesushort e_phentsizeProgram header table entry sizeushort e_phnumProgram header table entry countushort e_shentsizeSection header table entry sizeushort e_shnumSection header table entry countushort e_shstrndxSection header string table indexElfData getDataEncoding() pure nothrow @nogc @safe constGet the data encoding from identification bytes.void setDataEncoding(ElfData data) pure nothrow @nogc @safeSet the data encoding in identification bytes.ElfVersion getVersion() pure nothrow @nogc @safe constGet the ELF version from identification bytes.Alias for backward compatibility.
Generic ELF section header.
Uses 64-bit fields to accommodate both ELF32 and ELF64.
uint sh_nameSection name (string table index)uint sh_typeSection type (SectionType)ulong sh_flagsSection flags (SectionFlags, 64-bit)ulong sh_addrSection virtual address at execution (64-bit)ulong sh_offsetSection file offset (64-bit)ulong sh_sizeSection size in bytes (64-bit)uint sh_linkLink to another sectionuint sh_infoAdditional section informationulong sh_addralignSection alignment (64-bit)ulong sh_entsizeEntry size if section holds table (64-bit)Alias for backward compatibility.
Generic ELF program header.
Uses 64-bit fields to accommodate both ELF32 and ELF64.
Note
uint p_typeSegment type (SegmentType)uint p_flagsSegment flags (SegmentFlags)ulong p_offsetSegment file offset (64-bit)ulong p_vaddrSegment virtual address (64-bit)ulong p_paddrSegment physical address (64-bit)ulong p_fileszSegment size in file (64-bit)ulong p_memszSegment size in memory (64-bit)ulong p_alignSegment alignment (64-bit)Alias for backward compatibility.
Generic ELF symbol table entry.
Uses 64-bit fields to accommodate both ELF32 and ELF64.
Note
uint st_nameSymbol name (string table index)ubyte st_infoSymbol info (st_info)ubyte st_otherSymbol visibility (st_other)ushort st_shndxSection indexulong st_valueSymbol value/address (64-bit)ulong st_sizeSymbol size (64-bit)SymbolVisibility getVisibility() pure nothrow @nogc @safe constExtract symbol visibility from st_other field.void setVisibility(SymbolVisibility visibility) pure nothrow @nogc @safeSet symbol visibility in st_other field.Alias for backward compatibility.
Generic ELF relocation entry without addend.
Uses 64-bit fields to accommodate both ELF32 and ELF64.
ulong r_offsetLocation where to apply relocation (64-bit)ulong r_infoRelocation type and symbol index (64-bit)Alias for backward compatibility.
Generic ELF relocation entry with addend.
Uses 64-bit fields to accommodate both ELF32 and ELF64.
ulong r_offsetLocation where to apply relocation (64-bit)ulong r_infoRelocation type and symbol index (64-bit)long r_addendAddend (64-bit)Alias for backward compatibility.
Generic ELF dynamic array entry.
Uses 64-bit fields to accommodate both ELF32 and ELF64.
long d_tagDynamic entry type (DynamicTag) — 64-bit to hold both ELF32 and ELF64 valuesAlias for backward compatibility.
Functions 28
FileHeader toGelf(ref const elf32.FileHeader ehdr32) pure @safeConvert ELF32 file header to GELF file header.FileHeader toGelf(ref const elf64.FileHeader ehdr64) pure @safeConvert ELF64 file header to GELF file header.SectionHeader toGelf(ref const elf32.SectionHeader shdr32) pure @safeConvert ELF32 section header to GELF section header.SectionHeader toGelf(ref const elf64.SectionHeader shdr64) pure @safeConvert ELF64 section header to GELF section header.ProgramHeader toGelf(ref const elf32.ProgramHeader phdr32) pure @safeConvert ELF32 program header to GELF program header.ProgramHeader toGelf(ref const elf64.ProgramHeader phdr64) pure @safeConvert ELF64 program header to GELF program header.SymbolTableEntry toGelf(ref const elf32.SymbolTableEntry sym32) pure @safeConvert ELF32 symbol to GELF symbol.SymbolTableEntry toGelf(ref const elf64.SymbolTableEntry sym64) pure @safeConvert ELF64 symbol to GELF symbol.Relocation toGelf(ref const elf32.Relocation rel32) pure @safeConvert ELF32 relocation to GELF relocation.Relocation toGelf(ref const elf64.Relocation rel64) pure @safeConvert ELF64 relocation to GELF relocation.RelocationWithAddend toGelf(ref const elf32.RelocationWithAddend rela32) pure @safeConvert ELF32 relocation with addend to GELF relocation with addend.RelocationWithAddend toGelf(ref const elf64.RelocationWithAddend rela64) pure @safeConvert ELF64 relocation with addend to GELF relocation with addend.DynamicEntry toGelf(ref const elf32.DynamicEntry dyn32) pure @safeConvert ELF32 dynamic entry to GELF dynamic entry.DynamicEntry toGelf(ref const elf64.DynamicEntry dyn64) pure @safeConvert ELF64 dynamic entry to GELF dynamic entry.elf32.FileHeader toElf32(ref const FileHeader ghdr) pure @safeConvert GELF file header to ELF32 file header.elf32.SectionHeader toElf32(ref const SectionHeader gshdr) pure @safeConvert GELF section header to ELF32 section header.elf32.ProgramHeader toElf32(ref const ProgramHeader gphdr) pure @safeConvert GELF program header to ELF32 program header.elf32.SymbolTableEntry toElf32(ref const SymbolTableEntry gsym) pure @safeConvert GELF symbol to ELF32 symbol.elf32.Relocation toElf32(ref const Relocation grel) pure @safeConvert GELF relocation to ELF32 relocation.elf32.RelocationWithAddend toElf32(ref const RelocationWithAddend grela) pure @safeConvert GELF relocation with addend to ELF32 relocation with addend.elf32.DynamicEntry toElf32(ref const DynamicEntry gdyn) pure @safeConvert GELF dynamic entry to ELF32 dynamic entry.elf64.FileHeader toElf64(ref const FileHeader ghdr) pure @safeConvert GELF file header to ELF64 file header.elf64.SectionHeader toElf64(ref const SectionHeader gshdr) pure @safeConvert GELF section header to ELF64 section header.elf64.ProgramHeader toElf64(ref const ProgramHeader gphdr) pure @safeConvert GELF program header to ELF64 program header.elf64.SymbolTableEntry toElf64(ref const SymbolTableEntry gsym) pure @safeConvert GELF symbol to ELF64 symbol.elf64.Relocation toElf64(ref const Relocation grel) pure @safeConvert GELF relocation to ELF64 relocation.elf64.RelocationWithAddend toElf64(ref const RelocationWithAddend grela) pure @safeConvert GELF relocation with addend to ELF64 relocation with addend.elf64.DynamicEntry toElf64(ref const DynamicEntry gdyn) pure @safeConvert GELF dynamic entry to ELF64 dynamic entry.