Cross gcc Mailing List Archive
[Prev][Next][Index][Thread]
Re: Newlib's crt0.S
David Wood wrote:
>
> I'm not sure if this will cause trouble, but is suspect its fine.
It depends on how the code is loaded.
> The ANSII spec says that uninitialised variables will be zero at startup. The
This is normally handled by the startup code (crt0) zeroing the
BSS on standalone systems. Other operating systems (eg. Unix) map
the BSS ZFOD
(zero-fill-on-demand), or zero the entire load area
(eg. DOS).
> assumption for initialised variables is that the compiler will generate code
> that will initialise them before the main body of code is entered.
Again, this depends on your environment. If your code is running
in RAM, then initialised globals will normally be in the data
segment, and are thus implicitly initialised when the image is
loaded.
If you're running from ROM, the startup code may have to copy
values from ROM to RAM. (It's generally a pain in the rear to
relocate the data segment like this.)
> In the case
> of C++, there will be a list of constructors to call.
This is again handled by the startup code; the linker produces a list
of global constructors which are processed before main() is called.
(Note that the above are based largely on using Gcc for embedded
development.)
--
Mike Smith *BSD hack Unix hardware collector
The question "why are the fundamental laws of nature mathematical"
invites the trivial response "because we define as fundamental those
laws which are mathematical". Paul Davies, _The_Mind_of_God_
Follow-Ups:
- Re: Newlib's crt0.S
- From: "Joel Sherrill <joel@merlin.gcs.redstone.army.mil>" <joel@merlin.gcs.redstone.army.mil>
References:
Home |
Subject Index |
Thread Index