Skip to main content

SyntheticModule

Struct SyntheticModule 

Source
pub struct SyntheticModule<Arch: RelocationArch = NativeArch, D = (), R = ()> { /* private fields */ }
Expand description

A Module backed by a synthetic table of absolute symbols.

The module owns stable synthetic ELF symbols, so it can be retained in a ModuleScope without borrowing callback-owned symbol metadata.

Implementations§

Source§

impl<Arch: RelocationArch> SyntheticModule<Arch>

Source

pub fn new<I>(name: impl Into<String>, symbols: I) -> Self
where I: IntoIterator<Item = SyntheticSymbol>,

Creates a module from an ordered list of synthetic symbols.

Source

pub fn empty(name: impl Into<String>) -> Self

Creates an empty synthetic module.

Source§

impl<Arch: RelocationArch, D, R> SyntheticModule<Arch, D, R>

Source

pub fn with_user_data<NewD>( self, user_data: NewD, ) -> SyntheticModule<Arch, NewD, R>

Replaces the user data associated with this synthetic module.

Source

pub const fn user_data(&self) -> &D

Returns immutable user data for this synthetic module.

Source

pub fn user_data_mut(&mut self) -> &mut D

Returns mutable user data for this synthetic module.

Source

pub fn with_memory<M>(self, memory: M) -> Self
where M: ImageMemory + 'static,

Uses a real image-memory backend for this synthetic module.

This is required when synthetic symbols may be used as byte sources, such as for COPY relocations against synthetic object symbols.

Source

pub fn with_tls(self, tls: ModuleTls) -> Self

Sets TLS metadata exposed by this synthetic module.

Source

pub fn with_resolve_hook<F>(self, hook: F) -> SyntheticModule<Arch, D, F>
where F: Fn(&ElfSymbol<Arch::Layout>, VmAddr) -> Result<()> + Send + Sync,

Runs a callback when a synthetic symbol is resolved.

The callback receives the symbol’s stable address and may prepare lazy runtime state before that address is returned.

Source

pub fn with_domain(self, domain: DomainId) -> Self

Binds this synthetic module to one runtime domain.

Source

pub fn insert(&mut self, symbol: SyntheticSymbol) -> Option<SyntheticSymbol>

Inserts one symbol, returning the definition it replaced.

Source

pub fn contains(&self, name: &str) -> bool

Returns whether this module exports a synthetic symbol with name.

Source

pub fn len(&self) -> usize

Returns the number of synthetic symbols.

Source

pub fn is_empty(&self) -> bool

Returns whether this module contains no symbols.

Trait Implementations§

Source§

impl<Arch: RelocationArch, D: Clone, R: Clone> Clone for SyntheticModule<Arch, D, R>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<Arch, D, R, Tls> From<SyntheticModule<Arch, D, R>> for ModuleHandle<Arch, Tls>
where Arch: RelocationArch, D: Send + Sync + 'static, R: ResolveHook<Arch> + 'static, Tls: TlsResolver<Arch> + 'static,

Source§

fn from(module: SyntheticModule<Arch, D, R>) -> Self

Converts to this type from the input type.
Source§

impl<Arch, D, R, Tls> Module<Arch, Tls> for SyntheticModule<Arch, D, R>
where Arch: RelocationArch, D: Send + Sync + 'static, R: ResolveHook<Arch> + 'static, Tls: TlsResolver<Arch> + 'static,

Source§

fn name(&self) -> &str

Returns the module name used for diagnostics.
Source§

fn exports(&self) -> &dyn SymbolExports<Arch::Layout>

Returns the runtime symbol exports for this module.
Source§

fn memory(&self) -> &dyn ImageMemory

Returns this module’s runtime memory view.
Source§

fn resolve_symbol(&self, symbol: &ElfSymbol<Arch::Layout>) -> Result<VmAddr>

Resolves one of this module’s exported symbols to its runtime address. Read more
Source§

fn tls(&self) -> Option<ModuleTls>

Returns TLS metadata when this module owns a TLS block.
Source§

fn state(&self) -> &ModuleState

Returns the canonical identity, domain, and lifecycle state for this module. Read more
Source§

fn search(&self) -> Option<&ModuleSearch>

Returns metadata used when this module initiates another load.
Source§

fn initialize(&self) -> Result<()>

Performs this module’s initialization hook. Read more
Source§

fn finalize(&self) -> Result<()>

Performs this module’s finalization hook. Read more
Source§

impl<Arch, D, R> SymbolExports<<Arch as RelocationArch>::Layout> for SyntheticModule<Arch, D, R>
where Arch: RelocationArch, D: Send + Sync, R: Send + Sync,

Source§

fn for_each(&self, visitor: &mut dyn FnMut(&ElfSymbol<Arch::Layout>))

Visits symbols that can participate in exported-symbol lookup.
Source§

fn symbol_name<'exports>( &'exports self, symbol: &ElfSymbol<Arch::Layout>, ) -> Option<&'exports str>

Returns the name for a symbol entry from this export table.
Source§

fn lookup<'exports>( &'exports self, lookup: &mut SymbolLookup<'_>, ) -> Option<&'exports ElfSymbol<Arch::Layout>>

Looks up one exported symbol by name and optional version.

Auto Trait Implementations§

§

impl<Arch = X86_64Arch, D = (), R = ()> !Freeze for SyntheticModule<Arch, D, R>

§

impl<Arch = X86_64Arch, D = (), R = ()> !RefUnwindSafe for SyntheticModule<Arch, D, R>

§

impl<Arch = X86_64Arch, D = (), R = ()> !UnwindSafe for SyntheticModule<Arch, D, R>

§

impl<Arch, D, R> Send for SyntheticModule<Arch, D, R>
where R: Send, D: Send, Vec<ElfSymbol<<Arch as RelocationArch>::Layout>>: Send,

§

impl<Arch, D, R> Sync for SyntheticModule<Arch, D, R>
where R: Sync, D: Sync, Vec<ElfSymbol<<Arch as RelocationArch>::Layout>>: Sync,

§

impl<Arch, D, R> Unpin for SyntheticModule<Arch, D, R>
where R: Unpin, D: Unpin, Vec<ElfSymbol<<Arch as RelocationArch>::Layout>>: Unpin,

§

impl<Arch, D, R> UnsafeUnpin for SyntheticModule<Arch, D, R>

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> 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 = !

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.