cranelift_wasm::wasmparser

Enum RelocationType

source
#[repr(u8)]
pub enum RelocationType {
Show 27 variants FunctionIndexLeb = 0, TableIndexSleb = 1, TableIndexI32 = 2, MemoryAddrLeb = 3, MemoryAddrSleb = 4, MemoryAddrI32 = 5, TypeIndexLeb = 6, GlobalIndexLeb = 7, FunctionOffsetI32 = 8, SectionOffsetI32 = 9, EventIndexLeb = 10, MemoryAddrRelSleb = 11, TableIndexRelSleb = 12, GlobalIndexI32 = 13, MemoryAddrLeb64 = 14, MemoryAddrSleb64 = 15, MemoryAddrI64 = 16, MemoryAddrRelSleb64 = 17, TableIndexSleb64 = 18, TableIndexI64 = 19, TableNumberLeb = 20, MemoryAddrTlsSleb = 21, FunctionOffsetI64 = 22, MemoryAddrLocrelI32 = 23, TableIndexRelSleb64 = 24, MemoryAddrTlsSleb64 = 25, FunctionIndexI32 = 26,
}
Expand description

Variants§

§

FunctionIndexLeb = 0

A function index encoded as a 5-byte varuint32. Used for the immediate argument of a call instruction. (since LLVM 10.0)

§

TableIndexSleb = 1

A function table index encoded as a 5-byte varint32. Used to refer to the immediate argument of a i32.const instruction, e.g. taking the address of a function. (since LLVM 10.0)

§

TableIndexI32 = 2

A function table index encoded as a uint32, e.g. taking the address of a function in a static data initializer. (since LLVM 10.0)

§

MemoryAddrLeb = 3

A linear memory index encoded as a 5-byte varuint32. Used for the immediate argument of a load or store instruction, e.g. directly loading from or storing to a C++ global. (since LLVM 10.0)

§

MemoryAddrSleb = 4

A linear memory index encoded as a 5-byte varint32. Used for the immediate argument of a i32.const instruction, e.g. taking the address of a C++ global. (since LLVM 10.0)

§

MemoryAddrI32 = 5

A linear memory index encoded as a uint32, e.g. taking the address of a C++ global in a static data initializer. (since LLVM 10.0)

§

TypeIndexLeb = 6

A type index encoded as a 5-byte varuint32, e.g. the type immediate in a call_indirect. (since LLVM 10.0)

§

GlobalIndexLeb = 7

A global index encoded as a 5-byte varuint32, e.g. the index immediate in a get_global. (since LLVM 10.0)

§

FunctionOffsetI32 = 8

A byte offset within code section for the specific function encoded as a uint32. The offsets start at the actual function code excluding its size field. (since LLVM 10.0)

§

SectionOffsetI32 = 9

A byte offset from start of the specified section encoded as a uint32. (since LLVM 10.0)

§

EventIndexLeb = 10

An event index encoded as a 5-byte varuint32. Used for the immediate argument of a throw and if_except instruction. (since LLVM 10.0)

§

MemoryAddrRelSleb = 11

A memory address relative to the __memory_base wasm global. Used in position independent code (-fPIC) where absolute memory addresses are not known at link time.

§

TableIndexRelSleb = 12

A function address (table index) relative to the __table_base wasm global. Used in position indepenent code (-fPIC) where absolute function addresses are not known at link time.

§

GlobalIndexI32 = 13

A global index encoded as uint32. (since LLVM 11.0)

§

MemoryAddrLeb64 = 14

The 64-bit counterpart of MemoryAddrLeb. A 64-bit linear memory index encoded as a 10-byte varuint64, Used for the immediate argument of a load or store instruction on a 64-bit linear memory array. (since LLVM 11.0)

§

MemoryAddrSleb64 = 15

The 64-bit counterpart of MemoryAddrSleb. A 64-bit linear memory index encoded as a 10-byte varint64. Used for the immediate argument of a i64.const instruction. (since LLVM 11.0)

§

MemoryAddrI64 = 16

The 64-bit counterpart of MemoryAddrI32. A 64-bit linear memory index encoded as a uint64, e.g. taking the 64-bit address of a C++ global in a static data initializer. (since LLVM 11.0)

§

MemoryAddrRelSleb64 = 17

The 64-bit counterpart of MemoryAddrRelSleb.

§

TableIndexSleb64 = 18

The 64-bit counterpart of TableIndexSleb. A function table index encoded as a 10-byte varint64. Used to refer to the immediate argument of a i64.const instruction, e.g. taking the address of a function in Wasm64. (in LLVM 12.0)

§

TableIndexI64 = 19

The 64-bit counterpart of TableIndexI32. A function table index encoded as a uint64, e.g. taking the address of a function in a static data initializer. (in LLVM 12.0)

§

TableNumberLeb = 20

A table number encoded as a 5-byte varuint32. Used for the table immediate argument in the table.* instructions. (in LLVM 12.0)

§

MemoryAddrTlsSleb = 21

An offset from the __tls_base symbol encoded as a 5-byte varint32. Used for PIC case to avoid absolute relocation. (in LLVM 12.0)

§

FunctionOffsetI64 = 22

The 64-bit counterpart of FunctionOffsetI32. A byte offset within code section for the specific function encoded as a uint64. (in LLVM 12.0)

§

MemoryAddrLocrelI32 = 23

A byte offset between the relocating address and a linear memory index encoded as a uint32. Used for pointer-relative addressing. (in LLVM 13.0)

§

TableIndexRelSleb64 = 24

The 64-bit counterpart of TableIndexRelSleb. A function table index encoded as a 10-byte varint64. (in LLVM 13.0)

§

MemoryAddrTlsSleb64 = 25

The 64-bit counterpart of MemoryAddrTlsSleb. (in LLVM 13.0)

§

FunctionIndexI32 = 26

A function index encoded as a uint32. Used in custom sections for function annotations (__attribute__((annotate(<name>)))) (in LLVM 17.0)

Implementations§

source§

impl RelocationType

source

pub const fn addend_kind(self) -> RelocAddendKind

Indicates if this relocation type has an associated RelocEntry::addend.

source

pub const fn extent(self) -> usize

Indicates the number of bytes that this relocation type targets.

Trait Implementations§

source§

impl Clone for RelocationType

source§

fn clone(&self) -> RelocationType

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for RelocationType

source§

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

Formats the value using the given formatter. Read more
source§

impl<'a> FromReader<'a> for RelocationType

source§

fn from_reader( reader: &mut BinaryReader<'a>, ) -> Result<RelocationType, BinaryReaderError>

Attempts to read Self from the provided binary reader, returning an error if it is unable to do so.
source§

impl Hash for RelocationType

source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for RelocationType

source§

fn eq(&self, other: &RelocationType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl TryFrom<u8> for RelocationType

source§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from( v: u8, ) -> Result<RelocationType, <RelocationType as TryFrom<u8>>::Error>

Performs the conversion.
source§

impl Copy for RelocationType

source§

impl Eq for RelocationType

source§

impl StructuralPartialEq for RelocationType

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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 T
where 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

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

source§

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.