
Hello Wolfgang,
added Simon Goldschmidt to cc, as he just posted a patchset, which exactly wants to introduce "clear BSS before relocation" ...
Am 29.03.2019 um 13:06 schrieb Wolfgang Denk:
Dear Heiko,
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.
Hmm... Hopefully, but I think, not easy to detect when reviewing patches ... I just stumbeld over this issue in this patch from Stefan, because I could try it on a hardware, and my hardware doesn;t boot with this patch...
Theoretically you must check all vars, which are in BSS segment, if they are used before relocation ... and drop an error, no idea yet, how to detect this at compile time ...
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.
Yes, valid for the boards which have no SPL ... but if U-Boot is loaded with SPL into RAM, BSS is writeable. But as this is not valid for all boards, we cannot do this!
Just see the patches from Simon:
https://lists.denx.de/pipermail/u-boot/2019-March/361452.html
http://patchwork.ozlabs.org/patch/1067363/
Same problem ...
bye, Heiko