From owner-freebsd-current@FreeBSD.ORG Thu Mar 10 16:58:32 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 ACE02106566B; Thu, 10 Mar 2011 16:58:32 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-ww0-f42.google.com (mail-ww0-f42.google.com [74.125.82.42]) by mx1.freebsd.org (Postfix) with ESMTP id C1BE18FC08; Thu, 10 Mar 2011 16:58:31 +0000 (UTC) Received: by wwi17 with SMTP id 17so1644094wwi.1 for ; Thu, 10 Mar 2011 08:58:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=qdYCUkDBj4jLdfHAHpqQVsJ3+SaNNQKR+W8/1dsCI2Q=; b=xOLz7s+S/mkJphRhI0HeoODeCWIkEMEQNf+F39TAnKkuhYUQ4VoUkHVLr9KFj6mqXN Qf/OMlGEF1TrHhwrUGRZttdA+XOauy5UF7+9Go715O7W0yE2OxuIXwEgPdkF6Wh/MyOU QgBhZPuHncC1WNuUeB6YM57VGK4WQIl3HZ+d0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Y7RayN+pP/+ra5qZK4u95OaQOYRHsmduQjAdNo4AtAYdylKIFJ/DxC26h97GDSSdIO d0dnA0MhT/AmYOgv8LR04u1LvmKQQvRhdZbteeJ6VSjXlM1abgQfGrMSMoHF7De2dwpi iCfhfapJpRaZ/FupDSZU4Et4HgAikXhxjFCVU= MIME-Version: 1.0 Received: by 10.216.59.81 with SMTP id r59mr6237695wec.40.1299776310662; Thu, 10 Mar 2011 08:58:30 -0800 (PST) Received: by 10.216.62.130 with HTTP; Thu, 10 Mar 2011 08:58:30 -0800 (PST) In-Reply-To: <20110310163732.GA38320@freebsd.org> References: <20110308173909.GA71091@freebsd.org> <201103090823.41757.jhb@freebsd.org> <4D780C34.4010509@FreeBSD.org> <201103100920.58279.jhb@freebsd.org> <20110310163732.GA38320@freebsd.org> Date: Thu, 10 Mar 2011 08:58:30 -0800 Message-ID: From: Matthew Fleming To: Roman Divacky Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-current@freebsd.org, Dimitry Andric 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: Thu, 10 Mar 2011 16:58:32 -0000 On Thu, Mar 10, 2011 at 8:37 AM, Roman Divacky wrote= : > On Thu, Mar 10, 2011 at 09:20:58AM -0500, John Baldwin wrote: >> On Wednesday, March 09, 2011 6:24:36 pm Dimitry Andric wrote: >> > On 2011-03-09 14:23, John Baldwin wrote: >> > >> gcc nor clang emits any code to initialize static type foo =3D 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. =A0There 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 >> > =A0 =A0 =A0If the target supports a BSS section, GCC by default puts v= ariables >> > =A0 =A0 =A0that are initialized to zero into BSS. This can save space = in the >> > =A0 =A0 =A0resulting code. >> > >> > =A0 =A0 =A0This option turns off this behavior because some programs >> > =A0 =A0 =A0explicitly rely on variables going to the data section. E.g= ., so >> > =A0 =A0 =A0that the resulting executable can find the beginning of tha= t >> > =A0 =A0 =A0section and/or make assumptions based on that. >> > >> > =A0 =A0 =A0The default is -fzero-initialized-in-bss. >> >> Hah, that is better then. =A0Thanks! I should have searched about this m= ore >> myself. :( =A0Roman, can you try reverting the kname changes and adding = this >> to CFLAGS instead for both compilers? > > when I put -fno-zero-initialized-in-bss clang does not fit by 1.7K and > gcc by 0.5K, we dont want this :) If there's that many variables explicitly initialized to zero, does boot2 then need to explicitly bzero all of bss, not just kname, since it's not handled by the loader? Otherwise it sounds like either there's a lot of explicitly initialized variables that didn't need to be, or there's a lot of potential for uninitialized variable nonsense to happen. Thanks, matthew