Search order for ELF libraries

Search order for ELF libraries

Post by Karl Key » Thu, 06 Jul 1995 04:00:00



After upgrading my libraries (a.out and ELF), I now find
that some binaries I build in ELF using the 4.8.0 library
now complain about the 4.7.4 library not being ELF!  They
continue to run so the 4.8.0 library is clearly found.

Doing an 'ldd' on such a binary gives something like this:

$ ldd pine
        libtermcap.so.1 => /usr/lib/libtermcap.so.1.2.4
pine: '/lib/libc.so.4' is not an ELF file
        libc.so.4 => /lib/elf/libc.4

I'm not quite sure why it's looking in /lib first.  Can
anyone explain what's happening here?

Karl

--------------------------------------------------------------------------
Vitrociset S.p.A.                               Tel   : +(49) 6151 902041
European Space Agency                           Fax   : +(49) 6151 904041

--------------------------------------------------------------------------

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: 2.6.i

mQBtAi+WPMgAAAEDALDUQ91qHPHwNBotQ6T0L7vWz8hS3WibmnIjfyXDoQofNTYs
civdUfuPrt2vLIlDOdFQLt7B5yL301T3QXvVY0XWNTpUJ4xE1oWNqukSSwGy1tHi
nVKbNIrGkt4Xv2IkDQAFEbQfS2FybCBLZXl0ZSA8a2tleXRlQGVzb2MuZXNhLmRl
Pg==
=KCKi

 
 
 

1. Q: shared libraries, modified search order


How about having bar in libY.so dlopen() libZ.so, and then obtain frotz() via
dlsym()?

The runtime linker has a very simple mechanism for locating symbols associated
with global relocations: it looks in the application, and then in each of its
dependant shared objects (in the same order as ldd(1) shows).  The reason the
-Bsymbolic build of libY.so changes its binding of quux() is because the binding
is actually satisfied and constructed at link-edit time, thus the runtime linker
doesn't even get involved.

The dlopen() namespace gets a little more involved, as it's implemented to
maintain separate relationships between different dlopen() heirachies. See
the Linker and Libraries Manual, Chapter 3, Section ``Adding Additional
Objects'' for a pictorial discription of dlopen() bindings.

I'd be carefull of polluting the namespace with too many multiple symbol
definitions ... it can lead to confusion, and be hard to persuade a debugger
what symbol you really want to set a break point on :-)

Rod.

2. Compaq MV400 monitor specs

3. Search order for shared libraries (ld-linux.so and ldconfig)

4. CRTSCTS

5. SVR4 ELF access library question... (ELF-specific)

6. Console Display Corrupted

7. Can ELF programs load non-ELF libraries?

8. ftpd/proc

9. search order for resolving names on the net

10. How to search filenames for two words in no particular order?

11. Force mount filesystem search order ?

12. dhcp resets my domain search order

13. How does find(1) decide search order of directories?