Struct lief::elf::Relocation

pub struct Relocation<'a> { /* private fields */ }
Expand description

Structure which reprents an ELF relocation

Implementations§

§

impl Relocation<'_>

pub fn addend(&self) -> i64

Additional value that can be involved in the relocation processing

pub fn get_type(&self) -> Type

Type of the relocation

pub fn is_rela(&self) -> bool

Check if the relocation uses the explicit Relocation::addend field (this is usually the case for 64 bits binaries)

pub fn is_rel(&self) -> bool

Check if the relocation uses the implicit addend (i.e. not present in the ELF structure)

pub fn info(&self) -> u32

Relocation info which contains, for instance, the symbol index

pub fn architecture(&self) -> u32

Target architecture for this relocation

pub fn purpose(&self) -> Purpose

The purpose of the relocation

pub fn encoding(&self) -> Encoding

The encoding of the relocation

pub fn symbol(&self) -> Option<Symbol<'_>>

Symbol associated with the relocation (if any)

pub fn section(&self) -> Option<Section<'_>>

The section in which the relocation is applied (if any)

pub fn symbol_table(&self) -> Option<Section<'_>>

The associated symbol table (if any)

pub fn resolve_with_base_address(&self, base_address: u64) -> Result<u64, Error>

Try to resolve the value of the relocation with the provided base address.

The returned value could be used such as: *address = resolve_with_base_address(...)

See: Relocation::resolve

pub fn resolve(&self) -> Result<u64, Error>

Try to resolve the value of the relocation. The returned value could be used such as: *address = resolve(...)

See: Relocation::resolve_with_base_address

Trait Implementations§

§

impl Debug for Relocation<'_>

§

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

Formats the value using the given formatter. Read more
§

impl Relocation for Relocation<'_>

§

fn address(&self) -> u64

Address where the relocation should take place
§

fn size(&self) -> u64

Size of the relocation

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Relocation<'a>

§

impl<'a> !Send for Relocation<'a>

§

impl<'a> !Sync for Relocation<'a>

§

impl<'a> Unpin for Relocation<'a>

§

impl<'a> UnwindSafe for Relocation<'a>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.