avr-gcc-list
[Top][All Lists]
Advanced

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

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


From: Olof Tångrot
Subject: Re: [avr-gcc-list] Removing unused functions
Date: Fri, 18 Oct 2002 19:00:28 +0200

When working with a target processor with 2k of memory it whould nice to have 
tool support to make the binary smaller even though it might not be needed on a 
target machines with several megs of memory.

Still if I try the same with an ordinary gcc and elf-linker it doesn't remove 
everything.

Is this a fault in the bfd-library or is it the linker-scripts that are faulty? 
Is the garbage collection functionality implemented for elf32-avr or is it 
stubed in some way? What is to be done in order to get garbage collection to 
work?

----- Original Message ----- 
From: "Geoffrey Wossum" <address@hidden>
To: "Olof Tångrot" <address@hidden>
Cc: <address@hidden>
Sent: Friday, October 18, 2002 3:34 AM
Subject: Re: [avr-gcc-list] Removing unused functions


> > 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]