Skip to main content

RawElf

Enum RawElf 

Source
pub enum RawElf<D>
where D: 'static,
{ Dylib(RawDylib<D>), Exec(RawExec<D>), Object(RawObject<D>), }
Expand description

A mapped but unrelocated ELF image.

This enum represents an ELF file that has been loaded into memory (mapped) but has not yet undergone the relocation process. It can be a dynamic library, an executable, or a relocatable object file.

Variants§

§

Dylib(RawDylib<D>)

A dynamic library (shared object, typically .so).

§

Exec(RawExec<D>)

An executable file (typically a PIE or non-PIE executable).

§

Object(RawObject<D>)

A relocatable object file (typically .o).

Implementations§

Source§

impl<D: 'static> RawElf<D>

Source

pub fn relocator(self) -> Relocator<Self, (), (), (), (), (), D>

Creates a builder for relocating the ELF file.

§Examples
use elf_loader::{Loader, input::ElfBinary};

let mut loader = Loader::new();
let bytes = &[]; // ELF file bytes
let lib = loader.load_dylib(ElfBinary::new("liba.so", bytes)).unwrap();

let relocated = lib.relocator()
    .lazy(true)
    .relocate()
    .unwrap();
Source

pub fn name(&self) -> &str

Gets the name of the ELF file

Source

pub fn mapped_len(&self) -> usize

Gets the total length of mapped memory for the ELF file

Trait Implementations§

Source§

impl<D> Debug for RawElf<D>
where D: 'static + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<D> Freeze for RawElf<D>

§

impl<D> !RefUnwindSafe for RawElf<D>

§

impl<D> !Send for RawElf<D>

§

impl<D> !Sync for RawElf<D>

§

impl<D> Unpin for RawElf<D>

§

impl<D> !UnwindSafe for RawElf<D>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.