Re: Bug#473458: manpages-dev: dlopen man page contradicts ld.so(8)
reassign 473458 libc6
found 473458 2.7-9
thanks
On Sun, Mar 30, 2008 at 09:48:46PM +0300, ygrek wrote:
> man dlopen says :
> Otherwise, the
> dynamic linker searches for the library as follows (see ld.so(8) for
> further details):
> [...]
> o The directories /lib and /usr/lib are searched (in that order).
>
> and man ld.so :
> The necessary shared libraries needed by the program are searched for
> in the following order
> [...]
> o In the default path /usr/lib, and then /lib.
>
> so what is searched first - /usr/lib or /lib?
$ sudo mv -iv /etc/ld.so.cache{,~}
open("/etc/ld.so.cache", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/cmov/libbfd-2.18.0.20080103.so", O_RDONLY) = -1 ENOENT (No such file or directory)
[...]
open("/lib/i686/cmov/libbfd-2.18.0.20080103.so", O_RDONLY) = -1 ENOENT (No such file or directory)
[...]
open("/lib/cmov/libbfd-2.18.0.20080103.so", O_RDONLY) = -1 ENOENT (No such file or directory)
[...]
open("/lib/libbfd-2.18.0.20080103.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/tls/i686/cmov/libbfd-2.18.0.20080103.so", O_RDONLY) = -1 ENOENT (No such file or directory)
[...]
open("/usr/lib/i686/cmov/libbfd-2.18.0.20080103.so", O_RDONLY) = -1 ENOENT (No such file or directory)
[...]
open("/usr/lib/i686/libbfd-2.18.0.20080103.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/cmov/libbfd-2.18.0.20080103.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/libbfd-2.18.0.20080103.so", O_RDONLY) = 4
open("/lib/i686/cmov/libc.so.6", O_RDONLY) = 4
So ld.so uses (roughly speaking) /lib then /usr/lib. As it turns out,
dlopen seems to do kind of the same thing:
open("/etc/ld.so.cache", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/cmov/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
[...]
open("/lib/i686/cmov/libdl.so.2", O_RDONLY) = 3
[...]
open("/lib/cmov/libc.so.6x", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/libc.so.6x", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/tls/i686/cmov/libc.so.6x", O_RDONLY) = -1 ENOENT (No such file or directory)
[...]
open("/usr/lib/i686/cmov/libc.so.6x", O_RDONLY) = -1 ENOENT (No such file or directory)
[...]
open("/usr/lib/cmov/libc.so.6x", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/libc.so.6x", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/i486-linux-gnu/tls/i686/cmov/libc.so.6x", O_RDONLY) = -1 ENOENT (No such file or directory)
[...]
open("/usr/lib/i486-linux-gnu/tls/i686/cmov/libc.so.6x", O_RDONLY) = -1 ENOENT (No such file or directory)
[...]
The i486-linux-gnu comes from:
$ cat /etc/ld.so.conf
/usr/local/lib
include /etc/ld.so.conf.d/*.conf
$ cat /etc/ld.so.conf.d/i486-linux-gnu.conf
# Multiarch support
/lib/i486-linux-gnu
/usr/lib/i486-linux-gnu
That's the default file content, for (Debian-specific?) multiarch
patch to libc6.
The i686, cmov stuff may be distribution specific; the /lib/i686 stuff
is provided by an libc6-i686 package compiled for CPUs with opcodes
not present in vanilla 486 (the earliest x86 CPU supported by
unpatched Debian).
But I think it's sufficiently accurate to say that the /lib heirarchy
is searched before that of /usr/lib, so ld.so.8 is wrong, thus
reassigning.
I note that libc6 2.7 ldconfig now uses /var/cache/ldconfig to
minimize its runtime.
Reply to: