Trait dynasmrt::relocations::Relocation[][src]

pub trait Relocation {
    type Encoding;
    fn from_encoding(encoding: Self::Encoding) -> Self;
fn from_size(size: RelocationSize) -> Self;
fn size(&self) -> usize;
fn write_value(
        &self,
        buf: &mut [u8],
        value: isize
    ) -> Result<(), ImpossibleRelocation>;
fn read_value(&self, buf: &[u8]) -> isize;
fn kind(&self) -> RelocationKind;
fn page_size() -> usize; }
Expand description

Used to inform assemblers on how to implement relocations for each architecture. When implementing a new architecture, one simply has to implement this trait for the architecture’s relocation definition.

Associated Types

The encoded representation for this relocation that is emitted by the dynasm! macro.

Required methods

construct this relocation from an encoded representation.

construct this relocation from a simple size. This is used to implement relocations in directives and literal pools.

The size of the slice of bytes affected by this relocation

Write a value into a buffer of size self.size() in the format of this relocation. Any bits not part of the relocation should be preserved.

Read a value from a buffer of size self.size() in the format of this relocation.

Specifies what kind of relocation this relocation instance is.

Specifies the default page size on this platform.

Implementors