Skip to content

Relink 0.18.0

Choose a tag to compare

@weizhiao weizhiao released this 21 Oct 16:21

Relink 0.18.0

This release unifies runtime-domain and TLS ownership, expands native-library imports, dependency search, and ELF input support, and optimizes loading and symbol lookup.

Highlights

  • Unified Domain ownership of address spaces, code executors, and TLS runtimes, simplifying module lifetime management.
  • Added host::open on Linux/glibc to expose native-library symbols, GNU symbol versions, and TLS exports to Relink.
  • Added byte-based paths, symbol names, and ELF metadata, supporting non-UTF-8 inputs.
  • Added SearchConfig and LdCache for explicit search configuration, glibc cache snapshots, custom file openers, and candidate-file validation.
  • Added DF_1_NODELETE support, reverse module lookup by address, address-index snapshots, and Android APS2 packed RELA relocations.
  • Optimized ELF header reads, symbol hashing, and lookup caching. Streamlined loading-session storage, centralized batch publication and unloading, and reclaimed slots reserved by uncommitted transactions.
  • Reworked benchmarks around real shared libraries and their dependencies, with separate load and teardown measurements, selectable workloads, CI reports, and local profiling tools.

Breaking Changes

  • LinkContext::new() now takes a Domain instead of a DomainId. Use LinkContext::for_process() for native process loading.
  • Low-level loading now uses Loader::run(domain) with an explicit runtime domain. Loading shortcuts that implicitly created a domain have been removed.
  • Builder methods now consistently use with_* names, such as .with_resolver(...) instead of .resolver(...).
  • Symbol lookup returns Result<Option<Symbol<_>>>, distinguishing lookup failures from missing symbols.
  • Paths and several symbol and module metadata interfaces now use byte representations. Custom implementations must be updated accordingly.
  • ResolvedKey::load() now validates the ELF header and returns Result<Self>.
  • IntoElfReader no longer takes a lifetime parameter and has a blanket implementation for ElfReader types. Custom implementations must remove overlapping identity conversions.
  • Parts of the Module, TLS, lazy-binding, mapping-backend, and observer interfaces and generic parameters have changed.
let mut context = LinkContext::for_process();

let loaded = Linker::new()
    .with_resolver(resolver)
    .run()
    .load(&mut context, root)?;

let entry = unsafe {
    context
        .module(loaded.root())?
        .get::<extern "C" fn()>("entry")?
        .expect("symbol `entry` not found")
};
entry();

// Release the direct acquisition when it is no longer needed.
drop(loaded.release(&mut context)?);