I'm looking for a way to check if my C project, that compiles to an ELF, has unused functions, and locate them. That is functions that are declared but are not called anywhere in my code.
The solution can be one of:
- A utility that goes through my .c files, analysing them
- A utility that goes through my compiled ELF file, that has symbols, analysing it statically
- A way to warn about unused functions in gcc (and -Wunused-functions doesn't do that for global functions)
The solution cannot be one of:
- Deleting unused functions in compile time, without knowing what functions were deleted
- Analysing the ELF file in run-time, since not every function will be called in every run such as
gprof
(some functions take days until they are called, but in the code flow you can see that they are eventually called) - A utility that discovers dead-code inside functions (i.e. code after a return from function), rather than unused functions
Thank you