Re: [TESTING]: one more boot2 shrinking patch

From: John Baldwin <jhb_at_freebsd.org>
Date: Wed, 9 Mar 2011 08:23:41 -0500
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 <rdivacky_at_freebsd.org> 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
Received on Wed Mar 09 2011 - 12:27:15 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:12 UTC