[RFC PATCH] elf: Add opt-in per-object resolution notes

Domen Kožar domen@dev.si
Mon Nov 2 17:08:51 GMT 2026


Hi Florian,

Yes, we evaluated the symlink-directory approach. For devenv, changing
only the executable’s RUNPATH reduced failing library opens from 486
to 392. Applying it throughout the dependency graph reduced them to
88. For ImageMagick, changing the executable alone reduced them from
1225 to approximately 213.

A single shared directory can introduce filename collisions between
different builds of the same library. Separate directories per ELF
object avoid that and preserve per-object search choices, but add
directories and symlinks that must be generated and distributed.

The remaining search overhead is our other motivation for the note
approach. A farm still goes through directory searches, including
hardware-capability probes. With the note, fixed resolutions can be
opened directly, while entries requiring runtime selection retain
ordinary searches. The metadata lives inside the ELF object.

Both approaches preserve existing loaded-object reuse; the note does
not provide isolation between libraries sharing a soname.

The farm’s substantial advantage is working with an unmodified loader.
Our question is whether avoiding the additional filesystem entries and
remaining searches warrants loader support.

The experiments are described here:
https://devenv.sh/blog/2026/06/26/making-devenv-start-fast-and-the-whole-nixpkgs-with-it/#approach-2-the-runpath-symlink-farm

Regards,
Domen


On Sun, 01 Nov 2026 14:38:12 +0100, Florian Weimer <fw@deneb.enyo.de> wrote:
> * Domen Kožar:
>
> > Questions for review:
> > 1. Are these restrictions sufficient for an opt-in cache, or should
> > the loader detect stale records before using them?
> > 2. Should the note bind its records to the object's DT_RUNPATH and
> > DT_NEEDED values from the outset?
> > 3. Would extending ld.so.cache be preferable, and how should it
> > preserve each requesting object's RUNPATH search order?
>
> This has come up in other contexts, often with very long
> LD_LIBRARY_PATH search paths (typically in an HPC setting with Spack).
>
> I think Rich Felker suggested just to pre-populate a dedicated
> directory with symbolic links, as a form of cache.  The magic RUNPATH
> for the main program could point to that.  Have you tried this
> approach?


More information about the Libc-alpha mailing list