🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #53396

Re: Long executable with math library

#53396
From: Markus Wild
Date: Tue, 14 Jan 1992 23:39
28 lines
2133 bytes
In article <GRABINER.92Jan14153156@zariski.harvard.edu> grabiner@math.harvard.edu (David Grabiner) writes:
>In article <GRABINER.92Jan14151006@zariski.harvard.edu>, I wrote:
>
>> Using gcc 1.36 on a Sun 4, I have a program which is 12K in length and
>> uses one function (anint) from the math library.  The .o file is 48K,
>> but when the entire program is compiled with -lm, the executable is
>> 160K, which is still 152K when stripped.  As a comparison, cc gives a
>> 32K .o file and a 40K executable.
>
>The problem had nothing to do with the math library; I inlined the
>function and removed the inclusion of math.h, but I still got a 160K
>executable with gcc, and the .o file is still only 48K.  Where is all of
>this extra memory coming from?

Looks like cc dynamically links your program, whereas that version of gcc
links it statically. At least this would explain the vaste difference in
executable size. If the ldd command exists on the sun4 (don't have one ;-)),
you can verify which shared libraries are included in both resulting
executables. Probably the gcc generated one will contain less or no shared
library references.

-Markus


-- 
Markus M. Wild    -  wild@nessie.cs.id.ethz.ch  |  wild@amiga.physik.unizh.ch 
A transistor protected by a fast-acting fuse will protect the fuse by
blowing first.
Technical Details
Message-ID: <1992Jan14.233945.22830@bernina.ethz.ch>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!jvnc.net!darwin.sura.net!Sirius.dfn.de!chx400!bernina!wild
References: <GRABINER.92Jan14151006@zariski.harvard.edu> <GRABINER.92Jan14153156@zariski.harvard.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,1b6a7eb3a34a2790
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1992-01-14 16:27:38 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!jvnc.net!darwin.sura.net!Sirius.dfn.de!chx400!bernina!wild
From: wild@nessie.cs.id.ethz.ch (Markus Wild)
Subject: Re: Long executable with math library
Message-ID: <1992Jan14.233945.22830@bernina.ethz.ch>
Sender: news@bernina.ethz.ch (USENET News System)
Nntp-Posting-Host: nessie
Organization: Swiss Federal Institute of Technology (ETH), Zurich, CH
References: <GRABINER.92Jan14151006@zariski.harvard.edu> <GRABINER.92Jan14153156@zariski.harvard.edu>
Distribution: gnu
Date: Tue, 14 Jan 1992 23:39:45 GMT
Lines: 29