pub struct ElfLinker { /* private fields */ }Expand description
Loader which links together multiple Elf files.
Can do some rudimentary linking of binaries.
Implementations§
Source§impl ElfLinker
impl ElfLinker
Sourcepub fn new(
filename: PathBuf,
do_relocations: bool,
just_interpreter: bool,
ld_paths: Option<Vec<PathBuf>>,
) -> Result<ElfLinker, Error>
pub fn new( filename: PathBuf, do_relocations: bool, just_interpreter: bool, ld_paths: Option<Vec<PathBuf>>, ) -> Result<ElfLinker, Error>
Create a new ElfLinker.
It is recommended you use ElfLinkerBuilder to build an ElfLinker.
Sourcepub fn load_elf(
&mut self,
filename: &Path,
base_address: u64,
) -> Result<(), Error>
pub fn load_elf( &mut self, filename: &Path, base_address: u64, ) -> Result<(), Error>
Takes the path to an Elf, and a base address the Elf should be loaded at. Loads the Elf, all it’s dependencies (DT_NEEDED), and then handles the supported relocations.
Sourcepub fn get_interpreter(&self) -> Result<Option<&Elf>, Error>
pub fn get_interpreter(&self) -> Result<Option<&Elf>, Error>
If the primary Elf we’re loading has an interpreter designated in its
dynamic sectino, get the Elf for the interpreter.
Sourcepub fn add_user_function(&mut self, address: u64)
pub fn add_user_function(&mut self, address: u64)
Inform the linker of a function at the given address.
This function will be added to calls to function_entries and will be automatically
lifted when calling to_program.
Trait Implementations§
Source§impl Loader for ElfLinker
impl Loader for ElfLinker
Source§fn function_entries(&self) -> Result<Vec<FunctionEntry>, Error>
fn function_entries(&self) -> Result<Vec<FunctionEntry>, Error>
Get addresses for known function entries
Source§fn program_entry(&self) -> u64
fn program_entry(&self) -> u64
The address program execution should begin at
Source§fn architecture(&self) -> &dyn Architecture
fn architecture(&self) -> &dyn Architecture
Get the architecture of the binary
Source§fn function(&self, address: u64) -> Result<Function, Error>
fn function(&self, address: u64) -> Result<Function, Error>
Lift just one function from the executable
Source§fn function_extended(
&self,
address: u64,
options: &Options,
) -> Result<Function, Error>
fn function_extended( &self, address: u64, options: &Options, ) -> Result<Function, Error>
Lift just one function from the executable, while also supplying
translator options.
Source§fn program_verbose(
&self,
options: &Options,
) -> Result<(Program, Vec<(FunctionEntry, Error)>), Error>
fn program_verbose( &self, options: &Options, ) -> Result<(Program, Vec<(FunctionEntry, Error)>), Error>
Lift executable into an
il::Program. Read moreAuto Trait Implementations§
impl Freeze for ElfLinker
impl !RefUnwindSafe for ElfLinker
impl Send for ElfLinker
impl Sync for ElfLinker
impl Unpin for ElfLinker
impl !UnwindSafe for ElfLinker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more