Finding orphaned functions

David Daney ddaney@avtrex.com
Thu May 10 17:55:00 GMT 2007


Yan Seiner wrote:
> I've got a huge app that's got a bunch of functions that are not used.  
> I've found a few by hand but it's slow and tedious.
> 
> Is there some way to get gcc or helper app to tell me what and where 
> they are?
> 
You could try compiling all your source with -ffunction-sections, and 
then link with -Wl,--gc-sections.

This should omit all unused functions from the final executable.

You could then compare the symbols in the final executable (using nm) 
with the symbols in all the constituent object to see which were omitted.

David Daney



More information about the Gcc-help mailing list