This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: bss section not getting zero-initialised vars


Richard Henderson <rth@cygnus.com> writes:

> On Wed, Jan 19, 2000 at 01:04:33AM -0800, Mark Mitchell wrote:
> > Ugh.  Really?  Ok, I believe you -- I take it the undumping code wants
> > to do something sick and twisted to the binary image?
> 
> No, it wouldn't be the undumping per-se but `int data_start = 0;'
> sorts of things.
> 
> > So, I guess we need to think a little harder before doing this, or
> > risk the -fstrict-aliasing firestorm again.  Can you think of other
> > programs, besides emacs, that depend on this?
> 
> Probably the Bohem GC library.  Off-hand I can't think of anything
> else, but I'm sure there's others.

glibc does this a fair bit for various reasons.

In fact, I'm sure I've seen "int data_start = 0;" in some of the crt* files.

It's also used with libraries, when you want to make sure that a .o
file does (or does not) get linked into the executable from a .a file.

Also with shared libraries, because the linker will initialise a .bss
variable with a value from a shared library, but won't initialise one
in .data.  You can imagine (or perhaps not, if you haven't looked at
glibc) the fun you can have with this and weak symbols and symbol
versioning.

In short, you really don't want to change this.

-- 
- Geoffrey Keating <geoffk@cygnus.com>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]