Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Dec 2010 18:17:16 -0500
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        John Baldwin <jhb@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r216161 - in head/sys: amd64/amd64 i386/i386
Message-ID:  <201012031817.23834.jkim@FreeBSD.org>
In-Reply-To: <201012031802.40083.jkim@FreeBSD.org>
References:  <201012032154.oB3LsADC035461@svn.freebsd.org> <201012031744.01956.jkim@FreeBSD.org> <201012031802.40083.jkim@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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. :-/

Strangely, Clang increases .bss when a global variable is explicitly 
initialized to zero.

-  2 .bss 00000004 0000000000000000 0000000000000000 00000540 2**2
+  2 .bss 00000014 0000000000000000 0000000000000000 00000540 2**3

8-)

Jung-uk Kim



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012031817.23834.jkim>