This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
How does dynamic loading of libnss_dns.so et al work?
- From: Arvid Brodin <arvid dot brodin at enea dot com>
- To: libc-help at sourceware dot org
- Date: Wed, 13 May 2009 18:14:52 +0200
- Subject: How does dynamic loading of libnss_dns.so et al work?
Hi,
I need to find all dynamic libraries needed by a set of cross-built binaries. To do this, I use 'objdump -x <binary> | grep NEEDED', which gives me a list of the dynamic libraries needed by that particular binary. I then iterate the objdump on the list of libraries, until I cannot find any more dependencies.
However, this does not work for the Name Service Switch libraries; libnss_dns.so is not listed as a NEEDED library in the objdump, but name lookup still fails with e.g.: "ping: bad address 'google.com.'" if this library and its dependencies (libresolv.so) are missing on the target system. (Using busybox ping, which calls getaddrinfo().)
In fact, grepping on nss_dns gives no hits at all on any on the involved binaries or libs (busybox, libcrypt, libm, libc, ld-linux). Which makes me wonder: how can the executable know to load libnss_dns? What's the mechanism used to load this file (and libnss_files.so, etc.)?
Thanks,
--
Arvid Brodin
Enea LCC