mbox

[bug#44899,v2,0/4] Using 'ld.so.cache' to speed up application startup

Message ID 20201128102409.3157-1-ludo@gnu.org
Headers show

Message

Ludovic Courtès Nov. 28, 2020, 10:24 a.m. UTC
Hi!

This new version addresses the shortcomings I mentioned earlier and
other issues reported on IRC:

  • ld.so no longer uses “../etc/ld.so.cache”.  Instead, it (1) ensures
    $ORIGIN is in the store, (2) extracts the store file name, and
    (3) appends “/etc/ld.so.cache”.  IOW, the ‘ld.so.cache’ is always
    resolved relative to the store directory $ORIGIN belongs to, not
    relative to $ORIGIN itself.

    Thinking about it, it’s a direct translation of the ld.so.cache model
    from FHS to the functional model where a system-wide /etc/ld.so.cache
    makes no sense.

  • ‘make-dynamic-linker-cache’ now creates an ‘ld.so.conf’ that contains
    all the dependencies, recursively, as would be returned by ‘ldd’.
    The new ‘file-needed/recursive’ procedure returns the list of shared
    objects depended on like ‘ldd’.

  • ‘make-dynamic-linker-cache’ creates ‘ld.so.conf’ in $TMPDIR rather
    than hard-code /tmp, so as to be friendlier to ‘--disable-chroot’
    builds (as is currently used on GNU/Hurd).

I’m rather happy and confident with that version.  :-)

Feedback welcome!

Ludo’.

Ludovic Courtès (4):
  gremlin: Fix typo in docstring.
  gremlin: Add 'file-needed/recursive'.
  gnu: glibc: Load 'etc/ld.so.cache' in $ORIGIN's store item when
    available.
  build-system/gnu: Add 'make-dynamic-linker-cache' phase.

 gnu/local.mk                              |   1 +
 gnu/packages/base.scm                     |  16 +--
 gnu/packages/patches/glibc-dl-cache.patch | 140 ++++++++++++++++++++++
 guix/build-system/gnu.scm                 |   4 +
 guix/build/gnu-build-system.scm           |  68 +++++++++++
 guix/build/gremlin.scm                    |  43 ++++++-
 tests/gremlin.scm                         |  36 ++++++
 7 files changed, 297 insertions(+), 11 deletions(-)
 create mode 100644 gnu/packages/patches/glibc-dl-cache.patch

Comments

Ludovic Courtès Dec. 1, 2020, 8:45 p.m. UTC | #1
Ludovic Courtès <ludo@gnu.org> skribis:

>   gremlin: Fix typo in docstring.
>   gremlin: Add 'file-needed/recursive'.
>   gnu: glibc: Load 'etc/ld.so.cache' in $ORIGIN's store item when
>     available.
>   build-system/gnu: Add 'make-dynamic-linker-cache' phase.

Pushed as f85efa86e7690d9181946351631e02b1c20958c9, sans hard-coded
/gnu/store in the patch as reported by Ricardo on IRC and debugging
leftover in gremlin.scm.

Enjoy… and report any issues you may find!  :-)

Ludo’.