--gc-sections on x86

Perry Smith pedz@easesoftware.com
Tue Dec 5 14:27:00 GMT 2006


On Dec 5, 2006, at 4:13 AM, Gabriel Linder wrote:

> Brian Dessent wrote:
>> This testcase may not be actually showing you what you want.  You  
>> have
>> to balance the extra overhead of having a section for each function
>> against the savings, and in this case the function being removed is
>> completely trivial.  When you're looking at a 2800 byte ELF file the
>> noise (headers, padding, etc) is going to overwhelm everything.   
>> Try a
>> more realistic testcase.
> Well, that was a trivial testcase, as you said. In real life I have  
> a lot of .c files with generic functions, but not all of them are  
> used by all binaries I build. So I search for a way to clean out  
> unused functions between modules, if possible.
>
> The --gc-sections trick was found after some search, I found also a  
> "set inline function size to 0 and enable inlining" hint (on RedHat  
> lists, if I remember correctly) but none of them works.

It seems like if you had to, you could analyze the output of nm of  
the object files -- maybe even the final compiled program.  nm will  
tell you where symbols are defined and reference.

Perry Smith ( pedz@easesoftware.com )
Ease Software, Inc. ( http://www.easesoftware.com )

Low cost SATA Disk Systems for IBMs p5, pSeries, and RS/6000 AIX systems




More information about the Gcc-help mailing list