[TESTING]: one more boot2 shrinking patch
Dimitry Andric
dim at FreeBSD.org
Wed Mar 9 23:24:28 UTC 2011
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.
More information about the freebsd-current
mailing list