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 => /usr/lib/
pine: '/lib/' is not an ELF file => /lib/elf/libc.4

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


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


Version: 2.6.i



1. Q: shared libraries, modified search order

How about having bar in dlopen(), and then obtain frotz() via

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 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 :-)


2. Compaq MV400 monitor specs

3. Search order for shared libraries ( and ldconfig)


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?