delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/06/18/14:17:25

Xref: news-dnh.mv.net comp.os.msdos.djgpp:427
Path: news-dnh.mv.net!mv!news.sprintlink.net!uunet!sunic!sunic.sunet.se!news.uni-c.dk!diku.dk!terra
From: terra AT diku DOT dk (Morten Welinder)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Code generation
Date: 18 Jun 1995 15:29:43 GMT
Organization: Department of Computer Science, U of Copenhagen
Lines: 43
Sender: terra AT tyr DOT diku DOT dk
References: <DAD8nE DOT Bs2 AT jade DOT mv DOT net>
Nntp-Posting-Host: odin.diku.dk
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

"George C. Moschovitis" <gmoscho AT alexander DOT cc DOT ece DOT ntua DOT gr> writes:

>Hi there...

> i compiled the hello.c programm from the V2 snapshot and it generated
> an 93kb .exe file. I looked at the executable and found that the linker included all the names (as strings) of the functions included from the libs.
> is there any switch to prevent this ? coz 93 kb for a hello.c is really
> TOO much. 

The short answer: remove debugging info with "strip foo".

The long answer: most compilers generate output whose size can be
estimated by (a x + b) where "x" is the number of lines in the
program while "a" and "b" are compiler-dependant constants.

Very often there is a trade-off: you can lower "b" by doing more
agressive unfolding which in turn increased "a".  OR you can lower
"a" by making more complex library routines which then increases
"b".  Pick your poison.  hello.c gives you an estimate of "b" but
not a clue about "a".

Since har disk allocation blocks there days often are 8KB or more,
that's the granularity you have to care about for the sum.

Last word from DJ suggested that "b" for DJGPP V2 will be about 28K.
I assume you can get it lower if you cut out the command line
expansion.  For just about any program but hello.c this is not
worth the while.

Morten

PS on indentation style and style wars: most C programs should be
indented six feet downwards and covered with dirt.

PPS: Whatever "a" is, it can be lower by compressing the image.
I plan to do so in about half a year, if nobody beats me to it.



-------------------------------------------------------------------------
For information on the free Republic of Macedonia connect to the WWW link
http://ASUdesign.eas.asu.edu/places/Macedonia/republic/
-------------------------------------------Morten Welinder, terra AT diku DOT dk

- Raw text -


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