Article View: gnu.gcc.help
Article #50087Re: Help: enormous .o files from g++
From: Douglas Scott
Date: Mon, 22 Nov 1993 06:44
Date: Mon, 22 Nov 1993 06:44
42 lines
2708 bytes
2708 bytes
In article <boutellCGn8nM.D5@netcom.com> boutell@netcom.com (Drinks All The Water) writes: ] ]In article <2cboj4$e4m@vtserf.cc.vt.edu> skelley@birch.ee.vt.edu writes: ]>Hi, ]> Have you used "strip" to remove the debugging ]>information from your executables? By default, the libg++ ]>is compiled with the "-g" option which adds ~250KB to ]>every executable on our Sparcs [I now compile libg++ ]>without the "-g" option]. Sean. ] ]I've been waiting a week for a response to this question- I appreciate ]your efforts. As I explained, I only get a huge ]library when I compile the files separately; catting them together ]and compiling them as one .cc file produces a tiny library. ]Not only that, but this is *library* size, before linking, ]so the size of libg++ hasn't even been factored in yet. ] ]All I'm trying to find out is whether gcc 2.5.x improves the ]template expansion size situation or not. Anybody know? ] Your problem is most likely related to the duplication of many, many symbols for functions which are declared inline in your headers. Many books do not make it clear that though a function may be inserted inline by the compiler if the conditions are correct, the compiler will most often create a symbol for that function anyway, most especially if it is a virtual function. For every file that #includes a given header, you will get a full set of symbols for the functions inlined in that header. The solution to this is to use the #pragma interface/#pragma implementation directives in each .C - .h pair. See the g++ man page for more info. I was able to reduce the size of my object files by over **60** percent! Hope this helps. -- Douglas Scott | Senior Development Engineer Tel: (805) 893-8352 | Center for Computer Music Research and Composition Internet (NeXTMail ok): | Music Department <doug@ccmrc.ucsb.edu> | University of California, Santa Barbara
Technical Details
Message-ID:
<2cpn4e$56u@hub.ucsb.edu>Path:
arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!europa.eng.gtefsd.com!library.ucla.edu!nntp.ucsb.edu!foxtrot!dougReferences:
<boutellCGJM99.2xK@netcom.com> <2cboj4$e4m@vtserf.cc.vt.edu> <boutellCGn8nM.D5@netcom.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,ad6f10e486631961 X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-11-21 23:37:49 PST Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!europa.eng.gtefsd.com!library.ucla.edu!nntp.ucsb.edu!foxtrot!doug From: doug@foxtrot.ccmrc.ucsb.edu (Douglas Scott) Newsgroups: gnu.gcc.help Subject: Re: Help: enormous .o files from g++ Date: 22 Nov 1993 06:44:30 GMT Organization: Center for Computer Music Research and Composition, U.C.S.B. Lines: 42 Message-ID: <2cpn4e$56u@hub.ucsb.edu> References: <boutellCGJM99.2xK@netcom.com> <2cboj4$e4m@vtserf.cc.vt.edu> <boutellCGn8nM.D5@netcom.com> NNTP-Posting-Host: foxtrot.ucsb.edu