
Timur Tabi wrote:
Jerry Van Baren wrote:
You don't understand, u-boot _is_ what zeros bss so, until u-boot is running enough to zero bss, bss will be random garbage.
If BSS were merged into the DATA segment, then the compiler would be the one that zeros BSS. Basically, BSS would go away, and all global variables (static or otherwise) would be placed into DATA. They would be initialized to zeros by the compiler, and when the image is burned into flash, that image would have zeros in those memory locations.
This would also allow us to delete the BSS-initialization code in U-Boot.
I'm not advocating that we should implement this idea. I just wanted to clarify things.
In theory, yes. In practice, I have my doubts that it is workable, let alone a better way. Writing "then the compiler would be the one that zeros BSS" is easy, actually making it work may be tricky. IMHO, there are more profitable windmills to tilt. :-) http://en.wikipedia.org/wiki/Don_Quixote
gvb