Skip to content

Relink 0.17.0

Choose a tag to compare

@weizhiao weizhiao released this 29 Aug 06:26

Relink 0.17.0

This release redesigns module lifetime management, dependency resolution, and symbol scopes, providing a stronger foundation for safe unloading, cross-runtime loading, and customizable dynamic linking.

Highlights

  • Added module unloading and lifetime management through ModuleLease, acquire, release, pin, and recursive dependency collection.
  • Expanded LinkContext with global symbol scopes, module graph imports, file identity deduplication, runtime domains, and reverse module lookup.
  • Improved library search with inherited DT_RPATH, DT_RUNPATH, $ORIGIN, $LIB, and $PLATFORM.
  • Added GNU unique symbol support, ELF symbol visibility handling, and improved symbol version semantics.
  • Redesigned the TLS runtime with registries, per-thread DTV management, and cleaner resolver interfaces.
  • Added basic little-endian Xtensa ELF32 dynamic relocation support, including an ESP32 QEMU example and CI coverage. Xtensa lazy binding and TLS relocations are not supported yet.
  • Reorganized tests, fixtures, examples, and public API documentation.

Breaking Changes

  • LinkContext::new() now requires a DomainId.
  • Loading now uses Linker::run().load(), with redesigned resolver and request APIs.
  • LoadResult::root() returns a ModuleId. Modules are accessed through LinkContext::module() and must be explicitly released.
  • Module keys now use the concrete ModuleKey type instead of a generic key parameter.
  • Relocation scopes are represented by ModuleScope, LocalScope, and GlobalScope.
  • The Module, ModuleHandle, observer, TLS, and synthetic module APIs have changed.
  • The tls feature has been removed. TLS APIs are always available, while lazy-binding now only enables the built-in NativeLazyBinder.
let loaded = Linker::new()
    .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)?);