I have a set of shared libraries (Intel MKL) that are only distributed in binary form. A top-level "runtime" library, libmkl_rt.so
, links against my executable and is visible with ldd
:
...
libmkl_rt.so => /var/task/lib/libmkl_rt.so (0x00007f8049a1f000)
...
However, the other ones, such as libmkl_avx.so
, I assume are loaded dynamically with dlopen()
, as the executable throws an error saying the libraries are missing if not found, but are not visible with ldd
.
These libraries are large (> 100MB) and this is the only executable in my container using them. I assume that the executable is not calling each of the functions in these libraries, so I would like to slim them down, first determining which functions are being called, and then only keeping those.
How can I:
- Determine which symbols in the dynamically loaded shared libraries are actually used?
- Extract only those symbols into a "slim" copy of the library?
Are there any tools for this?