delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/22/16:11:32

Message-ID: <c=GB%a=_%p=Indigo_Active_Vi%l=CRIANLARICH-970522155346Z-31@crianlarich.Indigo>
From: Robert Humphris <r DOT humphris AT indigo-avs DOT com>
To: "'djgpp AT delorie DOT com'" <djgpp AT delorie DOT com>
Subject: RE: Reducing image size?
Date: Thu, 22 May 1997 16:53:46 +0100
Encoding: 40 TEXT

The best ways of reducing image size are :

Either putting -s in your cc command line, or running strip.exe with
your final code, this will remove some strange debugging
code that is included in the final binary regardless of the fact that
you didn't want it.

Compile with optimisations, running -O, -O2 will often reduce the size
of your code as some of the optimisations are size
reducing.

If it is not in the optimisation options, omit the frame pointer,  with
the final code you will often find that extra code is generated 
to deal with frame pointers, we use GCC to compile our embedded systems,
and we have only a couple of hundred k to fit our
code in, running with -O2 reduced our binary file by 44 bytes! ( but
made it run much much faster ) but by adding -fomit-frame-pointer
to our CFLAGS line we reduced the final binary by just over 25%.

Finally look at your code, do you really need to use a large array? or
would dynamic memory allocation be better?
int buff[1024] will make your data segment 1k bigger, but int *pBuff =
(int *)malloc( 1024); will only add a word extra.

Remember these are not gospel, just things that seem to make sense...
but what would I know?

Rob Humphris

>Jean-Michel Brissiaud (brissiau AT miage DOT isi DOT u-psud DOT fr) writes:
>> Gal-on Broner wrote:
>>> 
>>> I compile a 14k source using gxx and receive an 200k+ image. How
>>> can I reduce this to more normal sizes?
>>> 
>>> Gal-on
>>> bgalon AT amanet DOT co DOT il
>> 
>> 200K is a verry good size for a 14K source. I'm not joking.
>

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019