From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerry Van Baren Date: Mon, 06 Nov 2006 13:48:19 -0500 Subject: [U-Boot-Users] Why are some global vars part of the image, and some not? In-Reply-To: <454F7A30.9030100@freescale.com> References: <20061104020417.69640352658@atlas.denx.de> <454F7440.5030709@freescale.com> <454F78D6.6020805@smiths-aerospace.com> <454F7A30.9030100@freescale.com> Message-ID: <454F8373.1000300@smiths-aerospace.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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. :-) gvb