Can LD give warnings about the non-static functions defined but never used explicitly?

David Daney ddaney@caviumnetworks.com
Mon Nov 24 16:21:00 GMT 2008


Pan ruochen wrote:
> Hi All,
> 
> Can LD give warnings about the non-static functions defined but never
> used explicitly? I want to optimize the code size by removing those
> unused functions.
> 

Compile your code with -ffunction-sections -fdata-sections.

Then link with -Wl,--gc-sections

In theory, that should eliminated unreferenced functions and data 
objects from the final object.

David Daney



More information about the Binutils mailing list