From owner-svn-src-all@FreeBSD.ORG Sat Dec 4 10:52:38 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C5931065672; Sat, 4 Dec 2010 10:52:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 9E8198FC24; Sat, 4 Dec 2010 10:52:37 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id oB4AqXiY042765 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 4 Dec 2010 12:52:33 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id oB4AqWjR081735; Sat, 4 Dec 2010 12:52:32 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id oB4AqW6u081734; Sat, 4 Dec 2010 12:52:32 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 4 Dec 2010 12:52:32 +0200 From: Kostik Belousov To: Roman Divacky Message-ID: <20101204105232.GI2392@deviant.kiev.zoral.com.ua> References: <201012032154.oB3LsADC035461@svn.freebsd.org> <201012031744.01956.jkim@FreeBSD.org> <201012031802.40083.jkim@FreeBSD.org> <201012031817.23834.jkim@FreeBSD.org> <20101204103625.GA106@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PtQ9L71AUUAqcVqK" Content-Disposition: inline In-Reply-To: <20101204103625.GA106@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin , Jung-uk Kim Subject: Re: svn commit: r216161 - in head/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Dec 2010 10:52:38 -0000 --PtQ9L71AUUAqcVqK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 04, 2010 at 11:36:25AM +0100, Roman Divacky wrote: > On Fri, Dec 03, 2010 at 06:17:16PM -0500, Jung-uk Kim wrote: > > On Friday 03 December 2010 06:02 pm, Jung-uk Kim wrote: > > > On Friday 03 December 2010 05:43 pm, Jung-uk Kim wrote: > > > > On Friday 03 December 2010 05:08 pm, John Baldwin wrote: > > > > > On Friday, December 03, 2010 4:54:10 pm Jung-uk Kim wrote: > > > > > > Author: jkim > > > > > > Date: Fri Dec 3 21:54:10 2010 > > > > > > New Revision: 216161 > > > > > > URL: http://svn.freebsd.org/changeset/base/216161 > > > > > > > > > > > > Log: > > > > > > Explicitly initialize TSC frequency. To calibrate TSC > > > > > > frequency, we use DELAY(9) and it may use TSC in turn if TSC > > > > > > frequency is non-zero. > > > > > > > > > > We zero the BSS, so these were already zero. This just makes > > > > > the actual kernel file on disk larger by wasting space in .data > > > > > instead of .bss. > > > > > > > > Please note that I didn't touch other variables, e.g., > > > > tsc_is_broken, because I knew that. However, I just wanted to do > > > > that *explicitly*. Anyway, it is reverted now and SVN will > > > > remember what I wanted to do. ;-) > > > > > > > > BTW, if my memory serves, GCC (and all modern C compilers) put(s) > > > > zero-initialized variables back in .bss. > > > > > > I just tried it. GCC generates identical binaries as I thought. > > > However, Clang doesn't do the optimization. :-/ > >=20 > > Strangely, Clang increases .bss when a global variable is explicitly=20 > > initialized to zero. > >=20 > > - 2 .bss 00000004 0000000000000000 0000000000000000 00000540 2**2 > > + 2 .bss 00000014 0000000000000000 0000000000000000 00000540 2**3 >=20 > in my naive test gcc produces: >=20 > .globl foo > .section .bss > .align 4 > .type foo, @object > .size foo, 4 > foo: > .zero 4 >=20 >=20 > and clang produces: >=20 > .type foo,@object # @foo > .bss > .globl foo > .align 4 > foo: > .long 0 # 0x0 > .size foo, 4 >=20 > ie. both put them into BSS I have no idea how and where your gcc is configured, in particular, I find the non-documenting directive .zero somewhat puzzling. Behaviour of clang looks like a plain bug, since initialized objects must be put into the .data section, not into .bss. Both gcc 4.2.1/FreeBSD and plain 4.5.1 produce .comm foo,4,4 when compiling the file consisting of long foo; line. For amd64, substitute 4 by 8. --PtQ9L71AUUAqcVqK Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAkz6HXAACgkQC3+MBN1Mb4hOSQCbBLSPdxmDzDgLFrG4NPzBA3iM 7ZEAoK420VpgIQFqLt37Tr2aCjvnL0zh =BN/r -----END PGP SIGNATURE----- --PtQ9L71AUUAqcVqK--