From owner-freebsd-current@FreeBSD.ORG Wed Mar 9 23:24:28 2011 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8EAF01065672; Wed, 9 Mar 2011 23:24:28 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 4B7A38FC17; Wed, 9 Mar 2011 23:24:28 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:4fb:f711:ed42:fd1a] (unknown [IPv6:2001:7b8:3a7:0:4fb:f711:ed42:fd1a]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 1FAD95C59; Thu, 10 Mar 2011 00:24:27 +0100 (CET) Message-ID: <4D780C34.4010509@FreeBSD.org> Date: Thu, 10 Mar 2011 00:24:36 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.15pre) Gecko/20110303 Lanikai/3.1.9pre MIME-Version: 1.0 To: John Baldwin References: <20110308173909.GA71091@freebsd.org> <20110308211931.1c5deb8b@r500.local> <20110308205212.GA96321@freebsd.org> <201103090823.41757.jhb@freebsd.org> In-Reply-To: <201103090823.41757.jhb@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Roman Divacky , freebsd-current@freebsd.org, 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 23:24:28 -0000 On 2011-03-09 14:23, John Baldwin wrote: >> 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, Yes, there is; both gcc and clang have this option to turn it off: -fno-zero-initialized-in-bss If the target supports a BSS section, GCC by default puts variables that are initialized to zero into BSS. This can save space in the resulting code. This option turns off this behavior because some programs explicitly rely on variables going to the data section. E.g., so that the resulting executable can find the beginning of that section and/or make assumptions based on that. The default is -fzero-initialized-in-bss.