
In message 454F9FB2.8090009@freescale.com you wrote:
However, with the current u-boot linker scripts (some of them, at least; I'm not going to make a sweeping statement about all 270), data *explicitly* initialized to zero is also going in the bss. Combined
Yes, and this is perfectly fine from the ANSI C standard point of view. The situation is that we don;t have a standard C environment yet, so you must not insist on being able to use standard C.
with the fact that some C code is executed before the bss is cleared, that is simply evil.
It is one of several restrictions. There are many more. For example, you cannot write any data in the data segment either. And you cannot put big data structures on the stack. And you have to keep in mind that you must not nest function calls too deeply because thestack size is very limited. And... and...
It's IMHO nensense to figt this situation, you just make it worse. Insted, please focus on moving all complex code *after* relocation, where all these problems go away automagically.
I have stated the reason. If you prefer an environment that invites bugs and ugly workarounds thereto, then suit yourself.
You don't fix anything but one special case (the initial assignment of a zero). Any later assignments to the same variable will still fail. If this deems OK to you, then please just use "#define foo 0" instead of "int foo=0;"
Best regards,
Wolfgang Denk