svn commit: r216161 - in head/sys: amd64/amd64 i386/i386
dim at FreeBSD.org
Sat Dec 4 13:13:49 UTC 2010
On 2010-12-04 11:52, Kostik Belousov wrote:
> I have no idea how and where your gcc is configured, in particular, I
> find the non-documenting directive .zero somewhat puzzling.
According to the gas sources (see contrib/binutils/gas/read.c, line
412), .zero is equivalent to .skip, which itself is equivalent to
.space, except for HPPA targets.
> Behaviour of clang looks like a plain bug, since initialized objects must
> be put into the .data section, not into .bss.
I think the only requirement is that the object is initialized at
runtime with the value you specified at compile time. If you specify
zero, it is simply an optimization to put it in BSS (which is really
just an implementation detail).
There is even a gcc flag to control this behaviour:
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
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.
Clang also supports this flag, and its default setting is the same as
More information about the svn-src-all