unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#26048: Use absolute file names in NEED instead of adding many entries to RUNPATH
@ 2017-03-10 15:01 Ludovic Courtès
  2017-11-21 13:35 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Ludovic Courtès @ 2017-03-10 15:01 UTC (permalink / raw)
  To: 26048

Hello!

As Andy just noted on IRC, shared library lookup is inefficient in Guix,
because there’s one entry per library in RUNPATH.  So we get:

--8<---------------cut here---------------start------------->8---
open("/gnu/store/y8ppqsxiki39n4mqpb4mab6bgwqsnnp7-libgc-7.4.2/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/gnu/store/w0bkj9qh7iqcklm5ld8ghg1ynnzqyv00-libffi-3.2.1/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/gnu/store/d5gw4i6bnyznmbr55ba39bl3pgrhsyp0-libunistring-0.9.6/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/gnu/store/6k08nkddnrb15h5pwp1s0fa94mr1qas9-gmp-6.1.1/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/gnu/store/9yn89bkl8vcg5rh9dmw3jijciwgrwjls-libltdl-2.4.6/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/gnu/store/iwgi9001dmmihrjg4rqhd6pa6788prjw-glibc-2.24/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
--8<---------------cut here---------------end--------------->8---

An alternate approach would be for ld-wrapper to replace “-lfoo” with
“/gnu/store/…/libfoo.so”, which would add the absolute file name as
NEEDed in the ELF file.

Ludo’.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#26048: Use absolute file names in NEED instead of adding many entries to RUNPATH
  2017-03-10 15:01 bug#26048: Use absolute file names in NEED instead of adding many entries to RUNPATH Ludovic Courtès
@ 2017-11-21 13:35 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2017-11-21 13:35 UTC (permalink / raw)
  To: 26048

ludo@gnu.org (Ludovic Courtès) skribis:

> As Andy just noted on IRC, shared library lookup is inefficient in Guix,
> because there’s one entry per library in RUNPATH.  So we get:
>
> open("/gnu/store/y8ppqsxiki39n4mqpb4mab6bgwqsnnp7-libgc-7.4.2/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
> open("/gnu/store/w0bkj9qh7iqcklm5ld8ghg1ynnzqyv00-libffi-3.2.1/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
> open("/gnu/store/d5gw4i6bnyznmbr55ba39bl3pgrhsyp0-libunistring-0.9.6/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
> open("/gnu/store/6k08nkddnrb15h5pwp1s0fa94mr1qas9-gmp-6.1.1/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
> open("/gnu/store/9yn89bkl8vcg5rh9dmw3jijciwgrwjls-libltdl-2.4.6/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
> open("/gnu/store/iwgi9001dmmihrjg4rqhd6pa6788prjw-glibc-2.24/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
>
> An alternate approach would be for ld-wrapper to replace “-lfoo” with
> “/gnu/store/…/libfoo.so”, which would add the absolute file name as
> NEEDed in the ELF file.

This is actually impossible, as discussed at
<https://lists.gnu.org/archive/html/guix-devel/2017-09/msg00075.html>:

  Per the ELF v1.2 spec¹ (page 82), setting DT_NEEDED to
  an absolute file name would prevent overriding via LD_LIBRARY_PATH,
  which is not desirable.

  It turns out we cannot even set DT_NEEDED to an absolute file name in
  the first place, because ld records the DT_SONAME of the library, when
  it’s available (which is the case most of the time), rather than its
  file name.

  ¹ http://refspecs.linuxbase.org/elf/elf.pdf

Ludo’.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-21 13:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-10 15:01 bug#26048: Use absolute file names in NEED instead of adding many entries to RUNPATH Ludovic Courtès
2017-11-21 13:35 ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).