Q:

Find function call in a list of binaries

I have a List of executables which may call a certain function. I need to find out which all execs call that function. I know I can do "strings -a " but is there some other better way to find that out. Full code is written in C.

A:

You can use the nm utility in conjuction with grep to find which executables reference the symbol, like so:

nm name_of_executable | grep symbol

So, for example, if I had a list of executables that might use "strcat", I could check for that using:

for file in exectuble1 executable2 ... executableN; do
    references_to_strcat=`nm "$file" | grep strcat -c`
    if [ $references_to_strcat -ne 0 ] ; then
       echo "$file"
    fi
done

The little loop above (assuming BASH) would print out the list of all files referencing "strcat". Note that this will only tell you which executable actually linked against the symbol... there is no way that I know of to determine which executables may reference the function using dynamic loading (e.g. dlopen/dlsym/dlcose).
Note that if you have the source code, and not just the executables, you can use Doxygen to generate a complete call graph  (in addition to documentation) for your source code, so that is another possibility.

