On Solaris 2.6, the search order used by the dynamic linker is:
- LD_LIBRARY_PATH
- directories specified at link time via -R or --rpath
- the default directories /usr/lib and /lib
This seems like the Right Thing to do, and is what most people expect.
The fact that it is compatible with Solaris makes it much more clearly
correct.
With glibc 2.1, the search order appears to be:
- directories specified at link time via -R or --rpath
- LD_LIBRARY_PATH
- directories in /etc/ld.so.conf (where available), or /usr/lib and
/lib otherwise.
Whatever glibc does, this stuff is very confusing and needs to be
documented. Probably the documentation can be borrowed from the
non-glibc dynamic linker and adapted. If there is a good rationale
for the current behavior, this should be well explained. This is very
important work. I might be willing to work on it, if you agree with
the direction.
Martin