I am trying to understand the following behavior of shared libraries in C
Machine One
$ cat one.c
#include
What does the address given in brackets (for example, (0x002de000)) mean?
It is the (virtual) memory address where the library is loaded. Recent system can provide randomization of where libraries are loaded though, so that address might vary between invocations.
shouldn't they be loaded only at runtime?
Yes they are. ldd goes through much of the same procedure as what is done at runtime though, to be able to figure out various things.
Why does two need any libraries at all?
libc.so.6 is the standard C library (and other stuff, like the interface to the kernel) and is always linked in ny default. gcc has options to control this though, e.g. the -nostdlib
flag
ld-linux.so is a the dynamic loader, and is repsonsible for loading/relocating other shared libraryis and run your application. The manpage for ld-linux.so gives you the details.
linux-gate.so.1 is a virtual library, it exists only in memory in the kernel. It's used to perform system calls to the kernel, and figures out the most efficient way to do so based on your CPU. This was probably added to linux later than your other 2.6.9 kernel machine.
I don't know what /usr/lib/libcwait.so is , but chances are you can get some info about it by doing rpm -qif /usr/lib/libcwait.so