*BSD News Article 75966


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!qns3.qns.net!imci4!newsfeed.internetmci.com!in3.uu.net!shemesh.hq.tis.com!dira.rv.tis.com!not-for-mail
From: mark@dira.rv.tis.com (Mark Sienkiewicz)
Newsgroups: comp.unix.bsd.bsdi.misc
Subject: Re: large executables!
Date: 12 Aug 1996 14:22:17 -0400
Organization: Trusted Information Systems
Lines: 20
Message-ID: <4unsop$lpk@dira.rv.tis.com>
References: <4ufg5p$1k2@fnord.dfw.net>
NNTP-Posting-Host: dira.rv.tis.com

In article <4ufg5p$1k2@fnord.dfw.net>, Mark Blythe <blythe@dfw.dfw.net> wrote:
>Using gcc version 2.7.2, a simple one line "Hello world" program generates
>nearly a 10K executable.   A modest 50 line program results in a 32K
>executable!  This 50 line program should make a MUCH smaller program.
>No matter what optimization flags I pass to the compiler, the file
>size doesn't change a single byte.  I've tried -O1 -O2 and -O3.

The size of the executables is basically the size of your code + the
size of any library code you use + the size of the symbol table.

"Hello world" uses stdio, which is probably most of the 10k
executable.  Any other functions you call from the bigger program
are also bound into your executable.

You can use "strip a.out" to remove the symbol table.  You won't
be able to run the gdb on it after that, but so what.

Somebody else posted a message about how to use the shared libraries,
so I won't go into it.