[go: up one dir, main page]

Struct elf::file::File

source ·
pub struct File<R: ReadBytesAt> {
    pub ehdr: FileHeader,
    /* private fields */
}

Fields

ehdr: FileHeader

Implementations

Get an lazy-parsing table for the Segments (ELF Program Headers) in the file.

The underlying ELF bytes backing the program headers table are read all at once when the table is requested, but parsing is deferred to be lazily parsed on demand on each table.get() call or table.iter().next() call.

Returns a ParseError if the data bytes for the segment table cannot be read i.e. if the ELF FileHeader’s e_phnum, e_phoff, e_phentsize are invalid and point to a range in the file data that does not actually exist.

Get an lazy-parsing table for the Section Headers in the file.

The underlying ELF bytes backing the section headers table are read all at once when the table is requested, but parsing is deferred to be lazily parsed on demand on each table.get() call or table.iter().next() call.

Returns a ParseError if the data bytes for the section table cannot be read i.e. if the ELF FileHeader’s e_shnum, e_shoff, e_shentsize are invalid and point to a range in the file data that does not actually exist.

Get an lazy-parsing table for the Section Headers in the file and its associated StringTable.

The underlying ELF bytes backing the section headers table and string table are read all at once when the table is requested, but parsing is deferred to be lazily parsed on demand on each table.get(), strtab.get(), or table.iter().next() call.

Returns a ParseError if the data bytes for these tables cannot be read i.e. if the ELF FileHeader’s e_shnum, e_shoff, e_shentsize, e_shstrndx are invalid and point to a ranges in the file data that does not actually exist.

Read the section data for the given SectionHeader. Returns both the secion data and an optional CompressionHeader.

No compression header signals that the section contents are uncompressed and can be used as-is.

Some(chdr) signals that the section contents are compressed and need to be uncompressed via the compression algorithm described in ch_type. The returned buffer represents the compressed section bytes as found in the file, without the CompressionHeader.

It is up to the user to perform the decompression themselves with the compression library of their choosing.

SHT_NOBITS sections yield an empty slice.

Read the section data for the given SectionHeader and interpret it in-place as a StringTable.

Returns a ParseError if the sh_type is not SHT_STRTAB.

Get the symbol table (section of type SHT_SYMTAB) and its associated string table.

The GABI specifies that ELF object files may have zero or one sections of type SHT_SYMTAB.

Get the dynamic symbol table (section of type SHT_DYNSYM) and its associated string table.

The GABI specifies that ELF object files may have zero or one sections of type SHT_DYNSYM.

Get the .dynamic section/segment contents.

Read the section data for the various GNU Symbol Versioning sections (if any) and return them in a SymbolVersionTable that which can interpret them in-place to yield SymbolRequirements and SymbolDefinitions

This is a GNU extension and not all objects use symbol versioning. Returns an empty Option if the object does not use symbol versioning.

Read the section data for the given SectionHeader and interpret it in-place as a RelIterator.

Returns a ParseError if the sh_type is not SHT_REL.

Read the section data for the given SectionHeader and interpret it in-place as a RelaIterator.

Returns a ParseError if the sh_type is not SHT_RELA.

Read the section data for the given SectionHeader and interpret it in-place as a NoteIterator.

Returns a ParseError if the sh_type is not SHT_RELA.

Read the segment data for the given Segment and interpret it in-place as a NoteIterator.

Returns a ParseError if the p_type is not PT_RELA.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.