I have an executable and it calls a function. There are a lot of static and dynamic libraries that are linked with this exe. I need to know which one provides this function.
Asked
Active
Viewed 50 times
1 Answers
0
You can get a list of shared libraries used by the executable foo like this:
ldd -v foo
This post:
How do I list the symbols in a .so file
explains how to list symbols (exported functions) in a shared library.
If your library is linked statically, it'll show up in the list of symbols inside the executable itself:
nm -C foo
The same command will also list the names of all exported symbols (function names) in a static library:
nm -C libasan.a
You may want to construct a shell script to enumerate your libraries, looking for the specific function that you want inside each one. For example, to figure out which .a file provides sprintf():
for x in *.a; do echo --- ${x} ---; nm -C $x | grep sprintf ; done

Community
- 1
- 1

Chris Jaekl
- 166
- 1