From owner-freebsd-hackers@FreeBSD.ORG Fri Apr 11 07:07:39 2003 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 B4F5637B401 for ; Fri, 11 Apr 2003 07:07:39 -0700 (PDT) Received: from ussenterprise.ufp.org (ussenterprise.ufp.org [208.185.30.210]) by mx1.FreeBSD.org (Postfix) with ESMTP id 164D043FBD for ; Fri, 11 Apr 2003 07:07:39 -0700 (PDT) (envelope-from bicknell@ussenterprise.ufp.org) Received: (from bicknell@localhost) by ussenterprise.ufp.org (8.12.8/8.12.8) id h3BE7cS3041816 for hackers@freebsd.org; Fri, 11 Apr 2003 10:07:38 -0400 (EDT) Date: Fri, 11 Apr 2003 10:07:38 -0400 From: Leo Bicknell To: hackers@freebsd.org Message-ID: <20030411140738.GA40724@ussenterprise.ufp.org> Mail-Followup-To: hackers@freebsd.org References: <5.2.0.9.2.20030411082040.02604e90@194.184.65.4> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="uAKRQypu60I7Lcqm" Content-Disposition: inline In-Reply-To: <5.2.0.9.2.20030411082040.02604e90@194.184.65.4> Organization: United Federation of Planets X-PGP-Key: http://www.ufp.org/~bicknell/ Subject: Re: gcc iussue or ... ? 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: Fri, 11 Apr 2003 14:07:40 -0000 --uAKRQypu60I7Lcqm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In a message written on Fri, Apr 11, 2003 at 08:41:37AM +0200, Gianmarco Gi= ovannelli wrote: > The problem is that if I compile it under FreeBSD it is a binary of 19M,= =20 > while on linux (debian 3.0), same Makefile, is only 2MB. FreeBSD 5.0 and= =20 > OpenBSD 3.1 produce the (about) 19M file. Well, the problem location is fairly obvious: % ls -lags | sort -nr | more 19416 -rwxr-xr-x 1 bicknell wheel 19854956 Apr 11 09:49 lonewolf* 16912 -rw-r--r-- 1 bicknell wheel 17286792 Apr 11 09:42 globals.o 368 -rw-r--r-- 1 bicknell wheel 365140 Apr 11 09:46 npcinfo.o 304 -rw-r--r-- 1 bicknell wheel 301100 Apr 11 09:47 targeting.o 272 -rw-r--r-- 1 bicknell wheel 267648 Apr 11 09:48 virtues.o [etc] A quick nm --size-sort globals.o | tail shows: 00009b80 D ownsp 00009b80 D spawnsp 000138a0 D location 00111020 D region 002180a0 D buffer 002190a0 D PacketFetcher 01061710 D PacketSender 01061778 D cwrap 010617f0 D w_anim 01061850 D wp_version buffer, for instance appears to be 129 * 17000 =3D 2193000, a 2M buffer, and nm shows 2195616 bytes. I can't track down quickly why the others are so big, but I suspect you may be making them bigger than you expected. It could also be that FreeBSD puts some types of globals in the executable to load, where as Linux puts them in some zero filled pages or something, I don't know enough to know for sure. Either way, you probably want to make the data smaller, or dynamically allocate it to make sure you don't run into this on any platform. --=20 Leo Bicknell - bicknell@ufp.org - CCIE 3440 PGP keys at http://www.ufp.org/~bicknell/ Read TMBG List - tmbg-list-request@tmbg.org, www.tmbg.org --uAKRQypu60I7Lcqm Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.4 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE+lswqNh6mMG5yMTYRAsiPAJ4jihpSn3tKk91f7um3VCIzHf83zQCfSKXi TDo5t1uWyU5Te7WAEARgkDg= =8JAs -----END PGP SIGNATURE----- --uAKRQypu60I7Lcqm--