Struct RelocationMap

struct RelocationMap(_)

A map from section offsets to relocation information.

This can be used to apply relocations to a value at a given section offset. This is intended for use with DWARF in relocatable object files, and only supports relocations that are used in DWARF.

Returned by ObjectSection::relocation_map.

Implementations

impl RelocationMap

fn new<'data, 'file, T>(file: &'file T, section: &<T as >::Section<'file>) -> Result<Self>
where
    T: Object<'data>

Construct a new relocation map for a section.

Fails if any relocation cannot be added to the map. You can manually use add if you need different error handling, such as to list all errors or to ignore them.

fn add<'data: 'file, 'file, T>(self: &mut Self, file: &'file T, offset: u64, relocation: Relocation) -> Result<()>
where
    T: Object<'data>

Add a single relocation to the map.

fn relocate(self: &Self, offset: u64, value: u64) -> u64

Relocate a value that was read from the section at the given offset.

impl Debug for RelocationMap

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

impl Default for RelocationMap

fn default() -> RelocationMap

impl Freeze for RelocationMap

impl RefUnwindSafe for RelocationMap

impl Send for RelocationMap

impl Sync for RelocationMap

impl Unpin for RelocationMap

impl UnwindSafe for RelocationMap

impl<T> Any for RelocationMap

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for RelocationMap

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for RelocationMap

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

impl<T> From for RelocationMap

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for RelocationMap

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for RelocationMap

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

impl<T, U> TryInto for RelocationMap

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