Code Bloat using GCC 3.2 on Linux

Andras Tantos andras_tantos@yahoo.com
Wed Dec 15 16:09:00 GMT 2004


Hi!

Try adding this to the compiler 
switches: -fdata-sections -ffunction-sections
And this to the linker: --gc-sections

This turns on garbage-collection on sections which is off by default in GCC 
(AFIK) and on by default in VC.

Regards,
Andras Tantos

----- Original Message ----- 
From: "Gaurav Jain" <gaurav.anywhere@gmail.com>
To: <gcc-help@gcc.gnu.org>
Sent: Wednesday, December 15, 2004 7:28 AM
Subject: Re: Code Bloat using GCC 3.2 on Linux


> Hi Eljay,
>
> What's more important for me is the size on disk.  I want a small file
> that can be easy to download.
>
> I have already tried the "strip" command, and the relative figures I
> gave were after stripping the binaries.
>
> -Gaurav
>
>
> On Wed, 15 Dec 2004 08:22:02 -0600, Eljay Love-Jensen <eljay@adobe.com> 
> wrote:
>> Hi Guarav,
>>
>> Did you do the "strip" command on the output binary?
>>
>> strip myexecutable
>>
>> That might cut out 10%.
>>
>> When you are talking about the "bloat", are you speaking about the file, 
>> or
>> of the memory footprint of the program when running?
>>
>> If you are speaking of the file, that does not necessarily correspond to
>> "bloat" in memory.  The Linux executable file may be 100 KB, and the 
>> memory
>> footprint (code + data) may be 200 KB.  The Windows executable file may 
>> be
>> 50 KB and the memory footprint (code + data) may be 10 MB.
>>
>> I'm just trying to understand what you consider "bloat".  Is it important
>> that the file be small, or that the running memory footprint be small?
>>
>> --Eljay
>>
>>
> 



More information about the Gcc-help mailing list