Re: [PATCH] removal of "static foo = 0" from drivers/ide (test11)

Peter Samuelson
2000-11-29T00:24:38Z

[Tigran Aivazian]
> First, they are not trivially equivalent. In fact, they are not
> equivalent at all. Any good C book should tell you that one places
> data in "data segment" and another in "bss segment" (with a footnote
> explaining historical meaning of "block started by symbol")

Do you have an ISO C standard to refer to? I don't, but my guess is
that the standard does not even *mention* discreet data sections. It
*does* say that globals and statics are implicitly initialized to 0 --
the rest is a mere implementation issue.

So yes, the two statements *are* trivially equivalent, unless I'm wrong
and the standard *does* talk about data sections.

> For example a programmer could expect the variable to be in .data for
> binary patching the object

Binary patching? If you are binary patching something you need to get
the exact location, one way or another. Whatever tool you use to
extract the location of a symbol in an object file, that same tool
should tell you which section it is in. If the tool only looks in
'.data', it is flawed.

[David Hinds]
> > Did the savings really work out to be measured in kb's of space? I
> > would have expected compression to eliminate most of the savings.

Some boot targets are not compressed. And the variables are scattered
through the .data section rather than all in one place, so the 0s may
not compress as well as you'd think.

Anyway, by some estimates 'vmlinux' has gone down by several kilobytes
due to these patches. Obviously the exact savings depend on .config .

Peter