
Hi Wolfgang,
On 29.03.19 13:06, Wolfgang Denk wrote:
In message 81e69dec-21e7-7b34-a261-e22ae9bef795@denx.de you wrote:
The big question is, how many places do we have in code, where we access BSS before relocation ?
Hopefully none.
May we better clear BSS very early (at last may possible on arm)?
You cannot. There is no storage allocated for BSS - this happens only during relocation, and then it also gets zeroed.
This is not 100% correct for all platforms. On some targets, e.g. where the DDR is initialized by SPL, the BSS location before relocation is already a valid address space in DDR in the main U-Boot proper. AFAICT, the BSS *could* already be used before relocation in these cases. Here the BBS could be cleared very early and relocated later with the code etc. No clearing in the relocation stage necessary.
But since this is a special case, it makes no real sense to implement such an "early BSS" strategy into U-Boot, as other platforms will always exist, where the BSS is really only available after relocation (as you mentioned above).
Thanks, Stefan