Mail Archives: djgpp-workers/2001/10/30/04:55:47
> Date: Mon, 29 Oct 2001 22:06:45 +0000
> From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
>
> Below is a patch for develop.txi in the knowledge base, which describes
> what to do about BSS and restarting programs (aka Emacs ;) ) restarting.
Thanks.
> OK to commit?
I have a few comments:
> + Uninitialised static and global data is placed in the section @dfn{bss}.
That @dfn is not really approppriate here, since you are not
explaining what BSS is. Better use @code{bss}, or even "the
@code{bss} section".
> + The BSS is zeroed by the start-up code. It would seem that one can rely
> + on uninitialised static and global variables being initialised to zero.
> + Unfortunately it is possible that the start-up code is not called.
> + This happens where programs are restarted --- Emacs is one example.
That's backwards: in the case of Emacs, the startup code is actually
executed several times, one each for every time Emacs is dumped.
The _real_ problem is not with the startup code. The variables in the
BSS section are AFAIK initialized by the linker, not by the startup
code.
Also, I think uninitialized variables in BSS are not the only ones for
which this issue is relevant: static initialized variables are also
subject to this.
The problem with Emacs is that the program was already running when it
was dumped, so static variables have values in them that may be
different from their initial values. Dumping will then record their
actual values at dump time, not the values they had when the program
was first started. So, when the program starts after it was dumped, a
static variable won't have a zero value (or any other initial value
you programmed), but instead the last value it had before the program
was dumped.
- Raw text -