GNU bug report logs -
#26048
Use absolute file names in NEED instead of adding many entries to RUNPATH
Previous Next
Reported by: ludo <at> gnu.org (Ludovic Courtès)
Date: Fri, 10 Mar 2017 15:02:02 UTC
Severity: normal
Tags: wontfix
Done: ludo <at> gnu.org (Ludovic Courtès)
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 26048 in the body.
You can then email your comments to 26048 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-guix <at> gnu.org
:
bug#26048
; Package
guix
.
(Fri, 10 Mar 2017 15:02:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
ludo <at> gnu.org (Ludovic Courtès)
:
New bug report received and forwarded. Copy sent to
bug-guix <at> gnu.org
.
(Fri, 10 Mar 2017 15:02:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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’.
Information forwarded
to
bug-guix <at> gnu.org
:
bug#26048
; Package
guix
.
(Tue, 05 Sep 2017 14:58:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 26048 <at> debbugs.gnu.org (full text, mbox):
Ricardo Wurmus <rekado <at> elephly.net> skribis:
> Andy wrote:
>
>> It would be pretty cool if we could fix our O(n^2) problems in search
>> paths in this core-updates -- basically whenever you go to create an
>> environment, instead of making e.g. VAR=A:B:C:..., for all VARs
>> (LIBRARY_PATH, PKG_CONFIG_PATH, etc), instead we make a union directory
>> Z containing the union of A, B, C, etc and set VAR=Z. The goal would be
>> to fix quadratic run-time lookup costs by replacing it with a
>> compile-time computation. This applies to many lookups: PATH, -rpath,
>> etc.
>
> Ludo wrote:
>
>> A possible alternative solution for ld.so is at
>> <https://bugs.gnu.org/26048>.
>
> Do you know of any negative side effects this would have? For example,
> would it not become impossible to override libraries at runtime with
> LD_LIBRARY_PATH or LD_PRELOAD when “-lfoo” is replaced by the absolute
> file name of the “foo” library?
Good question. 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.
IOW, the approach suggested in <https://bugs.gnu.org/26048> isn’t really
applicable. :-/
Ludo’.
¹ http://refspecs.linuxbase.org/elf/elf.pdf
Information forwarded
to
bug-guix <at> gnu.org
:
bug#26048
; Package
guix
.
(Tue, 21 Nov 2017 13:36:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 26048 <at> debbugs.gnu.org (full text, mbox):
ludo <at> 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’.
Added tag(s) wontfix.
Request was from
ludo <at> gnu.org (Ludovic Courtès)
to
control <at> debbugs.gnu.org
.
(Tue, 21 Nov 2017 13:36:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
26048 <at> debbugs.gnu.org and ludo <at> gnu.org (Ludovic Courtès)
Request was from
ludo <at> gnu.org (Ludovic Courtès)
to
control <at> debbugs.gnu.org
.
(Tue, 21 Nov 2017 13:36:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 20 Dec 2017 12:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 101 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.