[U-Boot-Users] Non-static global variables cause relocation to fail

Jerry Van Baren gvb.uboot at gmail.com
Sun Jun 22 19:17:34 CEST 2008


Timur Tabi wrote:
> Jerry Van Baren wrote:

[snip]

>> I'm guessing from the name "eeprom" that you have a non-zero initializer 
>> on it???  
> 
> No, no initializer.
> 
>> Does it make a difference if it is uninitialized, initialized 
>> to {0}, or initialized to non-zero values?
> 
> I don't know, I haven't considered it.
> 
> I did notice this code in fsl_i2c.c:
> 
> #ifdef CFG_SPD_BUS_NUM
> static unsigned int i2c_bus_num __attribute__ ((section ("data"))) =
> CFG_SPD_BUS_NUM;
> #else
> static unsigned int i2c_bus_num __attribute__ ((section ("data"))) = 0;
> #endif
> 
> I wrote this code, but I don't remember why I added the "__attribute__ ((section
> ("data")))".  I guess I should have commented it, but I wonder if it applies to
> my current problem.

It doesn't apply in the original complaint and may be flat out wrong, 
but I recall having a problem forcing a zero initializer into the data 
section.  Gcc insisted on putting it in bss and, after playing language 
lawyer with the gcc manual/descriptions/etc, I concluded it was expected 
behavior of gcc.

[snip]

> When I post the full patch, I'll revisit this problem.  Sorry for all the noise.

Interesting quirk.  We may give you a hard time, but that just betrays 
our curiosity.  ;-)

Best regards,
gvb





More information about the U-Boot mailing list