#[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
Relocation entry type. Each entry type corresponds to one of the
R_WASM_*
constants defined at
https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/BinaryFormat/WasmRelocs.def
and
https://github.com/WebAssembly/tool-conventions/blob/main/Linking.md#relocation-sections.
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
impl RelocationType
Sourcepub const fn addend_kind(self) -> RelocAddendKind
pub const fn addend_kind(self) -> RelocAddendKind
Indicates if this relocation type has an associated RelocEntry::addend
.
Trait Implementations§
Source§impl Clone for RelocationType
impl Clone for RelocationType
Source§fn clone(&self) -> RelocationType
fn clone(&self) -> RelocationType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for RelocationType
impl Debug for RelocationType
Source§impl<'a> FromReader<'a> for RelocationType
impl<'a> FromReader<'a> for RelocationType
Source§fn from_reader(
reader: &mut BinaryReader<'a>,
) -> Result<RelocationType, BinaryReaderError>
fn from_reader( reader: &mut BinaryReader<'a>, ) -> Result<RelocationType, BinaryReaderError>
Self
from the provided binary reader, returning an
error if it is unable to do so.Source§impl Hash for RelocationType
impl Hash for RelocationType
Source§impl PartialEq for RelocationType
impl PartialEq for RelocationType
Source§impl TryFrom<u8> for RelocationType
impl TryFrom<u8> for RelocationType
impl Copy for RelocationType
impl Eq for RelocationType
impl StructuralPartialEq for RelocationType
Auto Trait Implementations§
impl Freeze for RelocationType
impl RefUnwindSafe for RelocationType
impl Send for RelocationType
impl Sync for RelocationType
impl Unpin for RelocationType
impl UnwindSafe for RelocationType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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