[U-Boot] arm: wrong Relocation and not cleared BSS

Alexander Holler holler at ahsoftware.de
Sun Oct 31 11:59:40 CET 2010


Hello,

Am 30.10.2010 16:36, schrieb Wolfgang Denk:
> Dear Albert ARIBAUD,
>
> In message<4CCC1F6C.7040603 at free.fr>  you wrote:
>>
>> Wait a minute. No parts of the code assume BSS is *cleared*, or at least
>> no pat of the should *should ever* assume that. BSS is not "zeroed
>> data", it is "uninitialized data".
>
> BSS _is_ zeroed data. This is a very basic assumption of the C
> runtime.
>
>> BSS is not *required* to be zero. It is zeroed out as a courtesy, but>
>
> No, you are wrong here.
>
> Zeroing of the BSS is a mandatory requirement.


Beeing curious, I've looked up that part in the C99 standard. Just to 
refresh our memories:

-------------------------------------
6.7.8

10

If an object that has automatic storage duration is not initialized 
explicitly, its value is
indeterminate. If an object that has static storage duration is not 
initialized explicitly,
then:
— if it has pointer type, it is initialized to a null pointer;
— if it has arithmetic type, it is initialized to (positive or unsigned) 
zero;
— if it is an aggregate, every member is initialized (recursively) 
according to these rules;
— if it is a union, the first named member is initialized (recursively) 
according to these
rules.
-------------------------------------

Regards,

Alexander





More information about the U-Boot mailing list