dlopen and static linking

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Tue May 27 11:59:00 GMT 2003


At 13:34 27.05.2003, Jakub Jelinek wrote:
>On Tue, May 27, 2003 at 01:06:10PM +0200, Thorsten Kukuk wrote:
> >
> > Hi,
> >
> > Appendend is a test case for dlopen, where a static program dlopens
> > a shared library which dlopens another shared library. The second
> > dlopen always seg.faults for me (call a, a.shared works).
> >
> > Should this work or not? If this should not be worked, we need to
> > fix RPM, which is static linked and calles dlopen.
>
>rpm is fixed, it is not statically linked anymore.
>ldd /bin/rpm
>         librpm-4.2.so => /usr/lib/librpm-4.2.so (0x40032000)
>         librpmdb-4.2.so => /usr/lib/librpmdb-4.2.so (0x40087000)
>         librpmio-4.2.so => /usr/lib/librpmio-4.2.so (0x40166000)
>         libpopt.so.0 => /usr/lib/libpopt.so.0 (0x401c4000)
>         libelf.so.1 => /usr/lib/libelf.so.1 (0x401cc000)
>         libpthread.so.0 => /lib/tls/libpthread.so.0 (0x401dc000)
>         librt.so.1 => /lib/tls/librt.so.1 (0x401ea000)
>         libbz2.so.1 => /usr/lib/libbz2.so.1 (0x401fe000)
>         libc.so.6 => /lib/tls/libc.so.6 (0x00e80000)
>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
>But I'm afraid there are other statically linked apps which use NSS,
>so the dlopen from dlopen either needs to be avoided, or fixed.

Are you sure about rpm here? Note that /bin/rpm is just a wrapper nowadays 
and calls executables in /usr/lib/rpm. And there at least the most 
important one /usr/lib/rpm/rpmi is statically linked (and should remain 
statically linked forever IMHO), though I'm not sure if rpmi uses dlopen.

Franz.



More information about the Libc-alpha mailing list