I clean up the rotten source tree, and I try to ensure that every executable file and every shared library is associated with only those libraries that they use directly.
To do this, I ldd -u- rbinary output and remove the specified libraries from the makefile.
For instance:
$ ldd -u -r ./libA.so
Unused direct dependencies:
/usr/local/lib/libB.so
/usr/local/lib/libC.so
/lib/tls/libpthread.so.0
$ sed -i'' -e 's/-lB//' -e 's/-lC//' Makefile
Well, of course, it is libpthreadreally necessary (and in any case implicitly included in -pthread), but the rest of the libraries reported lddcan be safely deleted.
Are there any implications for my optimization? Is it completely safe?
source
share