pub struct LoadedCode { /* private fields */ }Expand description
Executable memory holding a relocated image, returned by
CodeBufferFinalized::load.
Dropping it does not free the memory: see Span.
Implementations§
Source§impl LoadedCode
impl LoadedCode
pub const fn span(&self) -> &Span
Sourcepub const fn span_mut(&mut self) -> &mut Span
pub const fn span_mut(&mut self) -> &mut Span
The span, for patching the loaded image in place.
Sourcepub fn got_slot(&self, name: &ExternalName) -> Option<*const u8>
pub fn got_slot(&self, name: &ExternalName) -> Option<*const u8>
Address of the GOT slot holding external symbol name, or None when
no far reference to name gave it a slot.
Sourcepub unsafe fn rebind(
&mut self,
jit_allocator: &mut JitAllocator,
name: &ExternalName,
address: *const u8,
) -> Result<(), AsmError>
pub unsafe fn rebind( &mut self, jit_allocator: &mut JitAllocator, name: &ExternalName, address: *const u8, ) -> Result<(), AsmError>
Points every far reference to name at address, by rewriting its
GOT slots. Near references were resolved into the instructions at load
time and keep their target.
§Errors
Returns AsmError::InvalidArgument if address is null or name
has no GOT slot in this image, or an error from
JitAllocator::write.
§Safety
jit_allocator must be the allocator that loaded this image. Code
running concurrently may observe either the old or the new address.
Sourcepub fn symbol_by_name(&self, name: &ExternalName) -> Option<*const u8>
pub fn symbol_by_name(&self, name: &ExternalName) -> Option<*const u8>
Runtime address of a symbol exported with CodeBuffer::bind_symbol.
Sourcepub fn symbol(&self, name: &str) -> Option<*const u8>
pub fn symbol(&self, name: &str) -> Option<*const u8>
Like Self::symbol_by_name, for string ExternalName::Symbol exports.