www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/02/03:06:04

Date: Thu, 2 May 1996 09:58:40 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Kristian H|gsberg Kristensen <u951303 AT rouen DOT daimi DOT aau DOT dk>
Cc: djgpp AT delorie DOT com
Subject: Re: Size of executable
In-Reply-To: <y6yu3y3xkan.fsf@rouen.daimi.aau.dk>
Message-Id: <Pine.SUN.3.91.960502094914.6400P-100000@is>
Mime-Version: 1.0

On 29 Apr 1996, Kristian H|gsberg Kristensen wrote:

> It seems to me that the executable file produced by gcc is guite large...?
> I compiled the standard "Hello, world"-program, and the output executable 
> took up 57k, 32k when compiled with the -s option.
>  
> I know that there's got to be this stub-loader, dpmi-interfacing etc. 
> but does this really take up all this space, or did I just overlook 
> some switch? What are the options if you want to reduce the size of
> the output?

The stub loader is very small--a mere 2K.  What's taking most of those
32KB is the code that expands (globs) command-line arguments (so you can
say ``myprog *.c''), reads and parses the DJGPP.ENV file, and sets up the
command-line arguments in the argv[] array.  If you don't need any (or
all) of these, you can define empty substitutes for a few library
functions, which will slash the size of the startup code to about 14K;
that makes the smallest program to be 16KB. 

For details, look in the libc reference, under the functions whose names 
begin with `__crt0_'.

Most non-trivial programs, though, cannot do without at least two of the
three features above (filename globbing can be left out more often).  But
then most non-trivial programs are much too large to consider 30K a
significant overhead. 

- Raw text -


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