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.

1
  • 1
    Is the symbol start a string (literal) used in the code?
    – ss_iwe
    Sep 20, 2019 at 5:19

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .