Mail Archives: djgpp/1996/08/13/23:00:29
Alexander Lehmann wrote:
>
> : Another little trick is to strip your Coff files. Gcc adds some
> : rudimentary debug info even when compiling without the '-g' option.
> : If you compile to Coff - 'gcc -o foo ...' - rather than exe -
> : 'gcc -o foo.exe ...' - then you can strip the resulting binary and use
> : stubify to turn it into a much smaller exe.
>
> Or you can strip the COFF binary and recreate a new .exe with coff2exe
> (or if you have only the .exe first exe2coff, strip and then
> coff2exe). This works even with executables that are acidentally
> distributed unstripped (jpeg386 did that at one point, I think).
>
> bye, Alexander
>
Some standard functions are much larger than others:
printf() smacks 30k extra. Use puts() instead if possible.
Compiling with -ffast-math , -fomit-frame-pointer reduces
size too. (Of course, these switches carry their own attendant
dangers).
But really, the size problem isn't too bad. There's a bare minimum
of around 50k for the extender code, but the PMODE 2.5 assembly
extender by Tran (Thomas Pytel), the best freeware assembly extender
around, also adds 30k extra to the .exe file. So much for the
compactness of assembler.
I think a lot of dead weight after that comes from certain standard
C functions like printf(), and the error-handling associated
with them. Trial and error should show which ones are the worst.
-Elliott
- Raw text -