pub struct ElfBinary<'s> {
pub file: ElfFile<'s>,
pub dynamic: Option<DynamicInfo>,
}
Expand description
Abstract representation of a loadable ELF binary.
Fields
file: ElfFile<'s>
The ELF file in question.
dynamic: Option<DynamicInfo>
Parsed information from the .dynamic section (if the binary has it).
Implementations
sourceimpl<'s> ElfBinary<'s>
impl<'s> ElfBinary<'s>
sourcepub fn is_pie(&self) -> bool
pub fn is_pie(&self) -> bool
Returns true if the binary is compiled as position independent code or false otherwise.
For the binary to be PIE it needs to have a .dynamic section with PIE set in the flags1 field.
sourcepub fn interpreter(&'s self) -> Option<&'s str>
pub fn interpreter(&'s self) -> Option<&'s str>
Returns the dynamic loader if present.
readelf -x .interp
For a statically compiled binary this will return None
sourcepub fn entry_point(&self) -> u64
pub fn entry_point(&self) -> u64
Return the entry point of the ELF file.
Note this may be zero in case of position independent executables.
sourcepub fn program_headers(&self) -> ProgramIter<'_, '_>
pub fn program_headers(&self) -> ProgramIter<'_, '_>
Create a slice of the program headers.
sourcepub fn symbol_name(&self, symbol: &'s dyn Entry) -> &'s str
pub fn symbol_name(&self, symbol: &'s dyn Entry) -> &'s str
Get the name of the sectione
sourcepub fn for_each_symbol<F: FnMut(&'s dyn Entry)>(
&self,
func: F
) -> Result<(), ElfLoaderErr>
pub fn for_each_symbol<F: FnMut(&'s dyn Entry)>(
&self,
func: F
) -> Result<(), ElfLoaderErr>
Enumerate all the symbols in the file
Trait Implementations
Auto Trait Implementations
impl<'s> RefUnwindSafe for ElfBinary<'s>
impl<'s> Send for ElfBinary<'s>
impl<'s> Sync for ElfBinary<'s>
impl<'s> Unpin for ElfBinary<'s>
impl<'s> UnwindSafe for ElfBinary<'s>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more