wasmtime_environ::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<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> 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.