[U-Boot] use of global static variables?

With the relocation changes are global statics variables ok if we know code is called after relocation?
- k

Hi Kumar,
On Fri, 2010-05-21 at 07:52 -0500, Kumar Gala wrote:
With the relocation changes are global statics variables ok if we know code is called after relocation?
Yes, they should work as expected after relocation.
Prior to relocation you should be able to read the values of the global statics if they are initialized to a non-zero value, but not modify them.
Best, Peter

Dear Peter Tyser,
In message 1274450989.18152.273.camel@petert you wrote:
With the relocation changes are global statics variables ok if we know code is called after relocation?
Yes, they should work as expected after relocation.
Prior to relocation you should be able to read the values of the global statics if they are initialized to a non-zero value, but not modify them.
Correct. And in some places we enable these even for zero valued variables by using the old trick of writing
int foo __attribute__ ((section(".data"))) = 0;
Best regards,
Wolfgang Denk

Dear Kumar Gala,
In message BF924A4F-6A8D-43C0-9B7B-58D1C6D3B850@kernel.crashing.org you wrote:
With the relocation changes are global statics variables ok if we know code is called after relocation?
They have always been ok (as far as global variables can be ok) if you were aware of their restrictions before relocation.
Best regards,
Wolfgang Denk
participants (3)
-
Kumar Gala
-
Peter Tyser
-
Wolfgang Denk