Deeper in Libraries With GCC(4)
Posted by aboelnour on February 19, 2010
peace be upon you:
After making your library you will need to edit it or just read it’s Contents.
Listing Symbols Names in Object Files:
The nm utility can be used to list all the symbols defined in (or referenced from) an object file, a static archive library, or a shared library. If no file is named on the command line, the file name a.out is assumed
look the man page for more info about options.
Removing Unused Information from Object Files:
The strip utility removes the debugging symbol table information from the object file or files named on the command line. The object file can be a static library, a shared library, or a .o file produced by the compiler. Depending on how much debugging information has been included in the file, stripping can dramatically reduce the size of the file.
strip main.o libglom.a
this command will strip all debugging information
from the object file main.o and all the object files in the library libglom.a
The strip utility replaces the existing file with the stripped version, so if you want to be able to restore the original unstripped versions, you will need to save the files before stripping them or use the -o option to produce the output in a different file.
Listing Shared Library Dependencies:
The ldd utility reads through the object files in the binary executable or shared library named on the command line and lists all the shared library dependencies.
For example,the following command lists the shared libraries used by the bash shell program on a Linux system:
linux-gate.so.1 => (0xb8022000)
libncurses.so.5 => /lib/libncurses.so.5 (0xb7fc3000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7fbf000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7e60000)
this is the shared objects which the bash use it the ldd utility determine the library and it’s path on your hard.
that’s the end of our series.I hope that any one find it helpful. Any question is welcomed.