From owner-freebsd-hackers@FreeBSD.ORG Sun Mar 21 14:40:00 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6F7D816A4CE for ; Sun, 21 Mar 2004 14:40:00 -0800 (PST) Received: from smtp3.server.rpi.edu (smtp3.server.rpi.edu [128.113.2.3]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0BB9D43D31 for ; Sun, 21 Mar 2004 14:40:00 -0800 (PST) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp3.server.rpi.edu (8.12.8/8.12.8) with ESMTP id i2LMdxLP022427; Sun, 21 Mar 2004 17:39:59 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <20040321202243.GA3199@lava.net> References: <20040321200044.C571716A4D0@hub.freebsd.org> <20040321202243.GA3199@lava.net> Date: Sun, 21 Mar 2004 17:39:58 -0500 To: Clifton Royston From: Garance A Drosihn Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Scanned-By: CanIt (www . canit . ca) cc: hackers@FreeBSD.org Subject: Re: Adventures with gcc: code vs object-code size X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2004 22:40:00 -0000 At 10:22 AM -1000 3/21/04, Clifton Royston wrote: > > Date: Sat, 20 Mar 2004 From: Garance A Drosihn > > > > So, by adding one call to strcmp() to check for a ":" string, I > > end up with /bin/ps (the stripped-object-file) which has grown > > by 12.6% !! This is for a program which is almost 2500 lines > > spread out over 5 '.c'-files. How is that possible? What am > > I missing here? > > If it happens that strcmp was not previously being referenced >at all, absent this one line, then of course this change will >pull in the strcmp routine. Now while strcmp itself is not ... I forgot to include a significant part of this puzzle. The same ps.c file already had two calls to strcmp() in it: ps.c: if (strcmp(elem, "co") == 0) ps.c: if (strcmp(elemcopy, ":") == 0) ps.c: if (strcmp(vent->var->name, v->name) == 0) There was no strcmp() in the subroutine that I added it to, but I would assume that those other references would have already pulled in the routine. > This may also be true even if gcc is partially inlining it. >gcc may be pulling in a big clump of its own internal support >routines in that case, ... but would it inline it's own routines multiple times in the same source file? >Again, differencing the symbol table should give you some idea. Well, I was hoping someone would have already seen this before, but I guess I will need to do some more checking if I'm going to get a better idea of what is going on. I'll put it on my list of "things to look at when I have some spare time"... -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu