pub struct Elf<'a> {
pub header: ELFHeader,
pub file: &'a RegularFile,
}Expand description
Represents an ELF file in memory.
This struct provides access to ELF metadata and program headers.
Fields§
§header: ELFHeaderA parsed ELF header
file: &'a RegularFileReference to the backing file containing ELF data.
Implementations§
Source§impl<'a, 'b> Elf<'a>
impl<'a, 'b> Elf<'a>
Sourcepub fn from_file(file: &'a RegularFile) -> Option<Self>
pub fn from_file(file: &'a RegularFile) -> Option<Self>
Attempts to create an Elf object from a RegularFile.
Returns Some(Elf) if the file is a valid ELF binary, otherwise None.
§Validity Checks
- Must have the correct ELF magic bytes (
0x7F ELF). - Must be little-endian (
Endian::Little). - Must be 64-bit (
Bit::Bit64). - Must target the x86-64 architecture (
EMachine::Amd64).
Sourcepub fn phdrs(&'b self) -> Result<PhdrIterator<'a, 'b>, KernelError>
pub fn phdrs(&'b self) -> Result<PhdrIterator<'a, 'b>, KernelError>
Returns an iterator over the program headers.