0

I would like to find the symbol "start" for example in all object files recursively down from the directory I'm in. I think I can use nm or readelf, but I'm new to shell and not understanding how to do this from the manual.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164

1 Answers1

2

You could use something like this:

find . -type f \( -executable -o -name \*.o \) -exec nm -A {} + | grep start

This will find all executable files, or object files, and run nm -A on them, piping the results to grep.

You can adjust this to look for other files. For libraries (.so etc.) you should use nm -A -D (to list dynamic symbols). The -A option makes nm repeat the file name on every line, so that the filtered output is still useful.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164