delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/25/04:34:33

From: leereyno AT imap2 DOT asu DOT edu
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Why does gcc make such big binaries?
Date: 25 May 1997 07:40:04 GMT
Organization: Arizona State University
Lines: 45
Message-ID: <5m8qck$avt@news.asu.edu>
References: <Pine DOT OSF DOT 3 DOT 91 DOT 970518132348 DOT 61A-100000 AT hermes DOT otago DOT ac DOT nz> <5ln25g$2p4 AT news DOT ox DOT ac DOT uk>
NNTP-Posting-Host: general3.asu.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

George Foot (mert0407 AT sable DOT ox DOT ac DOT uk) wrote:
: Richard Collins (rcollins AT hermes DOT otago DOT ac DOT nz) wrote:

: : Which worked well, but I was shocked to see the program was about 80k.

: : So I tried:

: : Main(){}

: : Which compiled to 60k.

: : I tried the equivilent programs in turbo pascal, and got 2.4k and 1.6k 
: : respectivly.

: Do the same thing using debug, writing it in assembler; you'll only need a
: couple of bytes :)

: The point is, there is a certain amount of startup code which gets added
: to all your programs. It performs several functions, including looking for
: a DPMI host, loading CWSDPMI if it can't find one, globbing the
: command-line, switching to protected mode and starting your actual program
: code. For these short programs it is pretty useless; you don't need
: protected mode to just do nothing; nor do you need therefore a DPMI
: server, a stub, command-line globbing, etc.

: If you write longer programs, you shouldn't see so much difference between
: executable sizes in DJGPP and other environments, relative to the size of
: the executable. The second thing you should try is stripping the debugging
: information out of the executables. By default, gcc puts a certain amount
: in, and if you specify -g it puts a great deal more in. Specifying -s, or
: running strip on the executable, will remove all this debugging
: information.

: This isn't actually the problem with the above code, since there isn't
: really much debugging information to strip, but when you write longer
: programs bear this in mind. I would suggest using -g during the
: development stage, and only stripping the information before distributing
: your programs.

: -- 
: George Foot <mert0407 AT sable DOT ox DOT ac DOT uk>
: Merton College, Oxford

GCC under linux makes tiny code.  My mandelbrot program is about 13k 
long.  The Dos version is over 100k.

- Raw text -


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