From owner-freebsd-current@FreeBSD.ORG Wed Mar 9 13:27:15 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90F0E1065672; Wed, 9 Mar 2011 13:27:15 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 68D0B8FC12; Wed, 9 Mar 2011 13:27:15 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 22CAE46B49; Wed, 9 Mar 2011 08:27:15 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.10]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id BE7AB8A027; Wed, 9 Mar 2011 08:27:14 -0500 (EST) From: John Baldwin To: freebsd-current@freebsd.org Date: Wed, 9 Mar 2011 08:23:41 -0500 User-Agent: KMail/1.13.5 (FreeBSD/7.4-CBSD-20110107; KDE/4.4.5; amd64; ; ) References: <20110308173909.GA71091@freebsd.org> <20110308211931.1c5deb8b@r500.local> <20110308205212.GA96321@freebsd.org> In-Reply-To: <20110308205212.GA96321@freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201103090823.41757.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Wed, 09 Mar 2011 08:27:14 -0500 (EST) Cc: Roman Divacky , current@freebsd.org Subject: Re: [TESTING]: one more boot2 shrinking patch X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Mar 2011 13:27:15 -0000 On Tuesday, March 08, 2011 3:52:12 pm Roman Divacky wrote: > On Tue, Mar 08, 2011 at 09:19:31PM +0100, Fabian Keil wrote: > > Roman Divacky wrote: > > > > > this diet patch > > > > > > http://lev.vlakno.cz/~rdivacky/boot2-final-diet.patch > > > > > > includes these changes: > > > > > > o bunch of variables are turned into uint8_t > > > > > > o initial setting of namep[] in lookup() is removed > > > as it's only overwritten a few lines down > > > > > > o kname is explicitly initialized in main() as BSS > > > in boot2 is not zeroed > > > > Are you saying the previous: > > > > static const char *kname = NULL; > > > > didn't work, or is this the explanation why the > > initialization hasn't simply been removed? > > gcc nor clang emits any code to initialize static type foo = 0; > because it's expected that BSS is zeroed, which is not the case > in boot2 so we have to initialize that explicitly It used to be that if you explicitly initialized a variable to 0, it was initialized to 0 in .data, but now gcc and clang recognize it is set to 0 and move it to .bss. There appears to be no way to turn this feature off, and while it is useful for most programs, it is not useful for boot code such as this. -- John Baldwin