[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Removing unused functions

From: Geoffrey Wossum
Subject: Re: [avr-gcc-list] Removing unused functions
Date: Thu, 17 Oct 2002 20:34:48 -0500 (CDT)

> I have tried to remove unused funktions from the target by using =
> -ffunction-sections when compiling and -gc-sections when linking and =
> ends up with ... nothing. The linker removes the entire .text-segment. =
> Can any one explain why?

If you really want to not link unused functions into the finished binary, 
you should seperate it out so that each function is in it's own object 
file.  This pretty much means each function is in it's own source file.  
That's the only way GNU ld (and many other linkers) will not link in 
unused functions/global symbols.  In general, if one symbol in an object 
file gets linked in, all the symbols in the object file get linked in.  

This is why most libc's have one function per source code file.

Geoffrey Wossum
Project AKO - http://ako.sf.net

avr-gcc-list at http://avr1.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]