ddn.elf.segments
ELF program header (segment) handling functionality.
This module provides utilities for reading and manipulating ELF program headers (segments). Segments contain information about how the program is loaded into memory.
Types 4
Represents an ELF segment (program header).
This struct provides lazy access to segment information.
gelf.ProgramHeader getHeader()Get the program header for this segment.types.SegmentType getType()Get the segment type.types.SegmentFlags getFlags()Get the segment flags.const(ubyte)[] getData()Get the segment data from the file.ulong getFileOffset()Get the segment's file offset.ulong getVirtualAddress()Get the segment's virtual address.ulong getPhysicalAddress()Get the segment's physical address.ulong getFileSize()Get the segment's size in the file.ulong getMemorySize()Get the segment's size in memory.ulong getAlignment()Get the segment's alignment.bool isLoadable()Check if this segment is loadable (PT_LOAD).bool isDynamic()Check if this segment contains dynamic linking information.bool isInterpreter()Check if this segment contains the interpreter path.bool isReadable()Check if this segment is readable.bool isWritable()Check if this segment is writable.bool isExecutable()Check if this segment is executable.Forward range for iterating over segments of a specific type.
Implements the D InputRange and ForwardRange interfaces, providing lazy access to ElfSegment instances.
ElfSegment front()Get the current segment.void popFront()Advances to the next segment of the target type.typeof(this) save()Saves the current state of the range.this(types.SegmentType type, gelf.ProgramHeader[] headers,
size_t[] originalIndices, size_t currentIndex, ElfFile file)Constructor for creating a saved copy of the range.this(ElfFile file, types.SegmentType type)Constructor for creating a range that filters segments by type.Forward range for iterating over all segments in an ELF file.
Implements the D InputRange and ForwardRange interfaces, providing lazy access to ElfSegment instances.
typeof(this) save()Save the current state of the range.ElfSegment front()Get the current segment.void popFront()Advance to the next segment.Builder for creating ELF program headers (segments).
This struct allows incremental construction of a program header table.
size_t addSegment(types.SegmentType type, types.SegmentFlags flags,
ulong offset, ulong vaddr, ulong paddr,
ulong fileSize, ulong memSize, ulong alignment)Add a segment to the program header table.gelf.ProgramHeader getSegment(size_t index)Get a segment by index.ubyte[] build(types.ElfClass cls = types.ElfClass.CLASS64,
io.ElfEndian endian = io.ElfEndian.LITTLE)Build the final program header table byte array.size_t entrySize(types.ElfClass cls = types.ElfClass.CLASS64) const pure nothrow @nogc @safeGet the size of a program header entry for the given class.void clear()Clear all segments from the builder.this(gelf.ProgramHeader[] segments)Private constructor with segment array.Functions 6
SegmentTypeRange getSegmentsByType(ElfFile file, types.SegmentType type)Get a range for iterating over segments of a specific type.SegmentTypeRange getLoadableSegments(ElfFile file)Get a range for iterating over loadable segments (PT_LOAD).SegmentTypeRange getSegmentsContainingSection(ElfFile file, ElfSection section)Get segments that fully contain a specific section.