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

Jonathan Adamczewski jadamcze@utas.edu.au
Mon Nov 24 09:01:00 GMT 2008


Alan Modra wrote:
> On Mon, Nov 24, 2008 at 03:19:32PM +0800, Pan ruochen wrote:
>> 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.
> 
> No, but if you compile with -ffunction-sections -fdata-sections and
> link with -gc-sections, ld will trim off the unused functions for you.
> 


When using --gc-sections, --print-gc-sections will list all removed sections.

j. 



More information about the Binutils mailing list